> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.0x.org/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.0x.org/_mcp/server.

# getQuote (Allowance Holder)

GET https://api.0x.org/swap/allowance-holder/quote

Get the firm quote for a swap using Allowance Holder to set allowances

Reference: https://docs.0x.org/api-reference/evm-ap-is/swap/allowanceholder-getquote

## 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
- `sellAmount` (string, optional) — The amount of `sellToken` in `sellToken` base units to sell. Exactly one of `sellAmount` or `buyAmount` must be provided — specifying both will result in an error.
- `buyAmount` (string, optional) — The amount of `buyToken` in `buyToken` base units to buy. Exactly one of `sellAmount` or `buyAmount` must be provided — specifying both will result in an error.
- `taker` (string, required) — The address which holds the `sellToken` balance and has the allowance set for the swap
- `txOrigin` (string, optional) — The address of the external account that started the transaction. This is only needed if `taker` is a smart contract.
- `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`.
- `gasPrice` (string, optional) — The target gas price (in wei) for the swap transaction. If not provided, the default value is based on the 0x gas price oracle
- `slippageBps` (integer, optional) — The maximum acceptable slippage of the `buyToken` in Bps. If this parameter is set to 0, no slippage will be tolerated. If not provided, the default slippage tolerance is 100Bps
- `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=<chain_id>` with the desired chain's ID for a full list of sources. Separate multiple sources with a comma
- `sellEntireBalance` (enum, optional, default: false) — If set to `true`, the taker's entire `sellToken` balance will be sold during trade execution. The `sellAmount` should be the maximum estimated value, as close as possible to the actual taker's balance to ensure the best routing. Selling more than the `sellAmount` may cause the trade to revert. This feature is designed for cases where the precise sell amount is determined during execution. Learn more [here](https://docs.0x.org/docs/0x-swap-api/additional-topics/sell-entire-balance).
  - Allowed values: `true`, `false`
- `wrapUnwrapMode` (any or enum, optional) — Controls how native wrap/unwrap trades are executed. `direct` calls the wrapped-native token contract directly. `settler` routes wrap/unwrap through Settler or Allowance Holder for compatibility. Ignored for non-wrap/unwrap swaps. If omitted, `direct` mode is used.

### 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

- `object or object or object`
  - object
    - `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

## Examples

**Response**

```json
{
  "allowanceTarget": "0x000000000022d473030f116ddee9f6b43ac78ba3",
  "blockNumber": null,
  "buyAmount": null,
  "buyToken": "0xdac17f958d2ee523a2206206994597c13d831ec7",
  "fees": {
    "integratorFee": null,
    "integratorFees": [
      {
        "amount": null,
        "token": "string",
        "type": "volume"
      }
    ],
    "zeroExFee": null,
    "gasFee": null
  },
  "issues": {
    "allowance": {
      "actual": null,
      "spender": "0x0000000000001ff3684f28c67538d4d072c22734"
    },
    "balance": {
      "token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
      "actual": null,
      "expected": null
    },
    "simulationIncomplete": false,
    "invalidSourcesPassed": []
  },
  "liquidityAvailable": true,
  "minBuyAmount": null,
  "mode": "exact-in",
  "route": {
    "fills": [
      {
        "from": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
        "to": "0xdac17f958d2ee523a2206206994597c13d831ec7",
        "source": "SolidlyV3",
        "proportionBps": null
      }
    ],
    "tokens": [
      {
        "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
        "symbol": "USDC"
      },
      {
        "address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
        "symbol": "USDT"
      }
    ]
  },
  "sellAmount": null,
  "sellToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
  "tokenMetadata": {
    "buyToken": {
      "buyTaxBps": null,
      "sellTaxBps": null,
      "transferTaxBps": null
    },
    "sellToken": {
      "buyTaxBps": null,
      "sellTaxBps": null,
      "transferTaxBps": null
    }
  },
  "totalNetworkFee": null,
  "zid": "0x111111111111111111111111",
  "transaction": {
    "to": "0x7f6cee965959295cc64d0e6c00d99d6532d8e86b",
    "data": "0x1fff991f00000000000000000000000070a9f34f9b34c64957b9c401a97bfed35b95049e000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000000000000000000000000000000000000005e72fea00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000144c1fb425e0000000000000000000000007f6cee965959295cc64d0e6c00d99d6532d8e86b000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000005f5e1000000000000000000000000000000000000006e898131631616b1779bad70bc17000000000000000000000000000000000000000000000000000000006670d06c00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000041ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016438c9c147000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000027100000000000000000000000006146be494fee4c73540cb1c5f87536abf1452500000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000084c31b8d7a0000000000000000000000007f6cee965959295cc64d0e6c00d99d6532d8e86b00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000005f5e10000000000000000000000000000000000000000000000000000000001000276a40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "gas": null,
    "gasPrice": null,
    "value": null
  }
}
```

**SDK Code**

```python Swap_allowanceholderGetquote_example
import requests

url = "https://api.0x.org/swap/allowance-holder/quote"

querystring = {"chainId":"1","buyToken":"0xdac17f958d2ee523a2206206994597c13d831ec7","sellToken":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","sellAmount":"100000000","taker":"0x70a9f34f9b34c64957b9c401a97bfed35b95049e"}

headers = {
    "0x-api-key": "0x-api-key",
    "0x-version": "v2"
}

response = requests.get(url, headers=headers, params=querystring)

print(response.json())
```

```javascript Swap_allowanceholderGetquote_example
const url = 'https://api.0x.org/swap/allowance-holder/quote?chainId=1&buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7&sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&sellAmount=100000000&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 Swap_allowanceholderGetquote_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.0x.org/swap/allowance-holder/quote?chainId=1&buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7&sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&sellAmount=100000000&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 Swap_allowanceholderGetquote_example
require 'uri'
require 'net/http'

url = URI("https://api.0x.org/swap/allowance-holder/quote?chainId=1&buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7&sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&sellAmount=100000000&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 Swap_allowanceholderGetquote_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://api.0x.org/swap/allowance-holder/quote?chainId=1&buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7&sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&sellAmount=100000000&taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e")
  .header("0x-api-key", "0x-api-key")
  .header("0x-version", "v2")
  .asString();
```

```php Swap_allowanceholderGetquote_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.0x.org/swap/allowance-holder/quote?chainId=1&buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7&sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&sellAmount=100000000&taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e', [
  'headers' => [
    '0x-api-key' => '0x-api-key',
    '0x-version' => 'v2',
  ],
]);

echo $response->getBody();
```

```csharp Swap_allowanceholderGetquote_example
using RestSharp;

var client = new RestClient("https://api.0x.org/swap/allowance-holder/quote?chainId=1&buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7&sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&sellAmount=100000000&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 Swap_allowanceholderGetquote_example
import Foundation

let headers = [
  "0x-api-key": "0x-api-key",
  "0x-version": "v2"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.0x.org/swap/allowance-holder/quote?chainId=1&buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7&sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48&sellAmount=100000000&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()
```