> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.0x.org/api-reference/api-overview/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.0x.org/_mcp/server. # API Overview # Introduction The 0x API provides a unified interface for liquidity aggregation, token swap pricing, and onchain trading. It is designed to help developers easily integrate token swaps and routing logic without managing individual DEX integrations. The 0x API offers the following: ## EVM Swap API Endpoints for EVM-compatible chains (Ethereum, Arbitrum, Base, Polygon, and more): * **[Swap](/api-reference/evm-ap-is/swap/allowanceholder-getprice)**: Generate executable quotes and calldata for token swaps using either the AllowanceHolder (recommended) or Permit2 approval models. Learn more in the [FAQ](/docs/introduction/faq#allowanceholder-and-permit2). * **[Gasless](/api-reference/evm-ap-is/swap/allowanceholder-getquote)**: Enable gasless swaps by sponsoring transaction fees on behalf of users, improving UX for end-user applications. * **[Sources](/api-reference/evm-ap-is/sources/getsources)**: Retrieve supported liquidity sources, chains, and token metadata used by the 0x routing engine. * **[Trade Analytics](/api-reference/evm-ap-is/trade-analytics/trade-analytics-swap)**: Query historical trade data, volumes, and execution details for monitoring and analytics use cases. ## Solana Swap API Endpoints for Solana (SVM): * **[Swap Instructions](/api-reference/solana-swap-ap-is/swap/instructions)**: Generate swap instructions for Solana tokens, returning versioned transaction data ready to sign and submit. ## Cross-Chain API Endpoints for bridging assets across chains (EVM, Solana, Tron, HyperCore): * **[Quotes](/api-reference/cross-chain-ap-is/cross-chain/cross-chain-get-quotes)**: Get ready-to-sign bridge quotes across supported chains and assets. * **[Status](/api-reference/cross-chain-ap-is/cross-chain/cross-chain-get-status)**: Track the status of an in-flight cross-chain transaction. * **[Sources](/api-reference/cross-chain-ap-is/cross-chain/cross-chain-list-sources)**: List supported bridge routes and liquidity sources. * **[Streaming Quotes](/api-reference/cross-chain-ap-is/cross-chain/cross-chain-stream-quotes)**: Subscribe to a live stream of cross-chain quotes. ## Base URL All requests to the 0x API must be made to the following base URL: ``` https://api.0x.org ``` All requests must be sent over HTTPS. Requests made over HTTP will be rejected. ## Authentication All 0x API requests require an API key. Include your API key in the following request header: **`0x-api-key`** `string` — required Your 0x API key used to authenticate requests. --- **`0x-version`** `string` — required 0x API version. --- Requests missing this header may be rate-limited or rejected. > **Info** > > You can generate and manage API keys from the [0x Dashboard](https://dashboard.0x.org). ## Chain Support The 0x API supports multiple EVM-compatible chains. Each request must specify a chain either via the request path or query parameters, depending on the endpoint. Refer to the [Supported Chains](/docs/introduction/supported-chains) for a complete and up-to-date list. ## Examples #### JavaScript ```javascript theme={"system"} const params = new URLSearchParams({ sellAmount: "100000000000000000000000", // 100,000 WETH taker: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", // vitalik.eth chainId: "1", sellToken: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH buyToken: "0x6b175474e89094c44da98b954eedeac495271d0f", // DAI }); fetch(`https://api.0x.org/swap/allowance-holder/quote?${params.toString()}`, { headers: { "0x-api-key": "YOUR_API_KEY", "0x-version": "v2", "Content-Type": "application/json", }, }) .then((res) => res.json()) .then((data) => console.log(data)); ``` #### cURL ```bash theme={"system"} # Sell 100,000 WETH for DAI # Taker address is vitalik.eth # Replace "YOUR_API_KEY" with your actual API key from https://dashboard.0x.org/create-account curl --request GET \ --url "https://api.0x.org/swap/allowance-holder/quote?sellAmount=100000000000000000000000&taker=0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045&chainId=1&sellToken=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&buyToken=0x6b175474e89094c44da98b954eedeac495271d0f" \ --header "0x-api-key: YOUR_API_KEY" \ --header "0x-version: v2" ``` #### Python ```python theme={"system"} import requests url = "https://api.0x.org/swap/allowance-holder/quote" params = { "sellAmount": "100000000000000000000000", # 100,000 WETH "taker": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", # vitalik.eth "chainId": "1", "sellToken": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", # WETH "buyToken": "0x6b175474e89094c44da98b954eedeac495271d0f", # DAI } headers = { "0x-api-key": "YOUR_API_KEY", "0x-version": "v2", "Content-Type": "application/json", } response = requests.get(url, params=params, headers=headers) data = response.json() print(data) ``` > 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.