getPrice (Permit2)
Get the indicative price for a swap using Permit2 to set allowances
query Parameters
chainId required | |
buyToken required | string^0x(?!0{40})[a-fA-F0-9]{40}$ Example: buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7 The contract address of the token to buy |
sellToken required | string^0x(?!0{40})[a-fA-F0-9]{40}$ Example: sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 The contract address of the token to sell |
sellAmount required | string Example: sellAmount=100000000 The amount of |
taker | string^0x[a-fA-F0-9]{40}$ Example: taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e The address which holds the |
txOrigin | string^0x[a-fA-F0-9]{40}$ The contract address of the external account that started the transaction. This is only needed if |
swapFeeRecipient | string^0x[a-fA-F0-9]{40}$ The wallet address to receive the specified trading fees. You must also specify the |
swapFeeBps | integer [ 0 .. 10000 ] The amount in Bps of the |
swapFeeToken | string^0x(?!0{40})[a-fA-F0-9]{40}$ The contract address of the token to receive trading fees in. This must be set to the value of either the |
tradeSurplusRecipient | string^0x[a-fA-F0-9]{40}$ The address to receive any trade surplus. If specified, this address will receive trade surplus when applicable. Otherwise, the |
gasPrice | string 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 [ 0 .. 10000 ] Default: 100 The maximum acceptable slippage of the |
excludedSources | string Liquidity sources e.g. Uniswap_V3, SushiSwap, 0x_RFQ to exclude from the provided quote. See https://api.0x.org/sources?chainId= |
sellEntireBalance | boolean Default: false If set to |
header Parameters
0x-api-key required | string Visit dashboard.0x.org to get your API Key |
0x-version required | string Example: v2 API version |
Responses
Response samples
- 200
- 400
- 403
- 422
- 500
{- "blockNumber": "20114676",
- "buyAmount": "100032748",
- "buyToken": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "fees": {
- "integratorFee": null,
- "zeroExFee": null,
- "gasFee": null
}, - "gas": "288095",
- "gasPrice": "7062490000",
- "issues": {
- "allowance": {
- "actual": "0",
- "spender": "0x000000000022d473030f116ddee9f6b43ac78ba3"
}, - "balance": {
- "token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "actual": "0",
- "expected": "100000000"
}, - "simulationIncomplete": false,
- "invalidSourcesPassed": [ ]
}, - "liquidityAvailable": true,
- "minBuyAmount": "99032421",
- "route": {
- "fills": [
- {
- "from": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "to": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "source": "SolidlyV3",
- "proportionBps": "10000"
}
], - "tokens": [
- {
- "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "symbol": "USDC"
}, - {
- "address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "symbol": "USDT"
}
]
}, - "sellAmount": "100000000",
- "sellToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "tokenMetadata": {
- "buyToken": {
- "buyTaxBps": "0",
- "sellTaxBps": "0"
}, - "sellToken": {
- "buyTaxBps": "0",
- "sellTaxBps": "0"
}
}, - "totalNetworkFee": "2034668056550000",
- "zid": "0x111111111111111111111111"
}
getQuote (Permit2)
Get the firm quote for a swap using Permit2 to set allowances
query Parameters
chainId required | |
buyToken required | string^0x(?!0{40})[a-fA-F0-9]{40}$ Example: buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7 The contract address of the token to buy |
sellToken required | string^0x(?!0{40})[a-fA-F0-9]{40}$ Example: sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 The contract address of the token to sell |
sellAmount required | string Example: sellAmount=100000000 The amount of |
taker required | string^0x[a-fA-F0-9]{40}$ Example: taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e The address which holds the |
txOrigin | string^0x[a-fA-F0-9]{40}$ The contract address of the external account that started the transaction. This is only needed if |
swapFeeRecipient | string^0x[a-fA-F0-9]{40}$ The wallet address to receive the specified trading fees. You must also specify the |
swapFeeBps | integer [ 0 .. 10000 ] The amount in Bps of the |
swapFeeToken | string^0x(?!0{40})[a-fA-F0-9]{40}$ The contract address of the token to receive trading fees in. This must be set to the value of either the |
tradeSurplusRecipient | string^0x[a-fA-F0-9]{40}$ The address to receive any trade surplus. If specified, this address will receive trade surplus when applicable. Otherwise, the |
gasPrice | string 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 [ 0 .. 10000 ] Default: 100 The maximum acceptable slippage of the |
excludedSources | string Liquidity sources e.g. Uniswap_V3, SushiSwap, 0x_RFQ to exclude from the provided quote. See https://api.0x.org/sources?chainId= |
sellEntireBalance | boolean Default: false If set to |
header Parameters
0x-api-key required | string Visit dashboard.0x.org to get your API Key |
0x-version required | string Example: v2 API version |
Responses
Response samples
- 200
- 400
- 403
- 422
- 500
{- "blockNumber": "20114692",
- "buyAmount": "100037537",
- "buyToken": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "fees": {
- "integratorFee": null,
- "zeroExFee": null,
- "gasFee": null
}, - "issues": {
- "allowance": {
- "actual": "0",
- "spender": "0x000000000022d473030f116ddee9f6b43ac78ba3"
}, - "balance": {
- "token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "actual": "0",
- "expected": "100000000"
}, - "simulationIncomplete": false,
- "invalidSourcesPassed": [ ]
}, - "liquidityAvailable": true,
- "minBuyAmount": "99037162",
- "permit2": {
- "type": "Permit2",
- "hash": "0xab0c8909f2f8daed2891abb5e93762c65787e0067ef2ab9184bb635ad0f3df51",
- "eip712": {
- "types": {
- "PermitTransferFrom": [
- {
- "name": "permitted",
- "type": "TokenPermissions"
}, - {
- "name": "spender",
- "type": "address"
}, - {
- "name": "nonce",
- "type": "uint256"
}, - {
- "name": "deadline",
- "type": "uint256"
}
], - "TokenPermissions": [
- {
- "name": "token",
- "type": "address"
}, - {
- "name": "amount",
- "type": "uint256"
}
], - "EIP712Domain": [
- {
- "name": "name",
- "type": "string"
}, - {
- "name": "chainId",
- "type": "uint256"
}, - {
- "name": "verifyingContract",
- "type": "address"
}
]
}, - "domain": {
- "name": "Permit2",
- "chainId": 1,
- "verifyingContract": "0x000000000022d473030f116ddee9f6b43ac78ba3"
}, - "message": {
- "permitted": {
- "token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "amount": "100000000"
}, - "spender": "0x7f6cee965959295cc64d0e6c00d99d6532d8e86b",
- "nonce": "2241959297937691820908574931991575",
- "deadline": "1718669420"
}, - "primaryType": "PermitTransferFrom"
}
}, - "route": {
- "fills": [
- {
- "from": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "to": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "source": "SolidlyV3",
- "proportionBps": "10000"
}
], - "tokens": [
- {
- "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "symbol": "USDC"
}, - {
- "address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "symbol": "USDT"
}
]
}, - "sellAmount": "100000000",
- "sellToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "tokenMetadata": {
- "buyToken": {
- "buyTaxBps": "0",
- "sellTaxBps": "0"
}, - "sellToken": {
- "buyTaxBps": "0",
- "sellTaxBps": "0"
}
}, - "totalNetworkFee": "1393685870940000",
- "transaction": {
- "to": "0x7f6cee965959295cc64d0e6c00d99d6532d8e86b",
- "data": "0x1fff991f00000000000000000000000070a9f34f9b34c64957b9c401a97bfed35b95049e000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000000000000000000000000000000000000005e72fea00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000144c1fb425e0000000000000000000000007f6cee965959295cc64d0e6c00d99d6532d8e86b000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000005f5e1000000000000000000000000000000000000006e898131631616b1779bad70bc17000000000000000000000000000000000000000000000000000000006670d06c00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000041ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016438c9c147000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000027100000000000000000000000006146be494fee4c73540cb1c5f87536abf1452500000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000084c31b8d7a0000000000000000000000007f6cee965959295cc64d0e6c00d99d6532d8e86b00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000005f5e10000000000000000000000000000000000000000000000000000000001000276a40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
- "gas": "288079",
- "gasPrice": "4837860000",
- "value": "0"
}, - "zid": "0x111111111111111111111111"
}
getPrice (Allowance Holder)
Get the indicative price for a swap using Allowance Holder to set allowances
query Parameters
chainId required | |
buyToken required | string^0x(?!0{40})[a-fA-F0-9]{40}$ Example: buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7 The contract address of the token to buy |
sellToken required | string^0x(?!0{40})[a-fA-F0-9]{40}$ Example: sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 The contract address of the token to sell |
sellAmount required | string Example: sellAmount=100000000 The amount of |
taker | string^0x[a-fA-F0-9]{40}$ Example: taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e The address which holds the |
txOrigin | string^0x[a-fA-F0-9]{40}$ The contract address of the external account that started the transaction. This is only needed if |
swapFeeRecipient | string^0x[a-fA-F0-9]{40}$ The wallet address to receive the specified trading fees. You must also specify the |
swapFeeBps | integer [ 0 .. 10000 ] The amount in Bps of the |
swapFeeToken | string^0x(?!0{40})[a-fA-F0-9]{40}$ The contract address of the token to receive trading fees in. This must be set to the value of either the |
tradeSurplusRecipient | string^0x[a-fA-F0-9]{40}$ The address to receive any trade surplus. If specified, this address will receive trade surplus when applicable. Otherwise, the |
gasPrice | string 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 [ 0 .. 10000 ] Default: 100 The maximum acceptable slippage of the |
excludedSources | string Liquidity sources e.g. Uniswap_V3, SushiSwap, 0x_RFQ to exclude from the provided quote. See https://api.0x.org/sources?chainId= |
sellEntireBalance | boolean Default: false If set to |
header Parameters
0x-api-key required | string Visit dashboard.0x.org to get your API Key |
0x-version required | string Example: v2 API version |
Responses
Response samples
- 200
- 400
- 403
- 422
- 500
{- "blockNumber": "20114676",
- "buyAmount": "100032748",
- "buyToken": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "fees": {
- "integratorFee": null,
- "zeroExFee": null,
- "gasFee": null
}, - "gas": "288095",
- "gasPrice": "7062490000",
- "issues": {
- "allowance": {
- "actual": "0",
- "spender": "0x0000000000001ff3684f28c67538d4d072c22734"
}, - "balance": {
- "token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "actual": "0",
- "expected": "100000000"
}, - "simulationIncomplete": false,
- "invalidSourcesPassed": [ ]
}, - "liquidityAvailable": true,
- "minBuyAmount": "99032421",
- "route": {
- "fills": [
- {
- "from": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "to": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "source": "SolidlyV3",
- "proportionBps": "10000"
}
], - "tokens": [
- {
- "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "symbol": "USDC"
}, - {
- "address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "symbol": "USDT"
}
]
}, - "sellAmount": "100000000",
- "sellToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "tokenMetadata": {
- "buyToken": {
- "buyTaxBps": "0",
- "sellTaxBps": "0"
}, - "sellToken": {
- "buyTaxBps": "0",
- "sellTaxBps": "0"
}
}, - "totalNetworkFee": "2034668056550000",
- "zid": "0x111111111111111111111111"
}
getQuote (Allowance Holder)
Get the firm quote for a swap using Allowance Holder to set allowances
query Parameters
chainId required | |
buyToken required | string^0x(?!0{40})[a-fA-F0-9]{40}$ Example: buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7 The contract address of the token to buy |
sellToken required | string^0x(?!0{40})[a-fA-F0-9]{40}$ Example: sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 The contract address of the token to sell |
sellAmount required | string Example: sellAmount=100000000 The amount of |
taker required | string^0x[a-fA-F0-9]{40}$ Example: taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e The address which holds the |
txOrigin | string^0x[a-fA-F0-9]{40}$ The contract address of the external account that started the transaction. This is only needed if |
swapFeeRecipient | string^0x[a-fA-F0-9]{40}$ The wallet address to receive the specified trading fees. You must also specify the |
swapFeeBps | integer [ 0 .. 10000 ] The amount in Bps of the |
swapFeeToken | string^0x(?!0{40})[a-fA-F0-9]{40}$ The contract address of the token to receive trading fees in. This must be set to the value of either the |
tradeSurplusRecipient | string^0x[a-fA-F0-9]{40}$ The address to receive any trade surplus. If specified, this address will receive trade surplus when applicable. Otherwise, the |
gasPrice | string 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 [ 0 .. 10000 ] Default: 100 The maximum acceptable slippage of the |
excludedSources | string Liquidity sources e.g. Uniswap_V3, SushiSwap, 0x_RFQ to exclude from the provided quote. See https://api.0x.org/sources?chainId= |
sellEntireBalance | boolean Default: false If set to |
header Parameters
0x-api-key required | string Visit dashboard.0x.org to get your API Key |
0x-version required | string Example: v2 API version |
Responses
Response samples
- 200
- 400
- 403
- 422
- 500
{- "blockNumber": "20114692",
- "buyAmount": "100037537",
- "buyToken": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "fees": {
- "integratorFee": null,
- "zeroExFee": null,
- "gasFee": null
}, - "issues": {
- "allowance": {
- "actual": "0",
- "spender": "0x0000000000001ff3684f28c67538d4d072c22734"
}, - "balance": {
- "token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "actual": "0",
- "expected": "100000000"
}, - "simulationIncomplete": false,
- "invalidSourcesPassed": [ ]
}, - "liquidityAvailable": true,
- "minBuyAmount": "99037162",
- "route": {
- "fills": [
- {
- "from": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "to": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "source": "SolidlyV3",
- "proportionBps": "10000"
}
], - "tokens": [
- {
- "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "symbol": "USDC"
}, - {
- "address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "symbol": "USDT"
}
]
}, - "sellAmount": "100000000",
- "sellToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "tokenMetadata": {
- "buyToken": {
- "buyTaxBps": "0",
- "sellTaxBps": "0"
}, - "sellToken": {
- "buyTaxBps": "0",
- "sellTaxBps": "0"
}
}, - "totalNetworkFee": "1393685870940000",
- "transaction": {
- "to": "0x7f6cee965959295cc64d0e6c00d99d6532d8e86b",
- "data": "0x1fff991f00000000000000000000000070a9f34f9b34c64957b9c401a97bfed35b95049e000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec70000000000000000000000000000000000000000000000000000000005e72fea00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000144c1fb425e0000000000000000000000007f6cee965959295cc64d0e6c00d99d6532d8e86b000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000005f5e1000000000000000000000000000000000000006e898131631616b1779bad70bc17000000000000000000000000000000000000000000000000000000006670d06c00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000041ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016438c9c147000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000027100000000000000000000000006146be494fee4c73540cb1c5f87536abf1452500000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000084c31b8d7a0000000000000000000000007f6cee965959295cc64d0e6c00d99d6532d8e86b00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000005f5e10000000000000000000000000000000000000000000000000000000001000276a40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
- "gas": "288079",
- "gasPrice": "4837860000",
- "value": "0"
}, - "zid": "0x111111111111111111111111"
}
getChains
Get list of supported chains for swap
header Parameters
0x-api-key required | string Visit dashboard.0x.org to get your API Key |
0x-version required | string Example: v2 API version |
Responses
Response samples
- 200
- 500
[- {
- "chainName": "Ethereum",
- "chainId": "1"
}, - {
- "chainName": "Optimism",
- "chainId": "10"
}, - {
- "chainName": "BSC",
- "chainId": "56"
}, - {
- "chainName": "Polygon",
- "chainId": "137"
}, - {
- "chainName": "Base",
- "chainId": "8453"
}, - {
- "chainName": "Arbitrum",
- "chainId": "42161"
}, - {
- "chainName": "Avalanche",
- "chainId": "43114"
}, - {
- "chainName": "Linea",
- "chainId": "59144"
}, - {
- "chainName": "Scroll",
- "chainId": "534352"
}, - {
- "chainName": "Mantle",
- "chainId": "5000"
}, - {
- "chainName": "Blast",
- "chainId": "81457"
}, - {
- "chainName": "Mode",
- "chainId": "34443"
}
]
getPrice
Get the indicative price for a gasless swap
query Parameters
chainId required | |
buyToken required | string^0x(?!0{40})[a-fA-F0-9]{40}$ Example: buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7 The contract address of the token to buy |
sellToken required | string^0x(?!0{40})[a-fA-F0-9]{40}$ Example: sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 The contract address of the token to sell. Native token is not supported |
sellAmount required | string Example: sellAmount=300000000 The amount of |
taker | string^0x[a-fA-F0-9]{40}$ Example: taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e The address which holds the |
swapFeeRecipient | string^0x[a-fA-F0-9]{40}$ The wallet address to receive the specified trading fees. You must also specify the |
swapFeeBps | integer [ 0 .. 10000 ] The amount in Bps of the |
swapFeeToken | string^0x(?!0{40})[a-fA-F0-9]{40}$ The contract address of the token to receive trading fees in. This must be set to the value of either the |
tradeSurplusRecipient | string^0x[a-fA-F0-9]{40}$ The address to receive any trade surplus. If specified, this address will receive trade surplus when applicable. Otherwise, the |
slippageBps | integer [ 30 .. 10000 ] The maximum acceptable slippage of the |
excludedSources | string Liquidity sources e.g. Uniswap_V3, SushiSwap, 0x_RFQ to exclude from the provided quote. See https://api.0x.org/sources?chainId= |
header Parameters
0x-api-key required | string Visit dashboard.0x.org to get your API Key |
0x-version required | string Example: v2 API version |
Responses
Response samples
- 200
- 400
- 403
- 422
- 500
{- "blockNumber": "20114764",
- "buyAmount": "291527064",
- "buyToken": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "fees": {
- "integratorFee": null,
- "zeroExFee": {
- "amount": "150053",
- "token": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "type": "volume"
}, - "gasFee": {
- "amount": "8430138",
- "token": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "type": "gas"
}
}, - "issues": {
- "allowance": {
- "actual": "0",
- "spender": "0x000000000022d473030f116ddee9f6b43ac78ba3"
}, - "balance": {
- "token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "actual": "0",
- "expected": "300000000"
}, - "simulationIncomplete": false,
- "invalidSourcesPassed": [ ]
}, - "liquidityAvailable": true,
- "minBuyAmount": "290652483",
- "route": {
- "fills": [
- {
- "from": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "to": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "source": "SolidlyV3",
- "proportionBps": "10000"
}
], - "tokens": [
- {
- "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "symbol": "USDC"
}, - {
- "address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "symbol": "USDT"
}
]
}, - "sellAmount": "300000000",
- "sellToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "target": "0x7c39a136ea20b3483e402ea031c1f3c019bab24b",
- "tokenMetadata": {
- "buyToken": {
- "buyTaxBps": "0",
- "sellTaxBps": "0"
}, - "sellToken": {
- "buyTaxBps": "0",
- "sellTaxBps": "0"
}
}, - "zid": "0x111111111111111111111111"
}
getQuote
Get the firm quote for a gasless swap
query Parameters
chainId required | |
buyToken required | string^0x(?!0{40})[a-fA-F0-9]{40}$ Example: buyToken=0xdac17f958d2ee523a2206206994597c13d831ec7 The contract address of the token to buy |
sellToken required | string^0x(?!0{40})[a-fA-F0-9]{40}$ Example: sellToken=0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 The contract address of the token to sell. Native token is not supported |
sellAmount required | string Example: sellAmount=300000000 The amount of |
taker required | string^0x[a-fA-F0-9]{40}$ Example: taker=0x70a9f34f9b34c64957b9c401a97bfed35b95049e The address which holds the |
swapFeeRecipient | string^0x[a-fA-F0-9]{40}$ The wallet address to receive the specified trading fees. You must also specify the |
swapFeeBps | integer [ 0 .. 10000 ] The amount in Bps of the |
swapFeeToken | string^0x(?!0{40})[a-fA-F0-9]{40}$ The contract address of the token to receive trading fees in. This must be set to the value of either the |
tradeSurplusRecipient | string^0x[a-fA-F0-9]{40}$ The address to receive any trade surplus. If specified, this address will receive trade surplus when applicable. Otherwise, the |
slippageBps | integer [ 30 .. 10000 ] The maximum acceptable slippage of the |
excludedSources | string Liquidity sources e.g. Uniswap_V3, SushiSwap, 0x_RFQ to exclude from the provided quote. See https://api.0x.org/sources?chainId= |
header Parameters
0x-api-key required | string Visit dashboard.0x.org to get your API Key |
0x-version required | string Example: v2 API version |
Responses
Response samples
- 200
- 400
- 403
- 422
- 500
{- "approval": {
- "type": "permit",
- "hash": "0xf3849ebcd806e518f2d3457b76d31ccf41be07fe64f0a25bbe798f1b9edde872",
- "eip712": {
- "types": {
- "EIP712Domain": [
- {
- "name": "name",
- "type": "string"
}, - {
- "name": "version",
- "type": "string"
}, - {
- "name": "chainId",
- "type": "uint256"
}, - {
- "name": "verifyingContract",
- "type": "address"
}
], - "Permit": [
- {
- "name": "owner",
- "type": "address"
}, - {
- "name": "spender",
- "type": "address"
}, - {
- "name": "value",
- "type": "uint256"
}, - {
- "name": "nonce",
- "type": "uint256"
}, - {
- "name": "deadline",
- "type": "uint256"
}
]
}, - "domain": {
- "name": "USD Coin",
- "version": "2",
- "chainId": 1,
- "verifyingContract": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
}, - "message": {
- "owner": "0x70a9f34f9b34c64957b9c401a97bfed35b95049e",
- "spender": "0x000000000022d473030f116ddee9f6b43ac78ba3",
- "value": "300000000",
- "nonce": 0,
- "deadline": "1718667104"
}, - "primaryType": "Permit"
}
}, - "blockNumber": "20114747",
- "buyAmount": "292995086",
- "buyToken": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "fees": {
- "integratorFee": null,
- "zeroExFee": {
- "amount": "150053",
- "token": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "type": "volume"
}, - "gasFee": {
- "amount": "6962116",
- "token": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "type": "gas"
}
}, - "issues": {
- "allowance": {
- "actual": "0",
- "spender": "0x000000000022d473030f116ddee9f6b43ac78ba3"
}, - "balance": {
- "token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "actual": "0",
- "expected": "300000000"
}, - "simulationIncomplete": false,
- "invalidSourcesPassed": [ ]
}, - "liquidityAvailable": true,
- "minBuyAmount": "292116101",
- "route": {
- "fills": [
- {
- "from": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "to": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "source": "SolidlyV3",
- "proportionBps": "10000"
}
], - "tokens": [
- {
- "address": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "symbol": "USDC"
}, - {
- "address": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "symbol": "USDT"
}
]
}, - "sellAmount": "300000000",
- "sellToken": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "target": "0x7c39a136ea20b3483e402ea031c1f3c019bab24b",
- "tokenMetadata": {
- "buyToken": {
- "buyTaxBps": "0",
- "sellTaxBps": "0"
}, - "sellToken": {
- "buyTaxBps": "0",
- "sellTaxBps": "0"
}
}, - "trade": {
- "type": "settler_metatransaction",
- "hash": "0x3ff032fa3a970a3f2b763afce093fd133ced63c0b097ab12ae1441b42de4a167",
- "eip712": {
- "types": {
- "PermitWitnessTransferFrom": [
- {
- "name": "permitted",
- "type": "TokenPermissions"
}, - {
- "name": "spender",
- "type": "address"
}, - {
- "name": "nonce",
- "type": "uint256"
}, - {
- "name": "deadline",
- "type": "uint256"
}, - {
- "name": "slippageAndActions",
- "type": "SlippageAndActions"
}
], - "EIP712Domain": [
- {
- "name": "name",
- "type": "string"
}, - {
- "name": "chainId",
- "type": "uint256"
}, - {
- "name": "verifyingContract",
- "type": "address"
}
], - "TokenPermissions": [
- {
- "name": "token",
- "type": "address"
}, - {
- "name": "amount",
- "type": "uint256"
}
], - "SlippageAndActions": [
- {
- "name": "recipient",
- "type": "address"
}, - {
- "name": "buyToken",
- "type": "address"
}, - {
- "name": "minAmountOut",
- "type": "uint256"
}, - {
- "name": "actions",
- "type": "bytes[]"
}
]
}, - "domain": {
- "name": "Permit2",
- "chainId": 1,
- "verifyingContract": "0x000000000022d473030f116ddee9f6b43ac78ba3"
}, - "message": {
- "permitted": {
- "token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- "amount": "300000000"
}, - "spender": "0x7c39a136ea20b3483e402ea031c1f3c019bab24b",
- "nonce": "2241959297937691820908574931991567",
- "deadline": "1718670104",
- "slippageAndActions": {
- "recipient": "0x70a9f34f9b34c64957b9c401a97bfed35b95049e",
- "buyToken": "0xdac17f958d2ee523a2206206994597c13d831ec7",
- "minAmountOut": "292116101",
- "actions": [
- "0x0dfeb4190000000000000000000000007c39a136ea20b3483e402ea031c1f3c019bab24b000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000011e1a3000000000000000000000000000000000000006e898131631616b1779bad70bc0f000000000000000000000000000000000000000000000000000000006670d318",
- "0x38c9c147000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4800000000000000000000000000000000000000000000000000000000000027100000000000000000000000006146be494fee4c73540cb1c5f87536abf1452500000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000084c31b8d7a0000000000000000000000007c39a136ea20b3483e402ea031c1f3c019bab24b00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000011e1a30000000000000000000000000000000000000000000000000000000001000276a400000000000000000000000000000000000000000000000000000000",
- "0x38c9c147000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec700000000000000000000000000000000000000000000000000000000000000ec000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000044a9059cbb00000000000000000000000038f5e5b4da37531a6e85161e337e0238bb27aa90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
]
}
}, - "primaryType": "PermitWitnessTransferFrom"
}
}, - "zid": "0x111111111111111111111111"
}
submit
Submit a gasless swap
header Parameters
0x-api-key required | string Visit dashboard.0x.org to get your API Key |
0x-version required | string Example: v2 API version |
Request Body schema: application/jsonrequired
chainId required | integer > 0 Chain ID. See here for the list of supported chains |
object or null The gasless approval object from the quote endpoint including its signature | |
required | object The trade object from the quote endpoint including its signature |
Responses
Request samples
- Payload
{- "approval": {
- "type": "permit",
- "hash": "0xe285dfa7b911cdfe64a4c92240d9b5af795e41571163c1cb5d78d7ba5d04fda3",
- "eip712": {
- "types": {
- "EIP712Domain": [
- {
- "name": "name",
- "type": "string"
}, - {
- "name": "version",
- "type": "string"
}, - {
- "name": "chainId",
- "type": "uint256"
}, - {
- "name": "verifyingContract",
- "type": "address"
}
], - "Permit": [
- {
- "name": "owner",
- "type": "address"
}, - {
- "name": "spender",
- "type": "address"
}, - {
- "name": "value",
- "type": "uint256"
}, - {
- "name": "nonce",
- "type": "uint256"
}, - {
- "name": "deadline",
- "type": "uint256"
}
]
}, - "domain": {
- "name": "USD Coin",
- "version": "2",
- "chainId": 8453,
- "verifyingContract": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
}, - "message": {
- "owner": "0x70a9f34f9b34c64957b9c401a97bfed35b95049e",
- "spender": "0x000000000022d473030f116ddee9f6b43ac78ba3",
- "value": "50000000",
- "nonce": 0,
- "deadline": "1718669123"
}, - "primaryType": "Permit"
}, - "signature": {
- "v": 27,
- "r": "0xa1be4e6177d95f7e634d7cf8f93021b96e5e4f3d4d8605e85204b97d4a4060eb",
- "s": "0x371e85adcfa9a5d0f53cc9f467a4230305899e4a18c0174466b8da784a4f9c81",
- "signatureType": 2
}
}, - "chainId": 8453,
- "trade": {
- "type": "settler_metatransaction",
- "hash": "0xb9d8cbda2a8edf0172631f9026da65387692a17d855f27ae6bb7154521f17659",
- "eip712": {
- "types": {
- "PermitWitnessTransferFrom": [
- {
- "name": "permitted",
- "type": "TokenPermissions"
}, - {
- "name": "spender",
- "type": "address"
}, - {
- "name": "nonce",
- "type": "uint256"
}, - {
- "name": "deadline",
- "type": "uint256"
}, - {
- "name": "slippageAndActions",
- "type": "SlippageAndActions"
}
], - "TokenPermissions": [
- {
- "name": "token",
- "type": "address"
}, - {
- "name": "amount",
- "type": "uint256"
}
], - "EIP712Domain": [
- {
- "name": "name",
- "type": "string"
}, - {
- "name": "chainId",
- "type": "uint256"
}, - {
- "name": "verifyingContract",
- "type": "address"
}
], - "SlippageAndActions": [
- {
- "name": "recipient",
- "type": "address"
}, - {
- "name": "buyToken",
- "type": "address"
}, - {
- "name": "minAmountOut",
- "type": "uint256"
}, - {
- "name": "actions",
- "type": "bytes[]"
}
]
}, - "domain": {
- "name": "Permit2",
- "chainId": 8453,
- "verifyingContract": "0x000000000022d473030f116ddee9f6b43ac78ba3"
}, - "message": {
- "permitted": {
- "token": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
- "amount": "50000000"
}, - "spender": "0x5ce929ddb01804bff35b2f5c77b735bdb094aac8",
- "nonce": "2241959297937691820908574931991585",
- "deadline": "1718672122",
- "slippageAndActions": {
- "recipient": "0x70a9f34f9b34c64957b9c401a97bfed35b95049e",
- "buyToken": "0x50c5725949a6f0c72e6c4a641f24049a917db0cb",
- "minAmountOut": "49793430139340757517",
- "actions": [
- "0x0dfeb4190000000000000000000000005ce929ddb01804bff35b2f5c77b735bdb094aac8000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda029130000000000000000000000000000000000000000000000000000000002faf0800000000000000000000000000000000000006e898131631616b1779bad70bc21000000000000000000000000000000000000000000000000000000006670dafa",
- "0x38c9c147000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda02913000000000000000000000000000000000000000000000000000000000000271000000000000000000000000032aed3bce901da12ca8489788f3a99fce1056e1400000000000000000000000000000000000000000000000000000000000000a400000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000104a5dcbcdf000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda0291300000000000000000000000050c5725949a6f0c72e6c4a641f24049a917db0cb0000000000000000000000001b55d94b553475e7561fab889bf88fe4f491d29c0000000000000000000000005ce929ddb01804bff35b2f5c77b735bdb094aac8ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000002faf0800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
- "0x38c9c14700000000000000000000000050c5725949a6f0c72e6c4a641f24049a917db0cb000000000000000000000000000000000000000000000000000000000000001000000000000000000000000050c5725949a6f0c72e6c4a641f24049a917db0cb000000000000000000000000000000000000000000000000000000000000002400000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000044a9059cbb0000000000000000000000009f6601854dee374b1bfaf6350ffd27a97309d431000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
]
}
}, - "primaryType": "PermitWitnessTransferFrom"
}, - "signature": {
- "v": 28,
- "r": "0xeaad7568c0d17ad9e1043a4dd41ce294ed51792a0fb8bed3a3318f7e1df3ff88",
- "s": "0x09444d25869d91946d7c26f9e5448c7fea369ba9c90deac1d761261565c487d2",
- "signatureType": 2
}
}
}
Response samples
- 200
- 400
- 500
{- "tradeHash": "0xcb3285b35c024fca76037bea9ea4cb68645fed3bdd84030956577de2f1592aa9",
- "type": "settler_metatransaction",
- "zid": "0x111111111111111111111111"
}
getStatus
Get the status of a gasless swap
path Parameters
tradeHash required | string Example: 0x6c89e4ac46b246ab72cba02a9fb4f3525b9f8a11ea74262d5dd8ff0e024daf60 The hash for the trade according to EIP-712 |
query Parameters
chainId required |
header Parameters
0x-api-key required | string Visit dashboard.0x.org to get your API Key |
0x-version required | string Example: v2 API version |
Responses
Response samples
- 200
- 400
- 404
- 500
{- "status": "confirmed",
- "transactions": [
- {
- "hash": "0x36b42bc0ec313cfb9bf5122fbda933cbcce5f557bc3b7197b52223b05d7e596f",
- "timestamp": 1718662626073
}
], - "zid": "0x111111111111111111111111"
}
getGaslessApprovalTokens
Get token addresses that support gasless approvals
query Parameters
chainId required |
header Parameters
0x-api-key required | string Visit dashboard.0x.org to get your API Key |
0x-version required | string Example: v2 API version |
Responses
Response samples
- 200
- 400
- 500
{- "tokens": [
- "0x111111111117dc0aa78b770fa6a738034120c302",
- "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9",
- "0xb98d4c97425d9908e66e53a6fdf673acca0be986",
- "0xed04915c23f00a313a544955524eb7dbd823143d",
- "0x6b0b3a982b4634ac68dd83a4dbf02311ce324181",
- "0xac51066d7bec65dc4589368da368b212745d63e8"
], - "zid": "0x111111111111111111111111"
}
getChains
Get list of supported chains for gasless
header Parameters
0x-api-key required | string Visit dashboard.0x.org to get your API Key |
0x-version required | string Example: v2 API version |
Responses
Response samples
- 200
- 500
[- {
- "chainName": "Ethereum",
- "chainId": "1"
}, - {
- "chainName": "Optimism",
- "chainId": "10"
}, - {
- "chainName": "BSC",
- "chainId": "56"
}, - {
- "chainName": "Polygon",
- "chainId": "137"
}, - {
- "chainName": "Base",
- "chainId": "8453"
}, - {
- "chainName": "Arbitrum",
- "chainId": "42161"
}, - {
- "chainName": "Avalanche",
- "chainId": "43114"
}, - {
- "chainName": "Scroll",
- "chainId": "534352"
}, - {
- "chainName": "Mantle",
- "chainId": "5000"
}, - {
- "chainName": "Blast",
- "chainId": "81457"
}, - {
- "chainName": "Mode",
- "chainId": "34443"
}
]
getSources
Get the list of supported sources
query Parameters
chainId required |
header Parameters
0x-api-key required | string Visit dashboard.0x.org to get your API Key |
0x-version required | string Example: v2 API version |
Responses
Response samples
- 200
- 400
- 500
{- "sources": [
- "0xRFQ",
- "Ambient",
- "BalancerV1",
- "BalancerV2",
- "BancorV3",
- "Curve",
- "DodoV1",
- "DodoV2",
- "FraxswapV2",
- "Integral",
- "Lido",
- "MakerPsm",
- "Maverick",
- "Origin",
- "PancakeSwapV3",
- "RocketPool",
- "SolidlyV3",
- "SushiSwap",
- "Synapse",
- "UniswapV2",
- "UniswapV3"
], - "zid": "0x111111111111111111111111"
}
getSwapTrades
Get the list of completed swap trades. Returns a maximum of 200 trades per request.
query Parameters
cursor | string Example: cursor=eyJ0aW1lc3RhbXAiOjE3MjkwMzIyMTAsInppZCI6IjB4N2FjM2NlMzExNjA2NzU5MGY5M2U3MWVmIn0= The cursor to start fetching trades from |
startTimestamp | integer > 0 Example: startTimestamp=1729032210 Unix timestamp in seconds, specifying the starting point of the time range filter. Only trades completed on or after this timestamp will be included in the response. |
endTimestamp | integer > 0 Example: endTimestamp=1729032211 Unix timestamp in seconds, specifying the end point of the time range filter. Only trades completed on or before this timestamp will be included in the response. |
header Parameters
0x-api-key required | string Visit dashboard.0x.org to get your API Key |
0x-version required | string Example: v2 API version |
Responses
Response samples
- 200
- 400
- 500
{- "nextCursor": null,
- "trades": [
- {
- "appName": "Example app",
- "blockNumber": "123456",
- "buyToken": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
- "buyAmount": "0.0512",
- "chainId": 1,
- "fees": {
- "integratorFee": null,
- "zeroExFee": null
}, - "gasUsed": "141111",
- "protocolVersion": "Settler",
- "sellToken": "0x4d1c297d39c5c1277964d0e3f8aqqqq493664530",
- "sellAmount": "123.111",
- "slippageBps": "1",
- "taker": "0x23f2ad8e04dfdc0000a3e80891e3ae43f322000a",
- "timestamp": 1777772227,
- "tokens": [
- {
- "address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
- "symbol": "ETH"
}, - {
- "address": "0xaaaaaaaaaaaaaa277964d0e3f8aa901493664530",
- "symbol": "TKN"
}
], - "transactionHash": "0x42bad789ddd64aaaaaaaaaaaceb795063f5623558f130e0f4d30ad399b041411",
- "volumeUsd": "139.73",
- "zid": "0x04baaaaaaa1f1af0304eb412",
- "service": "swap"
}
], - "zid": "0xaaaaaae1b3bf43f082d5012d"
}
getGaslessTrades
Get the list of completed gasless trades. Returns a maximum of 200 trades per request.
query Parameters
cursor | string Example: cursor=eyJ0aW1lc3RhbXAiOjE3MjkwMzIyMTAsInppZCI6IjB4N2FjM2NlMzExNjA2NzU5MGY5M2U3MWVmIn0= The cursor to start fetching trades from |
startTimestamp | integer > 0 Example: startTimestamp=1729032210 Unix timestamp in seconds, specifying the starting point of the time range filter. Only trades completed on or after this timestamp will be included in the response. |
endTimestamp | integer > 0 Example: endTimestamp=1729032211 Unix timestamp in seconds, specifying the end point of the time range filter. Only trades completed on or before this timestamp will be included in the response. |
header Parameters
0x-api-key required | string Visit dashboard.0x.org to get your API Key |
0x-version required | string Example: v2 API version |
Responses
Response samples
- 200
- 400
- 500
{- "nextCursor": null,
- "trades": [
- {
- "appName": "Example app",
- "blockNumber": "123456",
- "buyToken": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
- "buyAmount": "0.0512",
- "chainId": 1,
- "fees": {
- "integratorFee": null,
- "zeroExFee": null
}, - "gasUsed": "141111",
- "protocolVersion": "Settler",
- "sellToken": "0x4d1c297d39c5c1277964d0e3f8aqqqq493664530",
- "sellAmount": "123.111",
- "slippageBps": "1",
- "taker": "0x23f2ad8e04dfdc0000a3e80891e3ae43f322000a",
- "timestamp": 1777772227,
- "tokens": [
- {
- "address": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
- "symbol": "ETH"
}, - {
- "address": "0xaaaaaaaaaaaaaa277964d0e3f8aa901493664530",
- "symbol": "TKN"
}
], - "transactionHash": "0x42bad789ddd64aaaaaaaaaaaceb795063f5623558f130e0f4d30ad399b041411",
- "volumeUsd": "139.73",
- "zid": "0x04baaaaaaa1f1af0304eb412",
- "service": "gasless"
}
], - "zid": "0xaaaaaae1b3bf43f082d5012d"
}