# Get Price GET https://api-stg.transak.com/api/v1/pricing/public/quotes Fetch a quote for fiat-to-crypto or crypto-to-fiat conversion. **1.** Although **fiatAmount** and **cryptoAmount** are both not required together, you need to pass at least one of them in all isBuyOrSell: "BUY" cases. Our recommendation would be to pass **fiatAmount** in such cases. If both **fiatAmount** and **cryptoAmount** are passed in case of isBuyOrSell: "BUY" then **cryptoAmount** would take precedence. **2.** In case of isBuyOrSell: "SELL", **cryptoAmount** is a required param. If **fiatAmount** is passed in such cases, then it will be ignored. **3.** **quoteCountryCode** is an optional param which should be passed in case you want to ensure consistency in pricing that user sees on your platform as well as ours. In case an invalid ISO 3166 Alpha-2 country code is passed then this param will not be honored. Please refer to this page for detailed information about the usage of `quoteCountryCode`. Reference: https://docs.transak.com/api/public/get-price ## OpenAPI Specification ```yaml openapi: 3.1.0 info: title: currencies-api version: 1.0.0 paths: /api/v1/pricing/public/quotes: get: operationId: get-price summary: Get Price description: |- Fetch a quote for fiat-to-crypto or crypto-to-fiat conversion. **1.** Although **fiatAmount** and **cryptoAmount** are both not required together, you need to pass at least one of them in all isBuyOrSell: "BUY" cases. Our recommendation would be to pass **fiatAmount** in such cases. If both **fiatAmount** and **cryptoAmount** are passed in case of isBuyOrSell: "BUY" then **cryptoAmount** would take precedence. **2.** In case of isBuyOrSell: "SELL", **cryptoAmount** is a required param. If **fiatAmount** is passed in such cases, then it will be ignored. **3.** **quoteCountryCode** is an optional param which should be passed in case you want to ensure consistency in pricing that user sees on your platform as well as ours. In case an invalid ISO 3166 Alpha-2 country code is passed then this param will not be honored. Please refer to this page for detailed information about the usage of `quoteCountryCode`. tags: - '' parameters: - name: partnerApiKey in: query description: Partner API key from your Transak dashboard. required: true schema: type: string default: YOUR_PARTNER_API_KEY - name: fiatCurrency in: query description: Fiat currency code. required: true schema: type: string default: USD - name: cryptoCurrency in: query description: Crypto currency symbol. required: true schema: type: string default: ETH - name: network in: query description: Blockchain network name. required: true schema: type: string default: ethereum - name: isBuyOrSell in: query description: Transaction direction. required: true schema: $ref: >- #/components/schemas/ApiV1PricingPublicQuotesGetParametersIsBuyOrSell - name: fiatAmount in: query description: >- Amount in fiat currency. For BUY, pass at least one of fiatAmount or cryptoAmount. required: false schema: type: number format: double default: 100 - name: cryptoAmount in: query description: Amount in crypto currency. For SELL, this parameter is required. required: false schema: type: number format: double default: 0.01 - name: paymentMethod in: query description: Payment method identifier. required: false schema: type: string default: credit_debit_card - name: quoteCountryCode in: query description: >- Optional ISO 3166 Alpha-2 country code used to keep quote pricing consistent. required: false schema: type: string default: US responses: '200': description: Price quote fetched successfully content: application/json: schema: $ref: '#/components/schemas/get-price_Response_200' servers: - url: https://api-stg.transak.com components: schemas: ApiV1PricingPublicQuotesGetParametersIsBuyOrSell: type: string enum: - BUY - SELL default: BUY title: ApiV1PricingPublicQuotesGetParametersIsBuyOrSell ApiV1PricingPublicQuotesGetResponsesContentApplicationJsonSchemaResponseFeeBreakdownItems: type: object properties: name: type: string value: type: number format: double id: type: string ids: type: array items: type: string required: - name - value - id - ids title: >- ApiV1PricingPublicQuotesGetResponsesContentApplicationJsonSchemaResponseFeeBreakdownItems ApiV1PricingPublicQuotesGetResponsesContentApplicationJsonSchemaResponse: type: object properties: quoteId: type: string conversionPrice: type: number format: double marketConversionPrice: type: number format: double slippage: type: integer fiatCurrency: type: string cryptoCurrency: type: string paymentMethod: type: string fiatAmount: type: integer cryptoAmount: type: number format: double isBuyOrSell: type: string network: type: string feeDecimal: type: number format: double totalFee: type: number format: double feeBreakdown: type: array items: $ref: >- #/components/schemas/ApiV1PricingPublicQuotesGetResponsesContentApplicationJsonSchemaResponseFeeBreakdownItems nonce: type: integer cryptoLiquidityProvider: type: string notes: type: array items: type: string required: - quoteId - conversionPrice - marketConversionPrice - slippage - fiatCurrency - cryptoCurrency - paymentMethod - fiatAmount - cryptoAmount - isBuyOrSell - network - feeDecimal - totalFee - feeBreakdown - nonce - cryptoLiquidityProvider - notes title: ApiV1PricingPublicQuotesGetResponsesContentApplicationJsonSchemaResponse get-price_Response_200: type: object properties: response: $ref: >- #/components/schemas/ApiV1PricingPublicQuotesGetResponsesContentApplicationJsonSchemaResponse required: - response title: get-price_Response_200 ``` ## SDK Code Examples ```python Success import requests url = "https://api-stg.transak.com/api/v1/pricing/public/quotes" querystring = {"partnerApiKey":"YOUR_PARTNER_API_KEY","fiatCurrency":"USD","cryptoCurrency":"ETH","network":"ethereum","isBuyOrSell":"BUY"} response = requests.get(url, params=querystring) print(response.json()) ``` ```javascript Success const url = 'https://api-stg.transak.com/api/v1/pricing/public/quotes?partnerApiKey=YOUR_PARTNER_API_KEY&fiatCurrency=USD&cryptoCurrency=ETH&network=ethereum&isBuyOrSell=BUY'; const options = {method: 'GET'}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Success package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api-stg.transak.com/api/v1/pricing/public/quotes?partnerApiKey=YOUR_PARTNER_API_KEY&fiatCurrency=USD&cryptoCurrency=ETH&network=ethereum&isBuyOrSell=BUY" req, _ := http.NewRequest("GET", url, nil) res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Success require 'uri' require 'net/http' url = URI("https://api-stg.transak.com/api/v1/pricing/public/quotes?partnerApiKey=YOUR_PARTNER_API_KEY&fiatCurrency=USD&cryptoCurrency=ETH&network=ethereum&isBuyOrSell=BUY") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) response = http.request(request) puts response.read_body ``` ```java Success import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api-stg.transak.com/api/v1/pricing/public/quotes?partnerApiKey=YOUR_PARTNER_API_KEY&fiatCurrency=USD&cryptoCurrency=ETH&network=ethereum&isBuyOrSell=BUY") .asString(); ``` ```php Success request('GET', 'https://api-stg.transak.com/api/v1/pricing/public/quotes?partnerApiKey=YOUR_PARTNER_API_KEY&fiatCurrency=USD&cryptoCurrency=ETH&network=ethereum&isBuyOrSell=BUY'); echo $response->getBody(); ``` ```csharp Success using RestSharp; var client = new RestClient("https://api-stg.transak.com/api/v1/pricing/public/quotes?partnerApiKey=YOUR_PARTNER_API_KEY&fiatCurrency=USD&cryptoCurrency=ETH&network=ethereum&isBuyOrSell=BUY"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); ``` ```swift Success import Foundation let request = NSMutableURLRequest(url: NSURL(string: "https://api-stg.transak.com/api/v1/pricing/public/quotes?partnerApiKey=YOUR_PARTNER_API_KEY&fiatCurrency=USD&cryptoCurrency=ETH&network=ethereum&isBuyOrSell=BUY")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```