# getQuote GET https://api.0x.org/gasless/quote Get the firm quote for a gasless swap Reference: https://docs.0x.org/api-reference/openapi-yaml/gasless/getquote ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: getQuote version: endpoint_gasless.getquote paths: /gasless/quote: get: operationId: getquote summary: getQuote description: Get the firm quote for a gasless swap tags: - - subpackage_gasless parameters: - name: chainId in: query description: >- Chain ID. See [here](https://0x.org/docs/developer-resources/supported-chains) for the list of supported chains required: true schema: type: integer - name: buyToken in: query description: The contract address of the token to buy required: true schema: type: string - name: sellToken in: query description: >- The contract address of the token to sell. Native token is not supported required: true schema: type: string - name: sellAmount in: query description: The amount of `sellToken` in `sellToken` base units to sell required: true schema: type: string - name: taker in: query description: >- The address which holds the `sellToken` balance and has the allowance set for the swap required: true schema: type: string - name: recipient in: query description: >- The address to receive the `buyToken`. If not provided, defaults to the taker address. Not supported for wrap/unwrap operations. required: false schema: type: string - name: swapFeeRecipient in: query description: >- 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`. required: false schema: type: string - name: swapFeeBps in: query description: >- 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. required: false schema: type: string - name: swapFeeToken in: query description: >- 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`. required: false schema: type: string - name: tradeSurplusRecipient in: query description: >- 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. required: false schema: type: string - name: tradeSurplusMaxBps in: query description: >- 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`. required: false schema: type: integer - name: slippageBps in: query description: >- 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. required: false schema: type: integer - name: excludedSources in: query description: >- 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 required: false schema: type: string - name: 0x-api-key in: header description: Visit dashboard.0x.org to get your API Key required: true schema: type: string - name: 0x-version in: header description: API version required: true schema: type: string responses: '200': description: Successful response content: application/json: schema: $ref: '#/components/schemas/Gasless_getquote_Response_200' '400': description: 400 error response content: {} '403': description: 403 error response content: {} '422': description: 422 error response content: {} '500': description: 500 error response content: {} components: schemas: GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0ApprovalType: type: string enum: - value: executeMetaTransaction::approve - value: permit - value: daiPermit GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0ApprovalEip712TypesItems: type: object properties: name: type: string type: type: string required: - name - type GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0ApprovalEip712Domain: type: object properties: name: type: string version: type: string chainId: type: number format: double verifyingContract: type: string salt: type: string GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0ApprovalEip712Message: oneOf: - type: string - type: array items: type: string - type: number format: double - type: array items: type: number format: double - type: boolean - type: array items: type: boolean - description: Any type - type: array items: description: Any type GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0ApprovalEip712: type: object properties: types: type: object additionalProperties: type: array items: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0ApprovalEip712TypesItems domain: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0ApprovalEip712Domain message: type: object additionalProperties: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0ApprovalEip712Message primaryType: type: string required: - types - domain - message - primaryType GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0Approval: type: object properties: type: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0ApprovalType hash: type: string description: >- The hash for the approval according to [EIP-712](https://eips.ethereum.org/EIPS/eip-712). If you compute the hash from eip712 field, it should match the value of this field eip712: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0ApprovalEip712 description: >- The necessary data for [EIP-712](https://eips.ethereum.org/EIPS/eip-712). Please don't assume static shapes for `approval.eip712.types`, `approval.eip712.domain`, `approval.eip712.primaryType` and `approval.eip712.message` as they will change depending on the `type` required: - type - hash - eip712 GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0FeesIntegratorFeeType: type: string enum: - value: volume GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0FeesIntegratorFee: type: object properties: amount: type: string description: The amount of token charged as the integrator fee token: type: string description: The address of the token charged as the integrator fee type: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0FeesIntegratorFeeType required: - amount - token - type GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0FeesIntegratorFeesItemsType: type: string enum: - value: volume GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0FeesIntegratorFeesItems: type: object properties: amount: type: string description: The amount of token charged as the integrator fee token: type: string description: The address of the token charged as the integrator fee type: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0FeesIntegratorFeesItemsType required: - amount - token - type GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0FeesZeroExFeeType: type: string enum: - value: volume GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0FeesZeroExFee: type: object properties: amount: type: string description: The amount of token charged as the 0x fee token: type: string description: The address of the token charged as the 0x fee type: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0FeesZeroExFeeType required: - amount - token - type GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0FeesGasFeeType: type: string enum: - value: gas GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0FeesGasFee: type: object properties: amount: type: string description: The amount of token charged as the gas fee token: type: string description: The address of the token charged as the gas fee type: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0FeesGasFeeType required: - amount - token - type GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0Fees: type: object properties: integratorFee: oneOf: - $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0FeesIntegratorFee - type: 'null' description: The specified fee to charge and deliver to the `swapFeeRecipient`. integratorFees: type: - array - 'null' items: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0FeesIntegratorFeesItems description: The specified fees to charge and deliver to the `swapFeesRecipient`. zeroExFee: oneOf: - $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0FeesZeroExFee - type: 'null' description: The fee charged by 0x for the trade. gasFee: oneOf: - $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0FeesGasFee - type: 'null' description: The gas fee to be used in submitting the transaction. required: - integratorFee - integratorFees - zeroExFee - gasFee GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0IssuesAllowance: type: object properties: actual: type: string description: The `taker`'s current allowance of the `spender` spender: type: string description: The address to set the allowance on required: - actual - spender GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0IssuesBalance: type: object properties: token: type: string description: The contract address of the `sellToken` actual: type: string description: The current balance of the `sellToken` in the `taker` address expected: type: string description: >- The balance of the `sellToken` required for the swap to execute successfully required: - token - actual - expected GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0Issues: type: object properties: allowance: oneOf: - $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0IssuesAllowance - type: 'null' description: >- Details of allowances that the `taker` must set for in order to execute the swap successfully. Null if no allowance is required balance: oneOf: - $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0IssuesBalance - type: 'null' description: >- Details of balance of the `sellToken` that the `taker` must hold. Null if the `taker` has sufficient balance simulationIncomplete: type: boolean description: >- 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: type: array items: type: string description: >- 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 required: - allowance - balance - simulationIncomplete - invalidSourcesPassed GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0RouteFillsItems: type: object properties: from: type: string description: The contract address of the input token to: type: string description: The contract address of the output token source: type: string description: The liquidity source used in the route proportionBps: type: string description: The proportion of the trade to be filled by the `source` required: - from - to - source - proportionBps GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0RouteTokensItems: type: object properties: address: type: string description: The token address. This is the unique identifier of the token symbol: type: string description: >- The token symbol. This is not guaranteed to be unique, as multiple tokens can have the same symbol required: - address - symbol GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0Route: type: object properties: fills: type: array items: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0RouteFillsItems description: Details of each segment that 0x routes the swap through tokens: type: array items: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0RouteTokensItems description: Properties of the tokens involved in the swap required: - fills - tokens GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataBuyTokenBuyTaxBps: type: object properties: {} GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataBuyTokenSellTaxBps: type: object properties: {} GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataBuyTokenTransferTaxBps: type: object properties: {} GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataBuyToken: type: object properties: buyTaxBps: oneOf: - $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataBuyTokenBuyTaxBps - type: 'null' description: >- 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: oneOf: - $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataBuyTokenSellTaxBps - type: 'null' description: >- 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: oneOf: - $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataBuyTokenTransferTaxBps - type: 'null' description: >- 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 required: - buyTaxBps - sellTaxBps - transferTaxBps GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataSellTokenBuyTaxBps: type: object properties: {} GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataSellTokenSellTaxBps: type: object properties: {} GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataSellTokenTransferTaxBps: type: object properties: {} GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataSellToken: type: object properties: buyTaxBps: oneOf: - $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataSellTokenBuyTaxBps - type: 'null' description: >- 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: oneOf: - $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataSellTokenSellTaxBps - type: 'null' description: >- 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: oneOf: - $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataSellTokenTransferTaxBps - type: 'null' description: >- 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 required: - buyTaxBps - sellTaxBps - transferTaxBps GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadata: type: object properties: buyToken: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataBuyToken description: Swap-related metadata for the buy token sellToken: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadataSellToken description: Swap-related metadata for the sell token required: - buyToken - sellToken GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TradeType: type: string enum: - value: settler_metatransaction - value: settler_intent GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TradeEip712TypesItems: type: object properties: name: type: string type: type: string required: - name - type GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TradeEip712Domain: type: object properties: name: type: string version: type: string chainId: type: number format: double verifyingContract: type: string salt: type: string GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TradeEip712Message: oneOf: - type: string - type: array items: type: string - type: number format: double - type: array items: type: number format: double - type: boolean - type: array items: type: boolean - description: Any type - type: array items: description: Any type GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TradeEip712: type: object properties: types: type: object additionalProperties: type: array items: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TradeEip712TypesItems domain: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TradeEip712Domain message: type: object additionalProperties: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TradeEip712Message primaryType: type: string required: - types - domain - message - primaryType GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0Trade: type: object properties: type: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TradeType description: >- The transaction type determined by the trade route. This is currently just `settler_metatransaction` and could expand to more types in the future hash: type: string description: >- The hash for the trade according to [EIP-712](https://eips.ethereum.org/EIPS/eip-712). If you compute the hash from eip712 field, it should match the value of this field eip712: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TradeEip712 description: >- This is the necessary data for [EIP-712](https://eips.ethereum.org/EIPS/eip-712). Please don't assume static shapes for `trade.eip712.types`, `trade.eip712.domain`, `trade.eip712.primaryType` and `trade.eip712.message` as they will change depending on the `type` required: - type - hash - eip712 GaslessGetquoteResponse2000: type: object properties: allowanceTarget: type: - string - 'null' description: >- 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 approval: oneOf: - $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0Approval - type: 'null' description: >- This is the “approval” object which contains the necessary information to process a gasless approval blockNumber: type: string description: >- The block number at which the liquidity sources were sampled to generate the quote. This indicates the freshness of the quote. buyAmount: type: string description: >- The amount of `buyToken` (in `buyToken` units) that will be bought in the swap buyToken: type: string description: The contract address of the token to buy in the swap fees: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0Fees issues: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0Issues description: >- An object containing potential issues discovered during 0x validation that can prevent the swap from being executed successfully by the `taker` liquidityAvailable: type: boolean description: >- This validates the availability of liquidity for the quote requested. The rest of the fields will only be returned if `true` minBuyAmount: type: string description: >- The price which must be met or else the transaction will revert. This price is influenced by the `slippageBps` parameter. On-chain sources may encounter price movements from quote to settlement route: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0Route description: The path of liquidity sources to be used in executing this swap sellAmount: type: string description: >- The amount of `sellToken` (in `sellToken` units) that will be sold in this swap sellToken: type: string description: The contract address of the token to sell in the swap target: type: string description: >- The address of the target contract that the transaction will be submitted to tokenMetadata: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0TokenMetadata description: Swap-related metadata for the buy and sell token in the swap trade: $ref: >- #/components/schemas/GaslessQuoteGetResponsesContentApplicationJsonSchemaOneOf0Trade description: >- This is the “trade” object which contains the necessary information to process a gasless trade zid: type: string description: The unique ZeroEx identifier of the request required: - allowanceTarget - approval - blockNumber - buyAmount - buyToken - fees - issues - liquidityAvailable - minBuyAmount - route - sellAmount - sellToken - target - tokenMetadata - trade - zid GaslessGetquoteResponse2001: type: object properties: liquidityAvailable: type: boolean description: >- This validates the availability of liquidity for the quote requested. No other fields will be returned if it is `false` zid: type: string description: The unique ZeroEx identifier of the request required: - liquidityAvailable - zid Gasless_getquote_Response_200: oneOf: - $ref: '#/components/schemas/GaslessGetquoteResponse2000' - $ref: '#/components/schemas/GaslessGetquoteResponse2001' ``` ## SDK Code Examples ```python import requests url = "https://api.0x.org/gasless/quote" querystring = {"chainId":"1","buyToken":"0xdac17f958d2ee523a2206206994597c13d831ec7","sellToken":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","sellAmount":"300000000","taker":"0x70a9f34f9b34c64957b9c401a97bfed35b95049e"} payload = { "body": { "chainId": 1, "buyToken": "0xdac17f958d2ee523a2206206994597c13d831ec7", "sellToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "sellAmount": "300000000", "taker": "0x70a9f34f9b34c64957b9c401a97bfed35b95049e", "0x-api-key": "123456789abcdef123456789abcdef12", "0x-version": "v2" } } headers = { "0x-api-key": "0x-api-key", "0x-version": "v2", "Content-Type": "application/json" } response = requests.get(url, json=payload, headers=headers, params=querystring) print(response.json()) ``` ```javascript const url = 'https://api.0x.org/gasless/quote?chainId=1&buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7&sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&sellAmount=300000000&taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e'; const options = { method: 'GET', headers: { '0x-api-key': '0x-api-key', '0x-version': 'v2', 'Content-Type': 'application/json' }, body: '{"body":{"chainId":1,"buyToken":"0xdac17f958d2ee523a2206206994597c13d831ec7","sellToken":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","sellAmount":"300000000","taker":"0x70a9f34f9b34c64957b9c401a97bfed35b95049e","0x-api-key":"123456789abcdef123456789abcdef12","0x-version":"v2"}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.0x.org/gasless/quote?chainId=1&buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7&sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&sellAmount=300000000&taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e" payload := strings.NewReader("{\n \"body\": {\n \"chainId\": 1,\n \"buyToken\": \"0xdac17f958d2ee523a2206206994597c13d831ec7\",\n \"sellToken\": \"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\n \"sellAmount\": \"300000000\",\n \"taker\": \"0x70a9f34f9b34c64957b9c401a97bfed35b95049e\",\n \"0x-api-key\": \"123456789abcdef123456789abcdef12\",\n \"0x-version\": \"v2\"\n }\n}") req, _ := http.NewRequest("GET", url, payload) req.Header.Add("0x-api-key", "0x-api-key") req.Header.Add("0x-version", "v2") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.0x.org/gasless/quote?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' request["Content-Type"] = 'application/json' request.body = "{\n \"body\": {\n \"chainId\": 1,\n \"buyToken\": \"0xdac17f958d2ee523a2206206994597c13d831ec7\",\n \"sellToken\": \"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\n \"sellAmount\": \"300000000\",\n \"taker\": \"0x70a9f34f9b34c64957b9c401a97bfed35b95049e\",\n \"0x-api-key\": \"123456789abcdef123456789abcdef12\",\n \"0x-version\": \"v2\"\n }\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://api.0x.org/gasless/quote?chainId=1&buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7&sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&sellAmount=300000000&taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e") .header("0x-api-key", "0x-api-key") .header("0x-version", "v2") .header("Content-Type", "application/json") .body("{\n \"body\": {\n \"chainId\": 1,\n \"buyToken\": \"0xdac17f958d2ee523a2206206994597c13d831ec7\",\n \"sellToken\": \"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\n \"sellAmount\": \"300000000\",\n \"taker\": \"0x70a9f34f9b34c64957b9c401a97bfed35b95049e\",\n \"0x-api-key\": \"123456789abcdef123456789abcdef12\",\n \"0x-version\": \"v2\"\n }\n}") .asString(); ``` ```php request('GET', 'https://api.0x.org/gasless/quote?chainId=1&buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7&sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&sellAmount=300000000&taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e', [ 'body' => '{ "body": { "chainId": 1, "buyToken": "0xdac17f958d2ee523a2206206994597c13d831ec7", "sellToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "sellAmount": "300000000", "taker": "0x70a9f34f9b34c64957b9c401a97bfed35b95049e", "0x-api-key": "123456789abcdef123456789abcdef12", "0x-version": "v2" } }', 'headers' => [ '0x-api-key' => '0x-api-key', '0x-version' => 'v2', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.0x.org/gasless/quote?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"); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"body\": {\n \"chainId\": 1,\n \"buyToken\": \"0xdac17f958d2ee523a2206206994597c13d831ec7\",\n \"sellToken\": \"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\",\n \"sellAmount\": \"300000000\",\n \"taker\": \"0x70a9f34f9b34c64957b9c401a97bfed35b95049e\",\n \"0x-api-key\": \"123456789abcdef123456789abcdef12\",\n \"0x-version\": \"v2\"\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "0x-api-key": "0x-api-key", "0x-version": "v2", "Content-Type": "application/json" ] let parameters = ["body": [ "chainId": 1, "buyToken": "0xdac17f958d2ee523a2206206994597c13d831ec7", "sellToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", "sellAmount": "300000000", "taker": "0x70a9f34f9b34c64957b9c401a97bfed35b95049e", "0x-api-key": "123456789abcdef123456789abcdef12", "0x-version": "v2" ]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.0x.org/gasless/quote?chainId=1&buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7&sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&sellAmount=300000000&taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers request.httpBody = postData as Data 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() ```