> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.0x.org/api-reference/evm-ap-is/gasless/getprice/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.0x.org/_mcp/server. # getPrice GET https://api.0x.org/gasless/price Get the indicative price for a gasless swap Reference: https://docs.0x.org/api-reference/evm-ap-is/gasless/getprice ## Request ### Query parameters - `chainId` (integer, required) — Chain ID. See [here](https://docs.0x.org/docs/introduction/supported-chains) for the list of supported chains - `buyToken` (string, required) — The contract address of the token to buy - `sellToken` (string, required) — The contract address of the token to sell. Native token is not supported - `sellAmount` (string, required) — The amount of `sellToken` in `sellToken` base units to sell - `taker` (string, optional) — The address which holds the `sellToken` balance and has the allowance set for the swap - `recipient` (string, optional) — The address to receive the `buyToken`. If not provided, defaults to the taker address. Not supported for wrap/unwrap operations. - `swapFeeRecipient` (string, optional) — The wallet address to receive the specified trading fees (supports single or multiple comma-separated values). You must also specify the `swapFeeBps` in the request to use this feature. When multiple values are provided, must match length of `swapFeeBps`. - `swapFeeBps` (string, optional) — The amount in Bps of the `swapFeeToken` to charge and deliver to the `swapFeeRecipient` (supports single or multiple comma-separated values). You must also specify the `swapFeeRecipient` in the request to use this feature. For security, this field has a default limit of 1000 Bps. If your application requires a higher value, please reach out to us. - `swapFeeToken` (string, optional) — The contract address of the token to receive trading fees in (supports single or multiple comma-separated values). Each token must be set to the value of either the `buyToken` or the `sellToken`. If omitted, the fee token will be determined by 0x with preference to stablecoins and highly liquid assets. You must also specify the `swapFeeRecipient` and `swapFeeBps` to charge integrator fees. When multiple values are provided, must match length of `swapFeeBps`. - `tradeSurplusRecipient` (string, optional) — The address to receive any trade surplus. If specified, this address will receive trade surplus when applicable. Otherwise, the taker will receive the surplus. This feature is only available to selected integrators on a custom pricing plan. In other cases, the surplus will be collected by 0x. For assistance with a custom plan, please contact support. - `tradeSurplusMaxBps` (integer, optional) — The maximum trade surplus (positive slippage) that can be collected in Bps of the buy amount. If not provided, defaults to 10000 (100%). Must be used together with `tradeSurplusRecipient`. - `slippageBps` (integer, optional) — The maximum acceptable slippage of the `buyToken` in Bps. 0x sets the optimal slippage tolerance per trade by default. To mitigate the risk of MEV attacks, we recommend adjusting this value only when trading low-liquidity tokens. - `slippagePpm` (integer, optional) — The maximum acceptable slippage of the `buyToken` in parts-per-million (PPM). Mutually exclusive with `slippageBps`. e.g. 3000 PPM = 30 BPS = 0.30%. - `excludedSources` (string, optional) — Liquidity sources e.g. Uniswap\_V3, SushiSwap, 0x\_RFQ to exclude from the provided quote. `See https://api.0x.org/sources?chainId=` with the desired chain's ID for a full list of sources. Separate multiple sources with a comma ### Headers - `0x-api-key` (string, required) — Visit dashboard.0x.org to get your API Key - `0x-version` (string, required) — API version ## Response ### 200 Successful response - `Gasless_getprice_Response_200` ## Errors ### 400 Bad Request Error 400 error response - `Gasless::getPriceRequestBadRequestError` ### 403 Forbidden Error 403 error response - `Gasless::getPriceRequestForbiddenError` ### 422 Unprocessable Entity Error 422 error response - `Gasless::getPriceRequestUnprocessableEntityError` ### 500 Internal Server Error 500 error response - `Gasless::getPriceRequestInternalServerError` ## Types ### GaslessGetpriceResponse2000 - `allowanceTarget` (string, required, nullable) — The target contract address for which the `taker` needs to have an allowance in order to be able to complete the swap. For swaps with the native asset (ie "ETH" or "BNB") as the `sellToken`, wrapping the native asset (i.e. "ETH" to "WETH") or unwrapping, no allowance is needed - `blockNumber` (string, required) — The block number at which the liquidity sources were sampled to generate the quote. This indicates the freshness of the quote - `buyAmount` (string, required) — The amount of `buyToken` (in `buyToken` units) that will be bought in the swap - `buyToken` (string, required) — The contract address of the token to buy in the swap - `fees` (GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0Fees, required) — Fees to be deducted in this transaction. It contains the `integratorFee`, `zeroExFee` and `gasFee` - `issues` (GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0Issues, required) — An object containing potential issues discovered during 0x validation that can prevent the swap from being executed successfully by the `taker` - `liquidityAvailable` (boolean, required) — This validates the availability of liquidity for the quote requested. The rest of the fields will only be returned if `true` - `minBuyAmount` (string, required) — The price which must be met or else the entire transaction will revert. This price is influenced by the `slippageBps` parameter. On-chain sources may encounter price movements from quote to settlement - `route` (GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0Route, required) — The path of liquidity sources to be used in executing this swap - `sellAmount` (string, required) — The amount of `sellToken` (in `sellToken` units) that will be sold in this swap - `sellToken` (string, required) — The contract address of the token to sell in the swap - `target` (string, required) — The address of the target contract that the transaction will be submitted to - `tokenMetadata` (GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadata, required) — Swap-related metadata for the buy and sell token in the swap - `zid` (string, required) — The unique ZeroEx identifier of the request ### GaslessGetpriceResponse2001 - `liquidityAvailable` (boolean, required) — This validates the availability of liquidity for the quote requested. No other fields will be returned if it is `false` - `zid` (string, required) — The unique ZeroEx identifier of the request ### INPUT_INVALID - `name` (enum, required) - Allowed values: `INPUT_INVALID` - `message` (string, required) - `data` (InputInvalidData, required) ### RECIPIENT_NOT_SUPPORTED - `name` (enum, required) - Allowed values: `RECIPIENT_NOT_SUPPORTED` - `message` (string, required) - `data` (RecipientNotSupportedData, required) ### SMART_WALLET_NOT_SUPPORTED - `name` (enum, required) - Allowed values: `SMART_WALLET_NOT_SUPPORTED` - `message` (string, required) - `data` (SmartWalletNotSupportedData, required) ### UNABLE_TO_CALCULATE_GAS_FEE - `name` (enum, required) - Allowed values: `UNABLE_TO_CALCULATE_GAS_FEE` - `message` (string, required) - `data` (UnableToCalculateGasFeeData, required) ### SELL_AMOUNT_TOO_SMALL - `name` (enum, required) - Allowed values: `SELL_AMOUNT_TOO_SMALL` - `message` (string, required) - `data` (SellAmountTooSmallData, required) ### SWAP_VALIDATION_FAILED - `name` (enum, required) - Allowed values: `SWAP_VALIDATION_FAILED` - `message` (string, required) - `data` (SwapValidationFailedData, required) ### TOKEN_NOT_SUPPORTED - `name` (enum, required) - Allowed values: `TOKEN_NOT_SUPPORTED` - `message` (string, required) - `data` (TokenNotSupportedData, required) ### USER_NOT_AUTHORIZED - `name` (enum, required) - Allowed values: `USER_NOT_AUTHORIZED` - `message` (string, required) - `data` (UserNotAuthorizedData, required) ### TOKEN_PAIR_NOT_SUPPORTED - `name` (enum, required) - Allowed values: `TOKEN_PAIR_NOT_SUPPORTED` - `message` (string, required) - `data` (TokenPairNotSupportedData, required) ### TAKER_NOT_AUTHORIZED_FOR_TRADE - `name` (enum, required) - Allowed values: `TAKER_NOT_AUTHORIZED_FOR_TRADE` - `message` (string, required) - `data` (TakerNotAuthorizedForTradeData, required) ### RECIPIENT_NOT_AUTHORIZED_FOR_TRADE - `name` (enum, required) - Allowed values: `RECIPIENT_NOT_AUTHORIZED_FOR_TRADE` - `message` (string, required) - `data` (RecipientNotAuthorizedForTradeData, required) ### XSTOCKS_NOT_AUTHORIZED - `name` (enum, required) - Allowed values: `XSTOCKS_NOT_AUTHORIZED` - `message` (string, required) - `data` (XstocksNotAuthorizedData, required) ### BUY_TOKEN_NOT_AUTHORIZED_FOR_TRADE - `name` (enum, required) - Allowed values: `BUY_TOKEN_NOT_AUTHORIZED_FOR_TRADE` - `message` (string, required) - `data` (BuyTokenNotAuthorizedForTradeData, required) ### SELL_TOKEN_NOT_AUTHORIZED_FOR_TRADE - `name` (enum, required) - Allowed values: `SELL_TOKEN_NOT_AUTHORIZED_FOR_TRADE` - `message` (string, required) - `data` (SellTokenNotAuthorizedForTradeData, required) ### INTERNAL_SERVER_ERROR - `name` (enum, required) - Allowed values: `INTERNAL_SERVER_ERROR` - `message` (string, required) - `data` (InternalServerErrorData, required) ### UNCATEGORIZED - `name` (enum, required) - Allowed values: `UNCATEGORIZED` - `message` (string, required) - `data` (UncategorizedData, required) ### GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0Fees Fees to be deducted in this transaction. It contains the `integratorFee`, `zeroExFee` and `gasFee` - `integratorFee` (GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0FeesIntegratorFee, required, nullable) — The specified fee to charge and deliver to the `swapFeeRecipient`. - `integratorFees` (list of GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0FeesIntegratorFeesItems, required, nullable) — The specified fees to charge and deliver to the `swapFeesRecipient`. - `zeroExFee` (GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0FeesZeroExFee, required, nullable) — The fee charged by 0x for the trade. - `gasFee` (GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0FeesGasFee, required, nullable) — The gas fee to be used in submitting the transaction. ### GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0Issues An object containing potential issues discovered during 0x validation that can prevent the swap from being executed successfully by the `taker` - `allowance` (GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0IssuesAllowance, required, nullable) — Details of allowances that the `taker` must set for in order to execute the swap successfully. Null if no allowance is required - `balance` (GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0IssuesBalance, required, nullable) — Details of balance of the `sellToken` that the `taker` must hold. Null if the `taker` has sufficient balance - `simulationIncomplete` (boolean, required) — This is set to `true` when 0x cannot validate the transaction. This happens when the `taker` has an insufficient balance of the `sellToken` and 0x is unable to peform ehanced quote validation with the low balance. Note that this does not necessarily mean that the trade will revert - `invalidSourcesPassed` (list of string, required) — A list of invalid sources present in `excludedSources` request. See `https://api.0x.org/sources?chainId=` with the desired chain's ID for the list of valid sources ### GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0Route The path of liquidity sources to be used in executing this swap - `fills` (list of GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0RouteFillsItems, required) — Details of each segment that 0x routes the swap through - `tokens` (list of GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0RouteTokensItems, required) — Properties of the tokens involved in the swap ### GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadata Swap-related metadata for the buy and sell token in the swap - `buyToken` (GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataBuyToken, required) — Swap-related metadata for the buy token - `sellToken` (GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataSellToken, required) — Swap-related metadata for the sell token ### InputInvalidData - `zid` (string, required) — The unique ZeroEx identifier of the request - `details` (list of InputInvalidDataDetailsItems, required) — The list of invalid inputs ### RecipientNotSupportedData - `zid` (string, required) — The unique ZeroEx identifier of the request ### SmartWalletNotSupportedData - `zid` (string, required) — The unique ZeroEx identifier of the request - `taker` (string, required) — The smart wallet address that was rejected - `chainId` (double, required) — The chain where smart wallets are not supported ### UnableToCalculateGasFeeData - `zid` (string, required) — The unique ZeroEx identifier of the request ### SellAmountTooSmallData - `zid` (string, required) — The unique ZeroEx identifier of the request - `minSellAmount` (string, required) — The minimum sell amount required for the trade to go through ### SwapValidationFailedData - `zid` (string, required) — The unique ZeroEx identifier of the request ### TokenNotSupportedData - `token` (string, required) — Unsupported token address - `zid` (string, required) — The unique ZeroEx identifier of the request ### UserNotAuthorizedData - `zid` (string, required) — The unique ZeroEx identifier of the request ### TokenPairNotSupportedData - `zid` (string, required) — The unique ZeroEx identifier of the request ### TakerNotAuthorizedForTradeData - `zid` (string, required) — The unique ZeroEx identifier of the request ### RecipientNotAuthorizedForTradeData - `zid` (string, required) — The unique ZeroEx identifier of the request ### XstocksNotAuthorizedData - `zid` (string, required) — The unique ZeroEx identifier of the request ### BuyTokenNotAuthorizedForTradeData - `zid` (string, required) — The unique ZeroEx identifier of the request ### SellTokenNotAuthorizedForTradeData - `zid` (string, required) — The unique ZeroEx identifier of the request ### InternalServerErrorData - `zid` (string, required) — The unique ZeroEx identifier of the request ### UncategorizedData - `zid` (string, required) — The unique ZeroEx identifier of the request ### GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0FeesIntegratorFee The specified fee to charge and deliver to the `swapFeeRecipient`. - `amount` (string, required) — The amount of token charged as the integrator fee - `token` (string, required) — The address of the token charged as the integrator fee - `type` (enum, required) - Allowed values: `volume` ### GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0FeesIntegratorFeesItems - `amount` (string, required) — The amount of token charged as the integrator fee - `token` (string, required) — The address of the token charged as the integrator fee - `type` (enum, required) - Allowed values: `volume` ### GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0FeesZeroExFee The fee charged by 0x for the trade. - `amount` (string, required) — The amount of token charged as the 0x fee - `token` (string, required) — The address of the token charged as the 0x fee - `type` (enum, required) - Allowed values: `volume` ### GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0FeesGasFee The gas fee to be used in submitting the transaction. - `amount` (string, required) — The amount of token charged as the gas fee - `token` (string, required) — The address of the token charged as the gas fee - `type` (enum, required) - Allowed values: `gas` ### GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0IssuesAllowance Details of allowances that the `taker` must set for in order to execute the swap successfully. Null if no allowance is required - `actual` (string, required) — The `taker`'s current allowance of the `spender` - `spender` (string, required) — The address to set the allowance on ### GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0IssuesBalance Details of balance of the `sellToken` that the `taker` must hold. Null if the `taker` has sufficient balance - `token` (string, required) — The contract address of the `sellToken` - `actual` (string, required) — The current balance of the `sellToken` in the `taker` address - `expected` (string, required) — The balance of the `sellToken` required for the swap to execute successfully ### GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0RouteFillsItems - `from` (string, required) — The contract address of the input token - `to` (string, required) — The contract address of the output token - `source` (string, required) — The liquidity source used in the route - `proportionBps` (string, required) — The proportion of the trade to be filled by the `source` ### GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0RouteTokensItems Properties of the tokens involved in the swap - `address` (string, required) — The token address. This is the unique identifier of the token - `symbol` (string, required) — The token symbol. This is not guaranteed to be unique, as multiple tokens can have the same symbol ### GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataBuyToken Swap-related metadata for the buy token - `buyTaxBps` (GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataBuyTokenBuyTaxBps, required, nullable) — The buy tax in bps of the token. Since each token could have arbitrary implementation, this field is best effort, meaning it would be set to `null` if the system is not able to determine the tax - `sellTaxBps` (GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataBuyTokenSellTaxBps, required, nullable) — The sell tax in bps of the token. Since each token could have arbitrary implementation, this field is best effort, meaning it would be set to `null` if the system is not able to determine the tax - `transferTaxBps` (GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataBuyTokenTransferTaxBps, required, nullable) — The transfer tax in bps of the token. Since each token could have arbitrary implementation, this field is best effort, meaning it would be set to `null` if the system is not able to determine the tax ### GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataSellToken Swap-related metadata for the sell token - `buyTaxBps` (GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataSellTokenBuyTaxBps, required, nullable) — The buy tax in bps of the token. Since each token could have arbitrary implementation, this field is best effort, meaning it would be set to `null` if the system is not able to determine the tax - `sellTaxBps` (GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataSellTokenSellTaxBps, required, nullable) — The sell tax in bps of the token. Since each token could have arbitrary implementation, this field is best effort, meaning it would be set to `null` if the system is not able to determine the tax - `transferTaxBps` (GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataSellTokenTransferTaxBps, required, nullable) — The transfer tax in bps of the token. Since each token could have arbitrary implementation, this field is best effort, meaning it would be set to `null` if the system is not able to determine the tax ### InputInvalidDataDetailsItems - `field` (string, required) — The input field name - `reason` (string, required) — The validation failure reason ### GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataBuyTokenBuyTaxBps The buy tax in bps of the token. Since each token could have arbitrary implementation, this field is best effort, meaning it would be set to `null` if the system is not able to determine the tax ### GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataBuyTokenSellTaxBps The sell tax in bps of the token. Since each token could have arbitrary implementation, this field is best effort, meaning it would be set to `null` if the system is not able to determine the tax ### GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataBuyTokenTransferTaxBps The transfer tax in bps of the token. Since each token could have arbitrary implementation, this field is best effort, meaning it would be set to `null` if the system is not able to determine the tax ### GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataSellTokenBuyTaxBps The buy tax in bps of the token. Since each token could have arbitrary implementation, this field is best effort, meaning it would be set to `null` if the system is not able to determine the tax ### GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataSellTokenSellTaxBps The sell tax in bps of the token. Since each token could have arbitrary implementation, this field is best effort, meaning it would be set to `null` if the system is not able to determine the tax ### GaslessPriceGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataSellTokenTransferTaxBps The transfer tax in bps of the token. Since each token could have arbitrary implementation, this field is best effort, meaning it would be set to `null` if the system is not able to determine the tax ## Examples **Response** ```json { "allowanceTarget": "0x000000000022d473030f116ddee9f6b43ac78ba3", "blockNumber": null, "buyAmount": null, "buyToken": "0xdac17f958d2ee523a2206206994597c13d831ec7", "fees": { "integratorFee": null, "integratorFees": [ { "amount": null, "token": "string", "type": "volume" } ], "zeroExFee": { "amount": null, "token": "0xdac17f958d2ee523a2206206994597c13d831ec7", "type": "volume" }, "gasFee": { "amount": null, "token": "0xdac17f958d2ee523a2206206994597c13d831ec7", "type": "gas" } }, "issues": { "allowance": { "actual": null, "spender": "0x000000000022d473030f116ddee9f6b43ac78ba3" }, "balance": { "token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "actual": null, "expected": null }, "simulationIncomplete": false, "invalidSourcesPassed": [] }, "liquidityAvailable": true, "minBuyAmount": null, "route": { "fills": [ { "from": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "to": "0xdac17f958d2ee523a2206206994597c13d831ec7", "source": "SolidlyV3", "proportionBps": null } ], "tokens": [ { "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "symbol": "USDC" }, { "address": "0xdac17f958d2ee523a2206206994597c13d831ec7", "symbol": "USDT" } ] }, "sellAmount": null, "sellToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "target": "0x7c39a136ea20b3483e402ea031c1f3c019bab24b", "tokenMetadata": { "buyToken": { "buyTaxBps": null, "sellTaxBps": null, "transferTaxBps": null }, "sellToken": { "buyTaxBps": null, "sellTaxBps": null, "transferTaxBps": null } }, "zid": "0x111111111111111111111111" } ``` **SDK Code** ```python Gasless_getprice_example import requests url = "https://api.0x.org/gasless/price" querystring = {"chainId":"1","buyToken":"0xdac17f958d2ee523a2206206994597c13d831ec7","sellToken":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","sellAmount":"300000000","taker":"0x70a9f34f9b34c64957b9c401a97bfed35b95049e"} headers = { "0x-api-key": "0x-api-key", "0x-version": "v2" } response = requests.get(url, headers=headers, params=querystring) print(response.json()) ``` ```javascript Gasless_getprice_example const url = 'https://api.0x.org/gasless/price?chainId=1&buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7&sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&sellAmount=300000000&taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e'; const options = {method: 'GET', headers: {'0x-api-key': '0x-api-key', '0x-version': 'v2'}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go Gasless_getprice_example package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.0x.org/gasless/price?chainId=1&buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7&sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&sellAmount=300000000&taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("0x-api-key", "0x-api-key") req.Header.Add("0x-version", "v2") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Gasless_getprice_example require 'uri' require 'net/http' url = URI("https://api.0x.org/gasless/price?chainId=1&buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7&sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&sellAmount=300000000&taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["0x-api-key"] = '0x-api-key' request["0x-version"] = 'v2' response = http.request(request) puts response.read_body ``` ```java Gasless_getprice_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.0x.org/gasless/price?chainId=1&buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7&sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&sellAmount=300000000&taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e") .header("0x-api-key", "0x-api-key") .header("0x-version", "v2") .asString(); ``` ```php Gasless_getprice_example request('GET', 'https://api.0x.org/gasless/price?chainId=1&buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7&sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&sellAmount=300000000&taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e', [ 'headers' => [ '0x-api-key' => '0x-api-key', '0x-version' => 'v2', ], ]); echo $response->getBody(); ``` ```csharp Gasless_getprice_example using RestSharp; var client = new RestClient("https://api.0x.org/gasless/price?chainId=1&buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7&sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&sellAmount=300000000&taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e"); var request = new RestRequest(Method.GET); request.AddHeader("0x-api-key", "0x-api-key"); request.AddHeader("0x-version", "v2"); IRestResponse response = client.Execute(request); ``` ```swift Gasless_getprice_example import Foundation let headers = [ "0x-api-key": "0x-api-key", "0x-version": "v2" ] let request = NSMutableURLRequest(url: NSURL(string: "https://api.0x.org/gasless/price?chainId=1&buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7&sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&sellAmount=300000000&taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers 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() ``` > Developer documentation for the 0x API. Embed swaps in your onchain app. Access 10+ million tokens with liquidity from 150+ exchanges with a single API.