diff --git a/fern/docs.yml b/fern/docs.yml index 37373107..e5c53b87 100644 --- a/fern/docs.yml +++ b/fern/docs.yml @@ -278,7 +278,7 @@ navigation: layout: - page: API Overview path: docs/pages/api-reference-overview.mdx - - api: openapi.yaml + - api: openapi.json - tab: liquidity layout: diff --git a/fern/generators.yml b/fern/generators.yml index 5c63e9bb..31adca34 100644 --- a/fern/generators.yml +++ b/fern/generators.yml @@ -1,5 +1,5 @@ # yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json api: specs: - - openapi: openapi.yaml + - openapi: openapi.json groups: diff --git a/fern/openapi.yaml b/fern/openapi.yaml deleted file mode 100644 index ccdeac06..00000000 --- a/fern/openapi.yaml +++ /dev/null @@ -1,7748 +0,0 @@ -openapi: 3.0.3 -info: - title: 0x API - description: This is the official API reference for the latest 0x API (v2). - version: v2 -servers: - - url: https://api.0x.org -paths: - /swap/allowance-holder/price: - get: - operationId: swap::allowanceHolder::getPrice - summary: getPrice (Allowance Holder) - description: >- - Get the indicative price for a swap using Allowance Holder to set - allowances - tags: - - Swap - parameters: - - description: Visit dashboard.0x.org to get your API Key - in: header - name: 0x-api-key - required: true - schema: - type: string - - description: API version - in: header - name: 0x-version - required: true - schema: - type: string - example: v2 - - name: chainId - in: query - required: true - schema: - type: integer - exclusiveMinimum: true - minimum: 0 - description: >- - Chain ID. See - [here](https://0x.org/docs/developer-resources/supported-chains) for - the list of supported chains - example: 1 - - name: buyToken - in: query - required: true - schema: - type: string - pattern: ^0x(?!0{40})[a-fA-F0-9]{40}$ - description: The contract address of the token to buy - example: "0xdac17f958d2ee523a2206206994597c13d831ec7" - - name: sellToken - in: query - required: true - schema: - type: string - pattern: ^0x(?!0{40})[a-fA-F0-9]{40}$ - description: The contract address of the token to sell - example: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" - - name: sellAmount - in: query - required: true - schema: - type: string - description: The amount of `sellToken` in `sellToken` base units to sell - example: "100000000" - - name: taker - in: query - required: false - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address which holds the `sellToken` balance and has the - allowance set for the swap - example: "0x70a9f34f9b34c64957b9c401a97bfed35b95049e" - - name: txOrigin - in: query - required: false - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the external account that started the transaction. - This is only needed if `taker` is a smart contract. - - name: recipient - in: query - required: false - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address to receive the `buyToken`. If not provided, defaults to - the taker address. Not supported for wrap/unwrap operations. - - name: swapFeeRecipient - in: query - required: false - schema: - type: string - pattern: ^\s*0x[a-fA-F0-9]{40}(\s*,\s*0x[a-fA-F0-9]{40})*\s*$ - 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`. - - name: swapFeeBps - in: query - required: false - schema: - type: string - pattern: ^\s*\d+(\s*,\s*\d+)*\s*$ - 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. - - name: swapFeeToken - in: query - required: false - schema: - type: string - pattern: >- - ^\s*0x(?!0{40})[a-fA-F0-9]{40}(\s*,\s*0x(?!0{40})[a-fA-F0-9]{40})*\s*$ - 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`. - - name: tradeSurplusRecipient - in: query - required: false - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - 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. - - name: tradeSurplusMaxBps - in: query - required: false - schema: - type: integer - minimum: 1 - maximum: 10000 - 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`. - - name: gasPrice - in: query - required: false - schema: - type: string - description: >- - The target gas price (in wei) for the swap transaction. If not - provided, the default value is based on the 0x gas price oracle - - name: slippageBps - in: query - required: false - schema: - type: integer - minimum: 0 - maximum: 10000 - default: 100 - description: >- - 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 - - name: excludedSources - in: query - required: false - schema: - type: string - 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 - - name: sellEntireBalance - in: query - required: false - schema: - type: string - enum: - - "true" - - "false" - default: "false" - description: >- - 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://0x.org/docs/0x-swap-api/advanced-topics/sell-entire-balance). - responses: - "200": - description: Successful response - content: - application/json: - schema: - anyOf: - - type: object - properties: - allowanceTarget: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - nullable: true - 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 - blockNumber: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The block number at which the liquidity sources were - sampled to generate the quote. This indicates the - freshness of the quote - buyAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of `buyToken` (in `buyToken` units) that - will be bought in the swap - buyToken: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the token to buy in the swap - fees: - type: object - properties: - integratorFee: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of token charged as the integrator - fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the token charged as the - integrator fee - type: - type: string - enum: - - volume - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: >- - The specified fee to charge and deliver to the - `swapFeeRecipient`. - integratorFees: - type: array - items: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of token charged as the - integrator fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the token charged as the - integrator fee - type: - type: string - enum: - - volume - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: >- - The specified fees to charge and deliver to the - `swapFeesRecipient`. - zeroExFee: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: The amount of token charged as the 0x fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The address of the token charged as the 0x fee - type: - type: string - enum: - - volume - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: The fee charged by 0x for the trade. - gasFee: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: The amount of token charged as the gas fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the token charged as the gas - fee - type: - type: string - enum: - - gas - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: >- - The gas fee to be used in submitting the - transaction. - required: - - integratorFee - - integratorFees - - zeroExFee - - gasFee - additionalProperties: false - description: >- - Fees to be deducted in this transaction. It contains - the `integratorFee`, `zeroExFee` and `gasFee` - gas: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - description: >- - The estimated gas limit that should be used to send - the transaction to guarantee settlement - gasPrice: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The gas price (in wei) that should be used to send the - transaction. The transaction needs to be sent with - this `gasPrice` for the transaction to be successful - issues: - type: object - properties: - allowance: - type: object - properties: - actual: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The `taker`'s current allowance of the - `spender` - spender: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The address to set the allowance on - required: - - actual - - spender - additionalProperties: false - description: >- - Details of allowances that the `taker` must set - for in order to execute the swap successfully. - Null if no allowance is required - nullable: true - balance: - type: object - properties: - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the `sellToken` - actual: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The current balance of the `sellToken` in the - `taker` address - expected: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The balance of the `sellToken` required for - the swap to execute successfully - required: - - token - - actual - - expected - additionalProperties: false - description: >- - Details of balance of the `sellToken` that the - `taker` must hold. Null if the `taker` has - sufficient balance - nullable: true - 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 - additionalProperties: false - 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 - enum: - - true - description: >- - This validates the availability of liquidity for the - quote requested. The rest of the fields will only be - returned if `true` - minBuyAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - 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: - type: object - properties: - fills: - type: array - items: - type: object - properties: - from: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the input token - to: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the output token - source: - type: string - description: The liquidity source used in the route - proportionBps: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The proportion of the trade to be filled by - the `source` - required: - - from - - to - - source - - proportionBps - additionalProperties: false - description: >- - Details of each segment that 0x routes the swap - through - tokens: - type: array - items: - type: object - properties: - address: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - 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 - additionalProperties: false - description: Properties of the tokens involved in the swap - description: Properties of the tokens involved in the swap - required: - - fills - - tokens - additionalProperties: false - description: >- - The path of liquidity sources to be used in executing - this swap - sellAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of `sellToken` (in `sellToken` units) that - will be sold in this swap - sellToken: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the token to sell in the swap - tokenMetadata: - type: object - properties: - buyToken: - type: object - properties: - buyTaxBps: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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 - additionalProperties: false - description: Swap-related metadata for the buy token - sellToken: - type: object - properties: - buyTaxBps: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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 - additionalProperties: false - description: Swap-related metadata for the sell token - required: - - buyToken - - sellToken - additionalProperties: false - description: >- - Swap-related metadata for the buy and sell token in - the swap - totalNetworkFee: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - description: >- - The estimated total network cost of the swap. On - chains where there is no L1 data cost, it is - calculated as `gas` * `gasPrice`. On chains where - there is an L1 data cost, it is calculated as `gas` * - `gasPrice` + L1 data cost. - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - allowanceTarget - - blockNumber - - buyAmount - - buyToken - - fees - - gas - - gasPrice - - issues - - liquidityAvailable - - minBuyAmount - - route - - sellAmount - - sellToken - - tokenMetadata - - totalNetworkFee - - zid - additionalProperties: false - - type: object - properties: - liquidityAvailable: - type: boolean - enum: - - false - 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 - additionalProperties: false - example: - allowanceTarget: "0x000000000022d473030f116ddee9f6b43ac78ba3" - 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" - "400": - description: 400 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INPUT_INVALID" - - $ref: "#/components/schemas/RECIPIENT_NOT_SUPPORTED" - - $ref: "#/components/schemas/SWAP_VALIDATION_FAILED" - - $ref: "#/components/schemas/TOKEN_NOT_SUPPORTED" - - $ref: "#/components/schemas/USER_NOT_AUTHORIZED" - "403": - description: 403 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/TAKER_NOT_AUTHORIZED_FOR_TRADE" - - $ref: "#/components/schemas/RECIPIENT_NOT_AUTHORIZED_FOR_TRADE" - - $ref: "#/components/schemas/XSTOCKS_NOT_AUTHORIZED" - "422": - description: 422 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/BUY_TOKEN_NOT_AUTHORIZED_FOR_TRADE" - - $ref: "#/components/schemas/SELL_TOKEN_NOT_AUTHORIZED_FOR_TRADE" - "500": - description: 500 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INTERNAL_SERVER_ERROR" - - $ref: "#/components/schemas/UNCATEGORIZED" - /swap/allowance-holder/quote: - get: - operationId: swap::allowanceHolder::getQuote - summary: getQuote (Allowance Holder) - description: Get the firm quote for a swap using Allowance Holder to set allowances - tags: - - Swap - parameters: - - description: Visit dashboard.0x.org to get your API Key - in: header - name: 0x-api-key - required: true - schema: - type: string - - description: API version - in: header - name: 0x-version - required: true - schema: - type: string - example: v2 - - name: chainId - in: query - required: true - schema: - type: integer - exclusiveMinimum: true - minimum: 0 - description: >- - Chain ID. See - [here](https://0x.org/docs/developer-resources/supported-chains) for - the list of supported chains - example: 1 - - name: buyToken - in: query - required: true - schema: - type: string - pattern: ^0x(?!0{40})[a-fA-F0-9]{40}$ - description: The contract address of the token to buy - example: "0xdac17f958d2ee523a2206206994597c13d831ec7" - - name: sellToken - in: query - required: true - schema: - type: string - pattern: ^0x(?!0{40})[a-fA-F0-9]{40}$ - description: The contract address of the token to sell - example: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" - - name: sellAmount - in: query - required: true - schema: - type: string - description: The amount of `sellToken` in `sellToken` base units to sell - example: "100000000" - - name: taker - in: query - required: true - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address which holds the `sellToken` balance and has the - allowance set for the swap - example: "0x70a9f34f9b34c64957b9c401a97bfed35b95049e" - - name: txOrigin - in: query - required: false - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the external account that started the transaction. - This is only needed if `taker` is a smart contract. - - name: recipient - in: query - required: false - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address to receive the `buyToken`. If not provided, defaults to - the taker address. Not supported for wrap/unwrap operations. - - name: swapFeeRecipient - in: query - required: false - schema: - type: string - pattern: ^\s*0x[a-fA-F0-9]{40}(\s*,\s*0x[a-fA-F0-9]{40})*\s*$ - 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`. - - name: swapFeeBps - in: query - required: false - schema: - type: string - pattern: ^\s*\d+(\s*,\s*\d+)*\s*$ - 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. - - name: swapFeeToken - in: query - required: false - schema: - type: string - pattern: >- - ^\s*0x(?!0{40})[a-fA-F0-9]{40}(\s*,\s*0x(?!0{40})[a-fA-F0-9]{40})*\s*$ - 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`. - - name: tradeSurplusRecipient - in: query - required: false - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - 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. - - name: tradeSurplusMaxBps - in: query - required: false - schema: - type: integer - minimum: 1 - maximum: 10000 - 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`. - - name: gasPrice - in: query - required: false - schema: - type: string - description: >- - The target gas price (in wei) for the swap transaction. If not - provided, the default value is based on the 0x gas price oracle - - name: slippageBps - in: query - required: false - schema: - type: integer - minimum: 0 - maximum: 10000 - default: 100 - description: >- - 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 - - name: excludedSources - in: query - required: false - schema: - type: string - 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 - - name: sellEntireBalance - in: query - required: false - schema: - type: string - enum: - - "true" - - "false" - default: "false" - description: >- - 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://0x.org/docs/0x-swap-api/advanced-topics/sell-entire-balance). - responses: - "200": - description: Successful response - content: - application/json: - schema: - anyOf: - - type: object - properties: - allowanceTarget: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - nullable: true - 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 - blockNumber: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The block number at which the liquidity sources were - sampled to generate the quote. This indicates the - freshness of the quote - buyAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of `buyToken` (in `buyToken` units) that - will be bought in the swap - buyToken: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the token to buy in the swap - fees: - type: object - properties: - integratorFee: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of token charged as the integrator - fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the token charged as the - integrator fee - type: - type: string - enum: - - volume - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: >- - The specified fee to charge and deliver to the - `swapFeeRecipient`. - integratorFees: - type: array - items: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of token charged as the - integrator fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the token charged as the - integrator fee - type: - type: string - enum: - - volume - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: >- - The specified fees to charge and deliver to the - `swapFeesRecipient`. - zeroExFee: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: The amount of token charged as the 0x fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The address of the token charged as the 0x fee - type: - type: string - enum: - - volume - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: The fee charged by 0x for the trade. - gasFee: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: The amount of token charged as the gas fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the token charged as the gas - fee - type: - type: string - enum: - - gas - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: >- - The gas fee to be used in submitting the - transaction. - required: - - integratorFee - - integratorFees - - zeroExFee - - gasFee - additionalProperties: false - issues: - type: object - properties: - allowance: - type: object - properties: - actual: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The `taker`'s current allowance of the - `spender` - spender: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The address to set the allowance on - required: - - actual - - spender - additionalProperties: false - description: >- - Details of allowances that the `taker` must set - for in order to execute the swap successfully. - Null if no allowance is required - nullable: true - balance: - type: object - properties: - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the `sellToken` - actual: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The current balance of the `sellToken` in the - `taker` address - expected: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The balance of the `sellToken` required for - the swap to execute successfully - required: - - token - - actual - - expected - additionalProperties: false - description: >- - Details of balance of the `sellToken` that the - `taker` must hold. Null if the `taker` has - sufficient balance - nullable: true - 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 - additionalProperties: false - 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 - enum: - - true - description: >- - This validates the availability of liquidity for the - quote requested. The rest of the fields will only be - returned if `true` - minBuyAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - 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: - type: object - properties: - fills: - type: array - items: - type: object - properties: - from: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the input token - to: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the output token - source: - type: string - description: The liquidity source used in the route - proportionBps: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The proportion of the trade to be filled by - the `source` - required: - - from - - to - - source - - proportionBps - additionalProperties: false - description: >- - Details of each segment that 0x routes the swap - through - tokens: - type: array - items: - type: object - properties: - address: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - 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 - additionalProperties: false - description: Properties of the tokens involved in the swap - description: Properties of the tokens involved in the swap - required: - - fills - - tokens - additionalProperties: false - description: >- - The path of liquidity sources to be used in executing - this swap - sellAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of `sellToken` (in `sellToken` units) that - will be sold in this swap - sellToken: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the token to sell in the swap - tokenMetadata: - type: object - properties: - buyToken: - type: object - properties: - buyTaxBps: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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 - additionalProperties: false - description: Swap-related metadata for the buy token - sellToken: - type: object - properties: - buyTaxBps: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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 - additionalProperties: false - description: Swap-related metadata for the sell token - required: - - buyToken - - sellToken - additionalProperties: false - description: >- - Swap-related metadata for the buy and sell token in - the swap - totalNetworkFee: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - description: >- - The estimated total network cost of the swap. On - chains where there is no L1 data cost, it is - calculated as `gas` * `gasPrice`. On chains where - there is an L1 data cost, it is calculated as `gas` * - `gasPrice` + L1 data cost. - transaction: - type: object - properties: - to: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the target contract to send call - `data` to. Do NOT use this field when setting - token allowances — doing so can result in lost - funds. Always use `issues.allowance.spender` or - `allowanceTarget` for setting allowances. - data: - type: string - description: >- - The calldata containing transaction execution - details to be sent to the `to` address - gas: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - description: >- - The estimated gas limit that should be used to - send the transaction to guarantee settlement - gasPrice: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The gas price (in wei) that should be used to send - the transaction - value: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of ether (in wei) that should be sent - with the transaction - required: - - to - - data - - gas - - gasPrice - - value - additionalProperties: false - description: >- - This object contains the details required to submit - the transaction - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - allowanceTarget - - blockNumber - - buyAmount - - buyToken - - fees - - issues - - liquidityAvailable - - minBuyAmount - - route - - sellAmount - - sellToken - - tokenMetadata - - totalNetworkFee - - transaction - - zid - additionalProperties: false - - type: object - properties: - liquidityAvailable: - type: boolean - enum: - - false - 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 - additionalProperties: false - example: - allowanceTarget: "0x000000000022d473030f116ddee9f6b43ac78ba3" - 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" - "400": - description: 400 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INPUT_INVALID" - - $ref: "#/components/schemas/RECIPIENT_NOT_SUPPORTED" - - $ref: "#/components/schemas/SWAP_VALIDATION_FAILED" - - $ref: "#/components/schemas/TOKEN_NOT_SUPPORTED" - - $ref: "#/components/schemas/USER_NOT_AUTHORIZED" - "403": - description: 403 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/TAKER_NOT_AUTHORIZED_FOR_TRADE" - - $ref: "#/components/schemas/RECIPIENT_NOT_AUTHORIZED_FOR_TRADE" - - $ref: "#/components/schemas/XSTOCKS_NOT_AUTHORIZED" - "422": - description: 422 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/BUY_TOKEN_NOT_AUTHORIZED_FOR_TRADE" - - $ref: "#/components/schemas/SELL_TOKEN_NOT_AUTHORIZED_FOR_TRADE" - "500": - description: 500 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INTERNAL_SERVER_ERROR" - - $ref: "#/components/schemas/UNCATEGORIZED" - /swap/permit2/price: - get: - operationId: swap::permit2::getPrice - summary: getPrice (Permit2) - description: Get the indicative price for a swap using Permit2 to set allowances - tags: - - Swap - parameters: - - description: Visit dashboard.0x.org to get your API Key - in: header - name: 0x-api-key - required: true - schema: - type: string - - description: API version - in: header - name: 0x-version - required: true - schema: - type: string - example: v2 - - name: chainId - in: query - required: true - schema: - type: integer - exclusiveMinimum: true - minimum: 0 - description: >- - Chain ID. See - [here](https://0x.org/docs/developer-resources/supported-chains) for - the list of supported chains - example: 1 - - name: buyToken - in: query - required: true - schema: - type: string - pattern: ^0x(?!0{40})[a-fA-F0-9]{40}$ - description: The contract address of the token to buy - example: "0xdac17f958d2ee523a2206206994597c13d831ec7" - - name: sellToken - in: query - required: true - schema: - type: string - pattern: ^0x(?!0{40})[a-fA-F0-9]{40}$ - description: The contract address of the token to sell - example: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" - - name: sellAmount - in: query - required: true - schema: - type: string - description: The amount of `sellToken` in `sellToken` base units to sell - example: "100000000" - - name: taker - in: query - required: false - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address which holds the `sellToken` balance and has the - allowance set for the swap - example: "0x70a9f34f9b34c64957b9c401a97bfed35b95049e" - - name: txOrigin - in: query - required: false - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the external account that started the transaction. - This is only needed if `taker` is a smart contract. - - name: recipient - in: query - required: false - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address to receive the `buyToken`. If not provided, defaults to - the taker address. Not supported for wrap/unwrap operations. - - name: swapFeeRecipient - in: query - required: false - schema: - type: string - pattern: ^\s*0x[a-fA-F0-9]{40}(\s*,\s*0x[a-fA-F0-9]{40})*\s*$ - 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`. - - name: swapFeeBps - in: query - required: false - schema: - type: string - pattern: ^\s*\d+(\s*,\s*\d+)*\s*$ - 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. - - name: swapFeeToken - in: query - required: false - schema: - type: string - pattern: >- - ^\s*0x(?!0{40})[a-fA-F0-9]{40}(\s*,\s*0x(?!0{40})[a-fA-F0-9]{40})*\s*$ - 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`. - - name: tradeSurplusRecipient - in: query - required: false - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - 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. - - name: tradeSurplusMaxBps - in: query - required: false - schema: - type: integer - minimum: 1 - maximum: 10000 - 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`. - - name: gasPrice - in: query - required: false - schema: - type: string - description: >- - The target gas price (in wei) for the swap transaction. If not - provided, the default value is based on the 0x gas price oracle - - name: slippageBps - in: query - required: false - schema: - type: integer - minimum: 0 - maximum: 10000 - default: 100 - description: >- - 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 - - name: excludedSources - in: query - required: false - schema: - type: string - 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 - - name: sellEntireBalance - in: query - required: false - schema: - type: string - enum: - - "true" - - "false" - default: "false" - description: >- - 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://0x.org/docs/0x-swap-api/advanced-topics/sell-entire-balance). - responses: - "200": - description: Successful response - content: - application/json: - schema: - anyOf: - - type: object - properties: - allowanceTarget: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - nullable: true - 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 - blockNumber: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The block number at which the liquidity sources were - sampled to generate the quote. This indicates the - freshness of the quote - buyAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of `buyToken` (in `buyToken` units) that - will be bought in the swap - buyToken: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the token to buy in the swap - fees: - type: object - properties: - integratorFee: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of token charged as the integrator - fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the token charged as the - integrator fee - type: - type: string - enum: - - volume - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: >- - The specified fee to charge and deliver to the - `swapFeeRecipient`. - integratorFees: - type: array - items: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of token charged as the - integrator fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the token charged as the - integrator fee - type: - type: string - enum: - - volume - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: >- - The specified fees to charge and deliver to the - `swapFeesRecipient`. - zeroExFee: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: The amount of token charged as the 0x fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The address of the token charged as the 0x fee - type: - type: string - enum: - - volume - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: The fee charged by 0x for the trade. - gasFee: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: The amount of token charged as the gas fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the token charged as the gas - fee - type: - type: string - enum: - - gas - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: >- - The gas fee to be used in submitting the - transaction. - required: - - integratorFee - - integratorFees - - zeroExFee - - gasFee - additionalProperties: false - description: >- - Fees to be deducted in this transaction. It contains - the `integratorFee`, `zeroExFee` and `gasFee` - gas: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - description: >- - The estimated gas limit that should be used to send - the transaction to guarantee settlement - gasPrice: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The gas price (in wei) that should be used to send the - transaction. The transaction needs to be sent with - this `gasPrice` for the transaction to be successful - issues: - type: object - properties: - allowance: - type: object - properties: - actual: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The `taker`'s current allowance of the - `spender` - spender: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The address to set the allowance on - required: - - actual - - spender - additionalProperties: false - description: >- - Details of allowances that the `taker` must set - for in order to execute the swap successfully. - Null if no allowance is required - nullable: true - balance: - type: object - properties: - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the `sellToken` - actual: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The current balance of the `sellToken` in the - `taker` address - expected: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The balance of the `sellToken` required for - the swap to execute successfully - required: - - token - - actual - - expected - additionalProperties: false - description: >- - Details of balance of the `sellToken` that the - `taker` must hold. Null if the `taker` has - sufficient balance - nullable: true - 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 - additionalProperties: false - 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 - enum: - - true - description: >- - This validates the availability of liquidity for the - quote requested. The rest of the fields will only be - returned if `true` - minBuyAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - 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: - type: object - properties: - fills: - type: array - items: - type: object - properties: - from: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the input token - to: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the output token - source: - type: string - description: The liquidity source used in the route - proportionBps: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The proportion of the trade to be filled by - the `source` - required: - - from - - to - - source - - proportionBps - additionalProperties: false - description: >- - Details of each segment that 0x routes the swap - through - tokens: - type: array - items: - type: object - properties: - address: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - 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 - additionalProperties: false - description: Properties of the tokens involved in the swap - description: Properties of the tokens involved in the swap - required: - - fills - - tokens - additionalProperties: false - description: >- - The path of liquidity sources to be used in executing - this swap - sellAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of `sellToken` (in `sellToken` units) that - will be sold in this swap - sellToken: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the token to sell in the swap - tokenMetadata: - type: object - properties: - buyToken: - type: object - properties: - buyTaxBps: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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 - additionalProperties: false - description: Swap-related metadata for the buy token - sellToken: - type: object - properties: - buyTaxBps: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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 - additionalProperties: false - description: Swap-related metadata for the sell token - required: - - buyToken - - sellToken - additionalProperties: false - description: >- - Swap-related metadata for the buy and sell token in - the swap - totalNetworkFee: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - description: >- - The estimated total network cost of the swap. On - chains where there is no L1 data cost, it is - calculated as `gas` * `gasPrice`. On chains where - there is an L1 data cost, it is calculated as `gas` * - `gasPrice` + L1 data cost. - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - allowanceTarget - - blockNumber - - buyAmount - - buyToken - - fees - - gas - - gasPrice - - issues - - liquidityAvailable - - minBuyAmount - - route - - sellAmount - - sellToken - - tokenMetadata - - totalNetworkFee - - zid - additionalProperties: false - - type: object - properties: - liquidityAvailable: - type: boolean - enum: - - false - 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 - additionalProperties: false - example: - allowanceTarget: "0x000000000022d473030f116ddee9f6b43ac78ba3" - 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" - "400": - description: 400 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INPUT_INVALID" - - $ref: "#/components/schemas/RECIPIENT_NOT_SUPPORTED" - - $ref: "#/components/schemas/SWAP_VALIDATION_FAILED" - - $ref: "#/components/schemas/TOKEN_NOT_SUPPORTED" - - $ref: "#/components/schemas/USER_NOT_AUTHORIZED" - "403": - description: 403 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/TAKER_NOT_AUTHORIZED_FOR_TRADE" - - $ref: "#/components/schemas/RECIPIENT_NOT_AUTHORIZED_FOR_TRADE" - - $ref: "#/components/schemas/XSTOCKS_NOT_AUTHORIZED" - "422": - description: 422 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/BUY_TOKEN_NOT_AUTHORIZED_FOR_TRADE" - - $ref: "#/components/schemas/SELL_TOKEN_NOT_AUTHORIZED_FOR_TRADE" - "500": - description: 500 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INTERNAL_SERVER_ERROR" - - $ref: "#/components/schemas/UNCATEGORIZED" - /swap/permit2/quote: - get: - operationId: swap::permit2::getQuote - summary: getQuote (Permit2) - description: Get the firm quote for a swap using Permit2 to set allowances - tags: - - Swap - parameters: - - description: Visit dashboard.0x.org to get your API Key - in: header - name: 0x-api-key - required: true - schema: - type: string - - description: API version - in: header - name: 0x-version - required: true - schema: - type: string - example: v2 - - name: chainId - in: query - required: true - schema: - type: integer - exclusiveMinimum: true - minimum: 0 - description: >- - Chain ID. See - [here](https://0x.org/docs/developer-resources/supported-chains) for - the list of supported chains - example: 1 - - name: buyToken - in: query - required: true - schema: - type: string - pattern: ^0x(?!0{40})[a-fA-F0-9]{40}$ - description: The contract address of the token to buy - example: "0xdac17f958d2ee523a2206206994597c13d831ec7" - - name: sellToken - in: query - required: true - schema: - type: string - pattern: ^0x(?!0{40})[a-fA-F0-9]{40}$ - description: The contract address of the token to sell - example: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" - - name: sellAmount - in: query - required: true - schema: - type: string - description: The amount of `sellToken` in `sellToken` base units to sell - example: "100000000" - - name: taker - in: query - required: true - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address which holds the `sellToken` balance and has the - allowance set for the swap - example: "0x70a9f34f9b34c64957b9c401a97bfed35b95049e" - - name: txOrigin - in: query - required: false - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the external account that started the transaction. - This is only needed if `taker` is a smart contract. - - name: recipient - in: query - required: false - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address to receive the `buyToken`. If not provided, defaults to - the taker address. Not supported for wrap/unwrap operations. - - name: swapFeeRecipient - in: query - required: false - schema: - type: string - pattern: ^\s*0x[a-fA-F0-9]{40}(\s*,\s*0x[a-fA-F0-9]{40})*\s*$ - 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`. - - name: swapFeeBps - in: query - required: false - schema: - type: string - pattern: ^\s*\d+(\s*,\s*\d+)*\s*$ - 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. - - name: swapFeeToken - in: query - required: false - schema: - type: string - pattern: >- - ^\s*0x(?!0{40})[a-fA-F0-9]{40}(\s*,\s*0x(?!0{40})[a-fA-F0-9]{40})*\s*$ - 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`. - - name: tradeSurplusRecipient - in: query - required: false - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - 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. - - name: tradeSurplusMaxBps - in: query - required: false - schema: - type: integer - minimum: 1 - maximum: 10000 - 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`. - - name: gasPrice - in: query - required: false - schema: - type: string - description: >- - The target gas price (in wei) for the swap transaction. If not - provided, the default value is based on the 0x gas price oracle - - name: slippageBps - in: query - required: false - schema: - type: integer - minimum: 0 - maximum: 10000 - default: 100 - description: >- - 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 - - name: excludedSources - in: query - required: false - schema: - type: string - 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 - - name: sellEntireBalance - in: query - required: false - schema: - type: string - enum: - - "true" - - "false" - default: "false" - description: >- - 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://0x.org/docs/0x-swap-api/advanced-topics/sell-entire-balance). - responses: - "200": - description: Successful response - content: - application/json: - schema: - anyOf: - - type: object - properties: - allowanceTarget: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - nullable: true - 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 - blockNumber: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The block number at which the liquidity sources were - sampled to generate the quote. This indicates the - freshness of the quote - buyAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of `buyToken` (in `buyToken` units) that - will be bought in the swap - buyToken: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the token to buy in the swap - fees: - type: object - properties: - integratorFee: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of token charged as the integrator - fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the token charged as the - integrator fee - type: - type: string - enum: - - volume - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: >- - The specified fee to charge and deliver to the - `swapFeeRecipient`. - integratorFees: - type: array - items: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of token charged as the - integrator fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the token charged as the - integrator fee - type: - type: string - enum: - - volume - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: >- - The specified fees to charge and deliver to the - `swapFeesRecipient`. - zeroExFee: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: The amount of token charged as the 0x fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The address of the token charged as the 0x fee - type: - type: string - enum: - - volume - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: The fee charged by 0x for the trade. - gasFee: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: The amount of token charged as the gas fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the token charged as the gas - fee - type: - type: string - enum: - - gas - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: >- - The gas fee to be used in submitting the - transaction. - required: - - integratorFee - - integratorFees - - zeroExFee - - gasFee - additionalProperties: false - issues: - type: object - properties: - allowance: - type: object - properties: - actual: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The `taker`'s current allowance of the - `spender` - spender: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The address to set the allowance on - required: - - actual - - spender - additionalProperties: false - description: >- - Details of allowances that the `taker` must set - for in order to execute the swap successfully. - Null if no allowance is required - nullable: true - balance: - type: object - properties: - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the `sellToken` - actual: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The current balance of the `sellToken` in the - `taker` address - expected: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The balance of the `sellToken` required for - the swap to execute successfully - required: - - token - - actual - - expected - additionalProperties: false - description: >- - Details of balance of the `sellToken` that the - `taker` must hold. Null if the `taker` has - sufficient balance - nullable: true - 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 - additionalProperties: false - 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 - enum: - - true - description: >- - This validates the availability of liquidity for the - quote requested. The rest of the fields will only be - returned if `true` - minBuyAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - 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 - permit2: - type: object - properties: - type: - type: string - enum: - - Permit2 - description: "`Permit2`" - 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: - type: object - properties: - types: - type: object - additionalProperties: - type: array - items: - type: object - properties: - name: - type: string - type: - type: string - required: - - name - - type - additionalProperties: false - domain: - type: object - properties: - name: - type: string - version: - type: string - chainId: - type: number - verifyingContract: - type: string - salt: - type: string - additionalProperties: false - message: - type: object - additionalProperties: - anyOf: - - type: string - - type: array - items: - type: string - - type: number - - type: array - items: - type: number - - type: boolean - - type: array - items: - type: boolean - - {} - - type: array - items: {} - primaryType: - type: string - required: - - types - - domain - - message - - primaryType - additionalProperties: false - description: >- - Necessary data for - [EIP-712](https://eips.ethereum.org/EIPS/eip-712) - required: - - type - - hash - - eip712 - additionalProperties: false - description: >- - This is the approval object which contains the - necessary fields to submit an approval for this - transaction. Null if sell token is the native token or - the transaction is a native token wrap / unwrap - nullable: true - route: - type: object - properties: - fills: - type: array - items: - type: object - properties: - from: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the input token - to: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the output token - source: - type: string - description: The liquidity source used in the route - proportionBps: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The proportion of the trade to be filled by - the `source` - required: - - from - - to - - source - - proportionBps - additionalProperties: false - description: >- - Details of each segment that 0x routes the swap - through - tokens: - type: array - items: - type: object - properties: - address: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - 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 - additionalProperties: false - description: Properties of the tokens involved in the swap - description: Properties of the tokens involved in the swap - required: - - fills - - tokens - additionalProperties: false - description: >- - The path of liquidity sources to be used in executing - this swap - sellAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of `sellToken` (in `sellToken` units) that - will be sold in this swap - sellToken: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the token to sell in the swap - tokenMetadata: - type: object - properties: - buyToken: - type: object - properties: - buyTaxBps: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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 - additionalProperties: false - description: Swap-related metadata for the buy token - sellToken: - type: object - properties: - buyTaxBps: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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 - additionalProperties: false - description: Swap-related metadata for the sell token - required: - - buyToken - - sellToken - additionalProperties: false - description: >- - Swap-related metadata for the buy and sell token in - the swap - totalNetworkFee: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - description: >- - The estimated total network cost of the swap. On - chains where there is no L1 data cost, it is - calculated as `gas` * `gasPrice. On chains where there - is an L1 data cost, it is calculated as `gas` * - `gasPrice + L1 data - transaction: - type: object - properties: - to: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the target contract to send call - `data` to. Do NOT use this field when setting - token allowances — doing so can result in lost - funds. Always use `issues.allowance.spender` or - `allowanceTarget` for setting allowances. - data: - type: string - description: >- - The calldata containing transaction execution - details to be sent to the `to` address - gas: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - description: >- - The estimated gas limit that should be used to - send the transaction to guarantee settlement - gasPrice: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The gas price (in wei) that should be used to send - the transaction - value: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of ether (in wei) that should be sent - with the transaction - required: - - to - - data - - gas - - gasPrice - - value - additionalProperties: false - description: >- - This object contains the details required to submit - the transaction - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - allowanceTarget - - blockNumber - - buyAmount - - buyToken - - fees - - issues - - liquidityAvailable - - minBuyAmount - - permit2 - - route - - sellAmount - - sellToken - - tokenMetadata - - totalNetworkFee - - transaction - - zid - additionalProperties: false - - type: object - properties: - liquidityAvailable: - type: boolean - enum: - - false - 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 - additionalProperties: false - example: - allowanceTarget: "0x000000000022d473030f116ddee9f6b43ac78ba3" - 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" - "400": - description: 400 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INPUT_INVALID" - - $ref: "#/components/schemas/RECIPIENT_NOT_SUPPORTED" - - $ref: "#/components/schemas/SWAP_VALIDATION_FAILED" - - $ref: "#/components/schemas/TOKEN_NOT_SUPPORTED" - - $ref: "#/components/schemas/USER_NOT_AUTHORIZED" - "403": - description: 403 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/TAKER_NOT_AUTHORIZED_FOR_TRADE" - - $ref: "#/components/schemas/RECIPIENT_NOT_AUTHORIZED_FOR_TRADE" - - $ref: "#/components/schemas/XSTOCKS_NOT_AUTHORIZED" - "422": - description: 422 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/BUY_TOKEN_NOT_AUTHORIZED_FOR_TRADE" - - $ref: "#/components/schemas/SELL_TOKEN_NOT_AUTHORIZED_FOR_TRADE" - "500": - description: 500 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INTERNAL_SERVER_ERROR" - - $ref: "#/components/schemas/UNCATEGORIZED" - /swap/chains: - get: - operationId: swap::chains - summary: getChains - description: Get list of supported chains for swap - tags: - - Swap - parameters: - - description: Visit dashboard.0x.org to get your API Key - in: header - name: 0x-api-key - required: true - schema: - type: string - - description: API version - in: header - name: 0x-version - required: true - schema: - type: string - example: v2 - responses: - "200": - description: Successful response - content: - application/json: - schema: - type: object - properties: - chains: - type: array - items: - type: object - properties: - chainId: - type: number - chainName: - type: string - required: - - chainId - - chainName - additionalProperties: false - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - chains - - zid - additionalProperties: false - example: - - 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" - "500": - description: 500 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INTERNAL_SERVER_ERROR" - - $ref: "#/components/schemas/UNCATEGORIZED" - /gasless/price: - get: - operationId: gasless::getPrice - summary: getPrice - description: Get the indicative price for a gasless swap - tags: - - Gasless - parameters: - - description: Visit dashboard.0x.org to get your API Key - in: header - name: 0x-api-key - required: true - schema: - type: string - - description: API version - in: header - name: 0x-version - required: true - schema: - type: string - example: v2 - - name: chainId - in: query - required: true - schema: - type: integer - exclusiveMinimum: true - minimum: 0 - description: >- - Chain ID. See - [here](https://0x.org/docs/developer-resources/supported-chains) for - the list of supported chains - example: 1 - - name: buyToken - in: query - required: true - schema: - type: string - pattern: ^0x(?!0{40})[a-fA-F0-9]{40}$ - description: The contract address of the token to buy - example: "0xdac17f958d2ee523a2206206994597c13d831ec7" - - name: sellToken - in: query - required: true - schema: - type: string - pattern: ^0x(?!0{40})[a-fA-F0-9]{40}$ - description: >- - The contract address of the token to sell. Native token is not - supported - example: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" - - name: sellAmount - in: query - required: true - schema: - type: string - description: The amount of `sellToken` in `sellToken` base units to sell - example: "300000000" - - name: taker - in: query - required: false - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address which holds the `sellToken` balance and has the - allowance set for the swap - example: "0x70a9f34f9b34c64957b9c401a97bfed35b95049e" - - name: recipient - in: query - required: false - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address to receive the `buyToken`. If not provided, defaults to - the taker address. Not supported for wrap/unwrap operations. - - name: swapFeeRecipient - in: query - required: false - schema: - type: string - pattern: ^\s*0x[a-fA-F0-9]{40}(\s*,\s*0x[a-fA-F0-9]{40})*\s*$ - 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`. - - name: swapFeeBps - in: query - required: false - schema: - type: string - pattern: ^\s*\d+(\s*,\s*\d+)*\s*$ - 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. - - name: swapFeeToken - in: query - required: false - schema: - type: string - pattern: >- - ^\s*0x(?!0{40})[a-fA-F0-9]{40}(\s*,\s*0x(?!0{40})[a-fA-F0-9]{40})*\s*$ - 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`. - - name: tradeSurplusRecipient - in: query - required: false - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - 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. - - name: tradeSurplusMaxBps - in: query - required: false - schema: - type: integer - minimum: 1 - maximum: 10000 - 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`. - - name: slippageBps - in: query - required: false - schema: - type: integer - minimum: 30 - maximum: 10000 - 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. - - name: excludedSources - in: query - required: false - schema: - type: string - 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 - responses: - "200": - description: Successful response - content: - application/json: - schema: - anyOf: - - type: object - properties: - allowanceTarget: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - nullable: true - 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 - blockNumber: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The block number at which the liquidity sources were - sampled to generate the quote. This indicates the - freshness of the quote - buyAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of `buyToken` (in `buyToken` units) that - will be bought in the swap - buyToken: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the token to buy in the swap - fees: - type: object - properties: - integratorFee: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of token charged as the integrator - fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the token charged as the - integrator fee - type: - type: string - enum: - - volume - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: >- - The specified fee to charge and deliver to the - `swapFeeRecipient`. - integratorFees: - type: array - items: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of token charged as the - integrator fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the token charged as the - integrator fee - type: - type: string - enum: - - volume - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: >- - The specified fees to charge and deliver to the - `swapFeesRecipient`. - zeroExFee: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: The amount of token charged as the 0x fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The address of the token charged as the 0x fee - type: - type: string - enum: - - volume - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: The fee charged by 0x for the trade. - gasFee: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: The amount of token charged as the gas fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the token charged as the gas - fee - type: - type: string - enum: - - gas - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: >- - The gas fee to be used in submitting the - transaction. - required: - - integratorFee - - integratorFees - - zeroExFee - - gasFee - additionalProperties: false - description: >- - Fees to be deducted in this transaction. It contains - the `integratorFee`, `zeroExFee` and `gasFee` - issues: - type: object - properties: - allowance: - type: object - properties: - actual: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The `taker`'s current allowance of the - `spender` - spender: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The address to set the allowance on - required: - - actual - - spender - additionalProperties: false - description: >- - Details of allowances that the `taker` must set - for in order to execute the swap successfully. - Null if no allowance is required - nullable: true - balance: - type: object - properties: - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the `sellToken` - actual: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The current balance of the `sellToken` in the - `taker` address - expected: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The balance of the `sellToken` required for - the swap to execute successfully - required: - - token - - actual - - expected - additionalProperties: false - description: >- - Details of balance of the `sellToken` that the - `taker` must hold. Null if the `taker` has - sufficient balance - nullable: true - 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 - additionalProperties: false - 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 - enum: - - true - description: >- - This validates the availability of liquidity for the - quote requested. The rest of the fields will only be - returned if `true` - minBuyAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - 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: - type: object - properties: - fills: - type: array - items: - type: object - properties: - from: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the input token - to: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the output token - source: - type: string - description: The liquidity source used in the route - proportionBps: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The proportion of the trade to be filled by - the `source` - required: - - from - - to - - source - - proportionBps - additionalProperties: false - description: >- - Details of each segment that 0x routes the swap - through - tokens: - type: array - items: - type: object - properties: - address: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - 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 - additionalProperties: false - description: Properties of the tokens involved in the swap - description: Properties of the tokens involved in the swap - required: - - fills - - tokens - additionalProperties: false - description: >- - The path of liquidity sources to be used in executing - this swap - sellAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of `sellToken` (in `sellToken` units) that - will be sold in this swap - sellToken: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the token to sell in the swap - target: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the target contract that the - transaction will be submitted to - tokenMetadata: - type: object - properties: - buyToken: - type: object - properties: - buyTaxBps: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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 - additionalProperties: false - description: Swap-related metadata for the buy token - sellToken: - type: object - properties: - buyTaxBps: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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 - additionalProperties: false - description: Swap-related metadata for the sell token - required: - - buyToken - - sellToken - additionalProperties: false - description: >- - Swap-related metadata for the buy and sell token in - the swap - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - allowanceTarget - - blockNumber - - buyAmount - - buyToken - - fees - - issues - - liquidityAvailable - - minBuyAmount - - route - - sellAmount - - sellToken - - target - - tokenMetadata - - zid - additionalProperties: false - - type: object - properties: - liquidityAvailable: - type: boolean - enum: - - false - 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 - additionalProperties: false - example: - allowanceTarget: "0x000000000022d473030f116ddee9f6b43ac78ba3" - 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" - "400": - description: 400 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INPUT_INVALID" - - $ref: "#/components/schemas/RECIPIENT_NOT_SUPPORTED" - - $ref: "#/components/schemas/UNABLE_TO_CALCULATE_GAS_FEE" - - $ref: "#/components/schemas/SELL_AMOUNT_TOO_SMALL" - - $ref: "#/components/schemas/SWAP_VALIDATION_FAILED" - - $ref: "#/components/schemas/TOKEN_NOT_SUPPORTED" - - $ref: "#/components/schemas/USER_NOT_AUTHORIZED" - - $ref: "#/components/schemas/TOKEN_PAIR_NOT_SUPPORTED" - "403": - description: 403 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/TAKER_NOT_AUTHORIZED_FOR_TRADE" - - $ref: "#/components/schemas/RECIPIENT_NOT_AUTHORIZED_FOR_TRADE" - - $ref: "#/components/schemas/XSTOCKS_NOT_AUTHORIZED" - "422": - description: 422 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/BUY_TOKEN_NOT_AUTHORIZED_FOR_TRADE" - - $ref: "#/components/schemas/SELL_TOKEN_NOT_AUTHORIZED_FOR_TRADE" - "500": - description: 500 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INTERNAL_SERVER_ERROR" - - $ref: "#/components/schemas/UNCATEGORIZED" - /gasless/quote: - get: - operationId: gasless::getQuote - summary: getQuote - description: Get the firm quote for a gasless swap - tags: - - Gasless - parameters: - - description: Visit dashboard.0x.org to get your API Key - in: header - name: 0x-api-key - required: true - schema: - type: string - - description: API version - in: header - name: 0x-version - required: true - schema: - type: string - example: v2 - - name: chainId - in: query - required: true - schema: - type: integer - exclusiveMinimum: true - minimum: 0 - description: >- - Chain ID. See - [here](https://0x.org/docs/developer-resources/supported-chains) for - the list of supported chains - example: 1 - - name: buyToken - in: query - required: true - schema: - type: string - pattern: ^0x(?!0{40})[a-fA-F0-9]{40}$ - description: The contract address of the token to buy - example: "0xdac17f958d2ee523a2206206994597c13d831ec7" - - name: sellToken - in: query - required: true - schema: - type: string - pattern: ^0x(?!0{40})[a-fA-F0-9]{40}$ - description: >- - The contract address of the token to sell. Native token is not - supported - example: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" - - name: sellAmount - in: query - required: true - schema: - type: string - description: The amount of `sellToken` in `sellToken` base units to sell - example: "300000000" - - name: taker - in: query - required: true - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address which holds the `sellToken` balance and has the - allowance set for the swap - example: "0x70a9f34f9b34c64957b9c401a97bfed35b95049e" - - name: recipient - in: query - required: false - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address to receive the `buyToken`. If not provided, defaults to - the taker address. Not supported for wrap/unwrap operations. - - name: swapFeeRecipient - in: query - required: false - schema: - type: string - pattern: ^\s*0x[a-fA-F0-9]{40}(\s*,\s*0x[a-fA-F0-9]{40})*\s*$ - 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`. - - name: swapFeeBps - in: query - required: false - schema: - type: string - pattern: ^\s*\d+(\s*,\s*\d+)*\s*$ - 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. - - name: swapFeeToken - in: query - required: false - schema: - type: string - pattern: >- - ^\s*0x(?!0{40})[a-fA-F0-9]{40}(\s*,\s*0x(?!0{40})[a-fA-F0-9]{40})*\s*$ - 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`. - - name: tradeSurplusRecipient - in: query - required: false - schema: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - 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. - - name: tradeSurplusMaxBps - in: query - required: false - schema: - type: integer - minimum: 1 - maximum: 10000 - 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`. - - name: slippageBps - in: query - required: false - schema: - type: integer - minimum: 30 - maximum: 10000 - 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. - - name: excludedSources - in: query - required: false - schema: - type: string - 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 - responses: - "200": - description: Successful response - content: - application/json: - schema: - anyOf: - - type: object - properties: - allowanceTarget: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - nullable: true - 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: - type: object - properties: - type: - type: string - enum: - - executeMetaTransaction::approve - - permit - - daiPermit - 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: - type: object - properties: - types: - type: object - additionalProperties: - type: array - items: - type: object - properties: - name: - type: string - type: - type: string - required: - - name - - type - additionalProperties: false - domain: - type: object - properties: - name: - type: string - version: - type: string - chainId: - type: number - verifyingContract: - type: string - salt: - type: string - additionalProperties: false - message: - type: object - additionalProperties: - anyOf: - - type: string - - type: array - items: - type: string - - type: number - - type: array - items: - type: number - - type: boolean - - type: array - items: - type: boolean - - {} - - type: array - items: {} - primaryType: - type: string - required: - - types - - domain - - message - - primaryType - additionalProperties: false - 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 - additionalProperties: false - nullable: true - description: >- - This is the “approval” object which contains the - necessary information to process a gasless approval - blockNumber: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The block number at which the liquidity sources were - sampled to generate the quote. This indicates the - freshness of the quote. - buyAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of `buyToken` (in `buyToken` units) that - will be bought in the swap - buyToken: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the token to buy in the swap - fees: - type: object - properties: - integratorFee: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of token charged as the integrator - fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the token charged as the - integrator fee - type: - type: string - enum: - - volume - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: >- - The specified fee to charge and deliver to the - `swapFeeRecipient`. - integratorFees: - type: array - items: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of token charged as the - integrator fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the token charged as the - integrator fee - type: - type: string - enum: - - volume - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: >- - The specified fees to charge and deliver to the - `swapFeesRecipient`. - zeroExFee: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: The amount of token charged as the 0x fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The address of the token charged as the 0x fee - type: - type: string - enum: - - volume - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: The fee charged by 0x for the trade. - gasFee: - type: object - properties: - amount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: The amount of token charged as the gas fee - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the token charged as the gas - fee - type: - type: string - enum: - - gas - required: - - amount - - token - - type - additionalProperties: false - nullable: true - description: >- - The gas fee to be used in submitting the - transaction. - required: - - integratorFee - - integratorFees - - zeroExFee - - gasFee - additionalProperties: false - issues: - type: object - properties: - allowance: - type: object - properties: - actual: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The `taker`'s current allowance of the - `spender` - spender: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The address to set the allowance on - required: - - actual - - spender - additionalProperties: false - description: >- - Details of allowances that the `taker` must set - for in order to execute the swap successfully. - Null if no allowance is required - nullable: true - balance: - type: object - properties: - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the `sellToken` - actual: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The current balance of the `sellToken` in the - `taker` address - expected: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The balance of the `sellToken` required for - the swap to execute successfully - required: - - token - - actual - - expected - additionalProperties: false - description: >- - Details of balance of the `sellToken` that the - `taker` must hold. Null if the `taker` has - sufficient balance - nullable: true - 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 - additionalProperties: false - 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 - enum: - - true - description: >- - This validates the availability of liquidity for the - quote requested. The rest of the fields will only be - returned if `true` - minBuyAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - 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: - type: object - properties: - fills: - type: array - items: - type: object - properties: - from: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the input token - to: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the output token - source: - type: string - description: The liquidity source used in the route - proportionBps: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The proportion of the trade to be filled by - the `source` - required: - - from - - to - - source - - proportionBps - additionalProperties: false - description: >- - Details of each segment that 0x routes the swap - through - tokens: - type: array - items: - type: object - properties: - address: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - 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 - additionalProperties: false - description: Properties of the tokens involved in the swap - description: Properties of the tokens involved in the swap - required: - - fills - - tokens - additionalProperties: false - description: >- - The path of liquidity sources to be used in executing - this swap - sellAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: >- - The amount of `sellToken` (in `sellToken` units) that - will be sold in this swap - sellToken: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the token to sell in the swap - target: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The address of the target contract that the - transaction will be submitted to - tokenMetadata: - type: object - properties: - buyToken: - type: object - properties: - buyTaxBps: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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 - additionalProperties: false - description: Swap-related metadata for the buy token - sellToken: - type: object - properties: - buyTaxBps: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - nullable: true - 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 - additionalProperties: false - description: Swap-related metadata for the sell token - required: - - buyToken - - sellToken - additionalProperties: false - description: >- - Swap-related metadata for the buy and sell token in - the swap - trade: - type: object - properties: - type: - type: string - enum: - - settler_metatransaction - - settler_intent - 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: - type: object - properties: - types: - type: object - additionalProperties: - type: array - items: - type: object - properties: - name: - type: string - type: - type: string - required: - - name - - type - additionalProperties: false - domain: - type: object - properties: - name: - type: string - version: - type: string - chainId: - type: number - verifyingContract: - type: string - salt: - type: string - additionalProperties: false - message: - type: object - additionalProperties: - anyOf: - - type: string - - type: array - items: - type: string - - type: number - - type: array - items: - type: number - - type: boolean - - type: array - items: - type: boolean - - {} - - type: array - items: {} - primaryType: - type: string - required: - - types - - domain - - message - - primaryType - additionalProperties: false - 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 - additionalProperties: false - 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 - additionalProperties: false - - type: object - properties: - liquidityAvailable: - type: boolean - enum: - - false - 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 - additionalProperties: false - example: - allowanceTarget: "0x000000000022d473030f116ddee9f6b43ac78ba3" - 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" - "400": - description: 400 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INPUT_INVALID" - - $ref: "#/components/schemas/INSUFFICIENT_BALANCE" - - $ref: "#/components/schemas/RECIPIENT_NOT_SUPPORTED" - - $ref: "#/components/schemas/UNABLE_TO_CALCULATE_GAS_FEE" - - $ref: "#/components/schemas/SELL_AMOUNT_TOO_SMALL" - - $ref: "#/components/schemas/SWAP_VALIDATION_FAILED" - - $ref: "#/components/schemas/TOKEN_NOT_SUPPORTED" - - $ref: "#/components/schemas/USER_NOT_AUTHORIZED" - - $ref: "#/components/schemas/TOKEN_PAIR_NOT_SUPPORTED" - "403": - description: 403 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/TAKER_NOT_AUTHORIZED_FOR_TRADE" - - $ref: "#/components/schemas/RECIPIENT_NOT_AUTHORIZED_FOR_TRADE" - - $ref: "#/components/schemas/XSTOCKS_NOT_AUTHORIZED" - "422": - description: 422 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/BUY_TOKEN_NOT_AUTHORIZED_FOR_TRADE" - - $ref: "#/components/schemas/SELL_TOKEN_NOT_AUTHORIZED_FOR_TRADE" - "500": - description: 500 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INTERNAL_SERVER_ERROR" - - $ref: "#/components/schemas/UNCATEGORIZED" - /gasless/submit: - post: - operationId: gasless::submit - summary: submit - description: Submit a gasless swap - tags: - - Gasless - requestBody: - required: true - content: - application/json: - schema: - type: object - properties: - chainId: - type: integer - exclusiveMinimum: true - minimum: 0 - description: >- - Chain ID. See - [here](https://0x.org/docs/developer-resources/supported-chains) - for the list of supported chains - approval: - type: object - properties: - type: - type: string - enum: - - executeMetaTransaction::approve - - permit - - daiPermit - description: The `approval.type` from the quote endpoint - eip712: - anyOf: - - type: object - properties: - types: - type: object - properties: - EIP712Domain: - type: array - items: - type: object - properties: - name: - type: string - type: - type: string - required: - - name - - type - additionalProperties: false - Permit: - type: array - items: - type: object - properties: - name: - type: string - type: - type: string - required: - - name - - type - additionalProperties: false - required: - - EIP712Domain - - Permit - additionalProperties: false - domain: - type: object - properties: - name: - type: string - version: - type: string - chainId: - type: number - verifyingContract: - type: string - salt: - type: string - additionalProperties: false - message: - type: object - properties: - owner: - type: string - spender: - type: string - value: - type: string - nonce: - type: number - deadline: - type: string - required: - - owner - - spender - - value - - nonce - - deadline - additionalProperties: false - primaryType: - type: string - enum: - - Permit - required: - - types - - domain - - message - - primaryType - additionalProperties: false - - type: object - properties: - types: - type: object - properties: - EIP712Domain: - type: array - items: - type: object - properties: - name: - type: string - type: - type: string - required: - - name - - type - additionalProperties: false - Permit: - type: array - items: - type: object - properties: - name: - type: string - type: - type: string - required: - - name - - type - additionalProperties: false - required: - - EIP712Domain - - Permit - additionalProperties: false - domain: - type: object - properties: - name: - type: string - version: - type: string - chainId: - type: number - verifyingContract: - type: string - salt: - type: string - additionalProperties: false - message: - type: object - properties: - holder: - type: string - spender: - type: string - nonce: - type: number - expiry: - type: string - allowed: - type: boolean - required: - - holder - - spender - - nonce - - expiry - - allowed - additionalProperties: false - primaryType: - type: string - enum: - - Permit - required: - - types - - domain - - message - - primaryType - additionalProperties: false - - type: object - properties: - types: - type: object - properties: - EIP712Domain: - type: array - items: - type: object - properties: - name: - type: string - type: - type: string - required: - - name - - type - additionalProperties: false - MetaTransaction: - type: array - items: - type: object - properties: - name: - type: string - type: - type: string - required: - - name - - type - additionalProperties: false - required: - - EIP712Domain - - MetaTransaction - additionalProperties: false - domain: - type: object - properties: - name: - type: string - version: - type: string - chainId: - type: number - verifyingContract: - type: string - salt: - type: string - additionalProperties: false - message: - type: object - properties: - nonce: - type: number - from: - type: string - functionSignature: - type: string - required: - - nonce - - from - - functionSignature - additionalProperties: false - primaryType: - type: string - enum: - - MetaTransaction - required: - - types - - domain - - message - - primaryType - additionalProperties: false - signature: - type: object - properties: - signatureType: - type: number - v: - type: number - r: - type: string - s: - type: string - required: - - signatureType - - v - - r - - s - additionalProperties: false - required: - - type - - eip712 - - signature - additionalProperties: false - nullable: true - description: >- - The gasless approval object from the quote endpoint - including its signature - trade: - type: object - properties: - type: - type: string - enum: - - settler_metatransaction - - settler_intent - description: The `trade.type` from the quote endpoint - eip712: - type: object - properties: - types: - type: object - additionalProperties: - type: array - items: - type: object - properties: - name: - type: string - type: - type: string - required: - - name - - type - additionalProperties: false - primaryType: - type: string - domain: - type: object - properties: - name: - type: string - version: - type: string - chainId: - type: number - verifyingContract: - type: string - salt: - type: string - additionalProperties: false - message: - anyOf: - - type: object - properties: - permitted: - type: object - properties: - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - amount: - anyOf: - - type: string - - type: number - - {} - required: - - token - - amount - additionalProperties: false - spender: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - nonce: - anyOf: - - type: string - - type: number - - {} - deadline: - anyOf: - - type: string - - type: number - - {} - slippageAndActions: - type: object - properties: - recipient: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - buyToken: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - minAmountOut: - anyOf: - - type: string - - type: number - - {} - actions: - type: array - items: - type: string - required: - - recipient - - buyToken - - minAmountOut - - actions - additionalProperties: false - required: - - permitted - - spender - - nonce - - deadline - - slippageAndActions - additionalProperties: false - - type: object - properties: - permitted: - type: object - properties: - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - amount: - anyOf: - - type: string - - type: number - - {} - required: - - token - - amount - additionalProperties: false - spender: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - nonce: - anyOf: - - type: string - - type: number - - {} - deadline: - anyOf: - - type: string - - type: number - - {} - slippage: - type: object - properties: - recipient: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - buyToken: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - minAmountOut: - anyOf: - - type: string - - type: number - - {} - required: - - recipient - - buyToken - - minAmountOut - additionalProperties: false - required: - - permitted - - spender - - nonce - - deadline - - slippage - additionalProperties: false - required: - - types - - primaryType - - domain - - message - additionalProperties: false - description: The `trade.eip712` from the quote endpoint - signature: - type: object - properties: - signatureType: - type: number - v: - type: number - r: - type: string - s: - type: string - required: - - signatureType - - v - - r - - s - additionalProperties: false - required: - - type - - eip712 - - signature - additionalProperties: false - description: >- - The trade object from the quote endpoint including its - signature - required: - - chainId - - trade - additionalProperties: false - example: - 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 - parameters: - - description: Visit dashboard.0x.org to get your API Key - in: header - name: 0x-api-key - required: true - schema: - type: string - - description: API version - in: header - name: 0x-version - required: true - schema: - type: string - example: v2 - responses: - "200": - description: Successful response - content: - application/json: - schema: - type: object - properties: - tradeHash: - type: string - description: >- - The hash for the trade according to - [EIP-712](https://eips.ethereum.org/EIPS/eip-712) - type: - type: string - enum: - - settler_metatransaction - - settler_intent - description: >- - The transaction type determined by the trade route. This - is currently just `settler_metatransaction` and could - expand to more types in the future - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - tradeHash - - type - - zid - additionalProperties: false - example: - tradeHash: >- - 0xcb3285b35c024fca76037bea9ea4cb68645fed3bdd84030956577de2f1592aa9 - type: settler_metatransaction - zid: "0x111111111111111111111111" - "400": - description: 400 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INPUT_INVALID" - - $ref: "#/components/schemas/INSUFFICIENT_BALANCE_OR_ALLOWANCE" - - $ref: "#/components/schemas/INVALID_SIGNATURE" - - $ref: "#/components/schemas/INVALID_SIGNER" - - $ref: "#/components/schemas/META_TRANSACTION_EXPIRY_TOO_SOON" - - $ref: "#/components/schemas/META_TRANSACTION_INVALID" - - $ref: "#/components/schemas/PENDING_TRADES_ALREADY_EXIST" - - $ref: "#/components/schemas/TRADE_ALREADY_SUBMITTED" - "500": - description: 500 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INTERNAL_SERVER_ERROR" - - $ref: "#/components/schemas/UNCATEGORIZED" - /gasless/status/{tradeHash}: - get: - operationId: gasless::getStatus - summary: getStatus - description: Get the status of a gasless swap - tags: - - Gasless - parameters: - - description: Visit dashboard.0x.org to get your API Key - in: header - name: 0x-api-key - required: true - schema: - type: string - - description: API version - in: header - name: 0x-version - required: true - schema: - type: string - example: v2 - - name: chainId - in: query - required: true - schema: - type: integer - exclusiveMinimum: true - minimum: 0 - description: " [here](https://0x.org/docs/next/developer-resources/supported-chains) for the list of supported chains" - example: 8453 - - name: tradeHash - in: path - required: true - schema: - type: string - description: >- - The hash for the trade according to - [EIP-712](https://eips.ethereum.org/EIPS/eip-712) - example: "0x6c89e4ac46b246ab72cba02a9fb4f3525b9f8a11ea74262d5dd8ff0e024daf60" - responses: - "200": - description: Successful response - content: - application/json: - schema: - anyOf: - - type: object - properties: - approvalTransactions: - type: array - items: - type: object - properties: - hash: - type: string - description: The onchain transaction hash - timestamp: - type: integer - exclusiveMinimum: true - minimum: 0 - description: >- - The timestamp when the transaction was submitted - onchain - required: - - hash - - timestamp - additionalProperties: false - description: Details of the gasless approval transaction - status: - type: string - enum: - - pending - - submitted - - succeeded - - confirmed - description: >- - `pending` means that the order has been queued on 0x. - `submitted` means that it has been submitted - onchain,`succeeded` means it has been included in a - block and `confirmed` means it has at least 3 - confirmations onchain - transactions: - type: array - items: - type: object - properties: - hash: - type: string - description: The onchain transaction hash - timestamp: - type: integer - exclusiveMinimum: true - minimum: 0 - description: >- - The timestamp when the transaction was submitted - onchain - required: - - hash - - timestamp - additionalProperties: false - description: >- - Details of the gasless swap transaction. If the trade - is `pending`, no transaction will be returned. If - `submitted`, multiple transactions may be returned, - but only one will be mined. If `succeeded` and - `confirmed`, the mined transaction will be returned - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - status - - transactions - - zid - additionalProperties: false - - type: object - properties: - approvalTransactions: - type: array - items: - type: object - properties: - hash: - type: string - description: The onchain transaction hash - timestamp: - type: integer - exclusiveMinimum: true - minimum: 0 - description: >- - The timestamp when the transaction was submitted - onchain - required: - - hash - - timestamp - additionalProperties: false - description: Details of the gasless approval transaction - reason: - type: string - enum: - - transaction_simulation_failed - - order_expired - - last_look_declined - - transaction_reverted - - market_maker_sigature_error - - insufficient_allowance - - insufficient_balance - - internal_error - description: >- - This provides more context about why the transaction - failed - status: - type: string - enum: - - failed - description: >- - `failed` means that the order failed to be submitted - onchain - transactions: - type: array - items: - type: object - properties: - hash: - type: string - description: The onchain transaction hash - timestamp: - type: integer - exclusiveMinimum: true - minimum: 0 - description: >- - The timestamp when the transaction was submitted - onchain - required: - - hash - - timestamp - additionalProperties: false - description: >- - Details of the gasless swap transaction. If the trade - status is `failed`, there may be 0 (if it failed - before submission) to multiple transactions (if the - transaction reverted) - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - reason - - status - - transactions - - zid - additionalProperties: false - example: - status: confirmed - transactions: - - hash: >- - 0x36b42bc0ec313cfb9bf5122fbda933cbcce5f557bc3b7197b52223b05d7e596f - timestamp: 1718662626073 - zid: "0x111111111111111111111111" - "400": - description: 400 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INPUT_INVALID" - "404": - description: 404 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/META_TRANSACTION_STATUS_NOT_FOUND" - "500": - description: 500 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INTERNAL_SERVER_ERROR" - - $ref: "#/components/schemas/UNCATEGORIZED" - /gasless/gasless-approval-tokens: - get: - operationId: gasless::getGaslessApprovalTokens - summary: getGaslessApprovalTokens - description: Get token addresses that support gasless approvals - tags: - - Gasless - parameters: - - description: Visit dashboard.0x.org to get your API Key - in: header - name: 0x-api-key - required: true - schema: - type: string - - description: API version - in: header - name: 0x-version - required: true - schema: - type: string - example: v2 - - name: chainId - in: query - required: true - schema: - type: integer - exclusiveMinimum: true - minimum: 0 - description: >- - Chain ID. See - [here](https://0x.org/docs/developer-resources/supported-chains) for - the list of supported chains - example: 8453 - responses: - "200": - description: Successful response - content: - application/json: - schema: - type: object - properties: - tokens: - type: array - items: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The list of tokens that can be used for gasless approvals - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - tokens - - zid - additionalProperties: false - example: - tokens: - - "0x111111111117dc0aa78b770fa6a738034120c302" - - "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9" - - "0xb98d4c97425d9908e66e53a6fdf673acca0be986" - - "0xed04915c23f00a313a544955524eb7dbd823143d" - - "0x6b0b3a982b4634ac68dd83a4dbf02311ce324181" - - "0xac51066d7bec65dc4589368da368b212745d63e8" - zid: "0x111111111111111111111111" - "400": - description: 400 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INPUT_INVALID" - "500": - description: 500 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INTERNAL_SERVER_ERROR" - - $ref: "#/components/schemas/UNCATEGORIZED" - /gasless/chains: - get: - operationId: gasless::chains - summary: getChains - description: Get list of supported chains for gasless - tags: - - Gasless - parameters: - - description: Visit dashboard.0x.org to get your API Key - in: header - name: 0x-api-key - required: true - schema: - type: string - - description: API version - in: header - name: 0x-version - required: true - schema: - type: string - example: v2 - responses: - "200": - description: Successful response - content: - application/json: - schema: - type: object - properties: - chains: - type: array - items: - type: object - properties: - chainId: - type: number - chainName: - type: string - required: - - chainId - - chainName - additionalProperties: false - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - chains - - zid - additionalProperties: false - example: - - 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" - "500": - description: 500 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INTERNAL_SERVER_ERROR" - - $ref: "#/components/schemas/UNCATEGORIZED" - /sources: - get: - operationId: sources::getSources - summary: getSources - description: Get the list of supported sources - tags: - - Sources - parameters: - - description: Visit dashboard.0x.org to get your API Key - in: header - name: 0x-api-key - required: true - schema: - type: string - - description: API version - in: header - name: 0x-version - required: true - schema: - type: string - example: v2 - - name: chainId - in: query - required: true - schema: - type: integer - exclusiveMinimum: true - minimum: 0 - description: >- - Chain ID. See - [here](https://0x.org/docs/developer-resources/supported-chains) for - the list of supported chains - example: 1 - responses: - "200": - description: Successful response - content: - application/json: - schema: - type: object - properties: - sources: - type: array - items: - type: string - description: >- - The array of liquidity sources aggregated by 0x for the - requested chain - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - sources - - zid - additionalProperties: false - example: - sources: - - 0x_RFQ - - Ambient - - BalancerV1 - - BalancerV2 - - BancorV3 - - Curve - - DodoV1 - - DodoV2 - - FraxswapV2 - - Integral - - Lido - - MakerPsm - - Maverick - - Origin - - PancakeSwapV3 - - RocketPool - - SolidlyV3 - - SushiSwap - - Synapse - - UniswapV2 - - UniswapV3 - zid: "0x111111111111111111111111" - "400": - description: 400 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INPUT_INVALID" - "500": - description: 500 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INTERNAL_SERVER_ERROR" - - $ref: "#/components/schemas/UNCATEGORIZED" - /trade-analytics/swap: - get: - operationId: tradeAnalytics::swap - summary: getSwapTrades - description: >- - Get the list of completed swap trades. Returns a maximum of 200 trades - per request. Visit - [here](https://docs.0x.org/trade-analytics-api/introduction) for more - details about how the API works. - tags: - - Trade Analytics - parameters: - - description: Visit dashboard.0x.org to get your API Key - in: header - name: 0x-api-key - required: true - schema: - type: string - - description: API version - in: header - name: 0x-version - required: true - schema: - type: string - example: v2 - - name: cursor - in: query - required: false - schema: - type: string - description: >- - A pagination cursor used to fetch the next page of trades. It should - be set to `null` for the initial request; otherwise, it should be - the value of `nextCursor` that is returned from `getSwapTrades` or - `getGaslessTrades` calls. - example: >- - eyJ0aW1lc3RhbXAiOjE3MjkwMzIyMTAsInppZCI6IjB4N2FjM2NlMzExNjA2NzU5MGY5M2U3MWVmIn0= - - name: startTimestamp - in: query - required: false - schema: - type: integer - exclusiveMinimum: true - minimum: 0 - description: >- - 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. - example: 1729032210 - - name: endTimestamp - in: query - required: false - schema: - type: integer - exclusiveMinimum: true - minimum: 0 - description: >- - 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. - example: 1729032211 - responses: - "200": - description: Successful response - content: - application/json: - schema: - type: object - properties: - nextCursor: - type: string - nullable: true - description: >- - The cursor to fetch the next page of trades. If not - present, there are no more trades to fetch for given - parameters. - trades: - type: array - items: - type: object - properties: - appName: - type: string - description: The name of the app that initiated the trade - blockNumber: - type: string - description: The block number at which the trade was executed - buyToken: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The contract address of the token received by the - taker - buyAmount: - type: string - nullable: true - description: >- - The settled amount on the `buyToken`, formatted by - the token decimals - chainId: - type: integer - exclusiveMinimum: true - minimum: 0 - description: The ID of the chain where the trade was executed - chainName: - type: string - description: The name of the chain where the trade was executed - fees: - type: object - properties: - integratorFee: - type: object - properties: - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The contract address of the token in which - the integrator collected a fee - nullable: true - amount: - type: string - nullable: true - description: >- - The amount of the integrator fee, formatted - by the token decimals - amountUsd: - type: string - nullable: true - description: The amount of the integrator fee in USD. - required: - - token - - amount - - amountUsd - additionalProperties: false - description: >- - The details about the fee collected by - integrator - nullable: true - zeroExFee: - type: object - properties: - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The contract address of the token in which - 0x collected a fee - nullable: true - amount: - type: string - nullable: true - description: >- - The amount of the 0x fee, formatted by the - token decimals - amountUsd: - type: string - nullable: true - description: The amount of the 0x fee in USD. - required: - - token - - amount - - amountUsd - additionalProperties: false - description: The details about the fee collected by 0x - nullable: true - required: - - integratorFee - - zeroExFee - additionalProperties: false - description: The details about fees collected for the trade - gasUsed: - type: string - description: The amount of gas used in the trade - protocolVersion: - type: string - enum: - - 0xv4 - - Settler - description: >- - The version of the 0x protocol used to execute the - trade - sellToken: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the token spent by the taker - sellAmount: - type: string - nullable: true - description: >- - The amount of the `sellToken`, formatted by the - token decimals - slippageBps: - type: string - nullable: true - description: The slippage of the `buyToken` in bps - taker: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The wallet address of the taker​ - timestamp: - type: integer - exclusiveMinimum: true - minimum: 0 - description: The timestamp of the block containing the trade - tokens: - type: array - items: - type: object - properties: - address: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the token - symbol: - type: string - nullable: true - description: The symbol of the token - required: - - address - - symbol - additionalProperties: false - description: Properties of the token involved in the trade - description: Properties of the tokens involved in the trade - transactionHash: - type: string - description: The trade's transaction hash - volumeUsd: - type: string - nullable: true - description: >- - The total volume of the trade in USD. This value is - based on an estimate of the token price at the point - of execution. - zid: - type: string - description: The `zid` corresponding to the trade - service: - type: string - enum: - - swap - required: - - appName - - blockNumber - - buyToken - - buyAmount - - chainId - - chainName - - fees - - gasUsed - - protocolVersion - - sellToken - - sellAmount - - slippageBps - - taker - - timestamp - - tokens - - transactionHash - - volumeUsd - - zid - - service - additionalProperties: false - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - nextCursor - - trades - - zid - additionalProperties: false - example: - 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" - "400": - description: 400 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INPUT_INVALID" - "500": - description: 500 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INTERNAL_SERVER_ERROR" - - $ref: "#/components/schemas/UNCATEGORIZED" - /trade-analytics/gasless: - get: - operationId: tradeAnalytics::gasless - summary: getGaslessTrades - description: >- - Get the list of completed gasless trades. Returns a maximum of 200 - trades per request. Visit - [here](https://docs.0x.org/trade-analytics-api/introduction) for more - details about how the API works. - tags: - - Trade Analytics - parameters: - - description: Visit dashboard.0x.org to get your API Key - in: header - name: 0x-api-key - required: true - schema: - type: string - - description: API version - in: header - name: 0x-version - required: true - schema: - type: string - example: v2 - - name: cursor - in: query - required: false - schema: - type: string - description: >- - A pagination cursor used to fetch the next page of trades. It should - be set to `null` for the initial request; otherwise, it should be - the value of `nextCursor` that is returned from `getSwapTrades` or - `getGaslessTrades` calls. - example: >- - eyJ0aW1lc3RhbXAiOjE3MjkwMzIyMTAsInppZCI6IjB4N2FjM2NlMzExNjA2NzU5MGY5M2U3MWVmIn0= - - name: startTimestamp - in: query - required: false - schema: - type: integer - exclusiveMinimum: true - minimum: 0 - description: >- - 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. - example: 1729032210 - - name: endTimestamp - in: query - required: false - schema: - type: integer - exclusiveMinimum: true - minimum: 0 - description: >- - 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. - example: 1729032211 - responses: - "200": - description: Successful response - content: - application/json: - schema: - type: object - properties: - nextCursor: - type: string - nullable: true - description: >- - The cursor to fetch the next page of trades. If not - present, there are no more trades to fetch for given - parameters. - trades: - type: array - items: - type: object - properties: - appName: - type: string - description: The name of the app that initiated the trade - blockNumber: - type: string - description: The block number at which the trade was executed - buyToken: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The contract address of the token received by the - taker - buyAmount: - type: string - nullable: true - description: >- - The settled amount on the `buyToken`, formatted by - the token decimals - chainId: - type: integer - exclusiveMinimum: true - minimum: 0 - description: The ID of the chain where the trade was executed - chainName: - type: string - description: The name of the chain where the trade was executed - fees: - type: object - properties: - integratorFee: - type: object - properties: - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The contract address of the token in which - the integrator collected a fee - nullable: true - amount: - type: string - nullable: true - description: >- - The amount of the integrator fee, formatted - by the token decimals - amountUsd: - type: string - nullable: true - description: The amount of the integrator fee in USD. - required: - - token - - amount - - amountUsd - additionalProperties: false - description: >- - The details about the fee collected by - integrator - nullable: true - zeroExFee: - type: object - properties: - token: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: >- - The contract address of the token in which - 0x collected a fee - nullable: true - amount: - type: string - nullable: true - description: >- - The amount of the 0x fee, formatted by the - token decimals - amountUsd: - type: string - nullable: true - description: The amount of the 0x fee in USD. - required: - - token - - amount - - amountUsd - additionalProperties: false - description: The details about the fee collected by 0x - nullable: true - required: - - integratorFee - - zeroExFee - additionalProperties: false - description: The details about fees collected for the trade - gasUsed: - type: string - description: The amount of gas used in the trade - protocolVersion: - type: string - enum: - - 0xv4 - - Settler - description: >- - The version of the 0x protocol used to execute the - trade - sellToken: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the token spent by the taker - sellAmount: - type: string - nullable: true - description: >- - The amount of the `sellToken`, formatted by the - token decimals - slippageBps: - type: string - nullable: true - description: The slippage of the `buyToken` in bps - taker: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The wallet address of the taker​ - timestamp: - type: integer - exclusiveMinimum: true - minimum: 0 - description: The timestamp of the block containing the trade - tokens: - type: array - items: - type: object - properties: - address: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The contract address of the token - symbol: - type: string - nullable: true - description: The symbol of the token - required: - - address - - symbol - additionalProperties: false - description: Properties of the token involved in the trade - description: Properties of the tokens involved in the trade - transactionHash: - type: string - description: The trade's transaction hash - volumeUsd: - type: string - nullable: true - description: >- - The total volume of the trade in USD. This value is - based on an estimate of the token price at the point - of execution. - zid: - type: string - description: The `zid` corresponding to the trade - service: - type: string - enum: - - gasless - required: - - appName - - blockNumber - - buyToken - - buyAmount - - chainId - - chainName - - fees - - gasUsed - - protocolVersion - - sellToken - - sellAmount - - slippageBps - - taker - - timestamp - - tokens - - transactionHash - - volumeUsd - - zid - - service - additionalProperties: false - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - nextCursor - - trades - - zid - additionalProperties: false - example: - 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" - "400": - description: 400 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INPUT_INVALID" - "500": - description: 500 error response - content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/INTERNAL_SERVER_ERROR" - - $ref: "#/components/schemas/UNCATEGORIZED" -components: - securitySchemes: - ApiKeyAuth: - type: apiKey - in: header - name: 0x-api-key - responses: - error: - description: Error response - content: - application/json: - schema: - type: object - properties: - message: - type: string - code: - type: string - issues: - type: array - items: - type: object - properties: - message: - type: string - required: - - message - additionalProperties: false - required: - - message - - code - additionalProperties: false - schemas: - BUY_TOKEN_NOT_AUTHORIZED_FOR_TRADE: - type: object - properties: - name: - type: string - enum: - - BUY_TOKEN_NOT_AUTHORIZED_FOR_TRADE - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - zid - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - INPUT_INVALID: - type: object - properties: - name: - type: string - enum: - - INPUT_INVALID - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - details: - type: array - items: - type: object - properties: - field: - type: string - description: The input field name - reason: - type: string - description: The validation failure reason - required: - - field - - reason - additionalProperties: false - description: The list of invalid inputs - required: - - zid - - details - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - INSUFFICIENT_BALANCE: - type: object - properties: - name: - type: string - enum: - - INSUFFICIENT_BALANCE - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - taker: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The taker of the transaction - sellToken: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The sell token - sellAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: The sell amount - balance: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: The current balance of the taker for the sell token - required: - - zid - - taker - - sellToken - - sellAmount - - balance - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - INSUFFICIENT_BALANCE_OR_ALLOWANCE: - type: object - properties: - name: - type: string - enum: - - INSUFFICIENT_BALANCE_OR_ALLOWANCE - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - metaTransactionHash: - type: string - description: The hash of the meta-transaction provided by the caller - taker: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The intended signer of the meta-transaction - sellToken: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The sell token - sellAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: The sell amount - minBalanceOrAllowance: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: The smaller value of the balance or the allowance of the taker - required: - - zid - - metaTransactionHash - - taker - - sellToken - - sellAmount - - minBalanceOrAllowance - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - INTERNAL_SERVER_ERROR: - type: object - properties: - name: - type: string - enum: - - INTERNAL_SERVER_ERROR - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - zid - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - INVALID_SIGNATURE: - type: object - properties: - name: - type: string - enum: - - INVALID_SIGNATURE - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - metaTransactionHash: - type: string - description: The hash of the meta-transaction provided by the caller - taker: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The intended signer of the meta-transaction - required: - - zid - - metaTransactionHash - - taker - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - INVALID_SIGNER: - type: object - properties: - name: - type: string - enum: - - INVALID_SIGNER - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - metaTransactionHash: - type: string - description: The hash of the meta-transaction provided by the caller - taker: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The intended signer of the meta-transaction - signer: - type: string - pattern: ^0x[a-fA-F0-9]{40}$ - description: The signer of the meta-transaction - required: - - zid - - metaTransactionHash - - taker - - signer - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - META_TRANSACTION_EXPIRY_TOO_SOON: - type: object - properties: - name: - type: string - enum: - - META_TRANSACTION_EXPIRY_TOO_SOON - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - metaTransactionHash: - type: string - description: The hash of the meta-transaction provided by the caller - expiry: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: The expiry of the meta-transaction provided by the caller in ms - required: - - zid - - metaTransactionHash - - expiry - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - META_TRANSACTION_INVALID: - type: object - properties: - name: - type: string - enum: - - META_TRANSACTION_INVALID - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - metaTransactionHash: - type: string - description: The hash of the meta-transaction provided by the caller - required: - - zid - - metaTransactionHash - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - META_TRANSACTION_STATUS_NOT_FOUND: - type: object - properties: - name: - type: string - enum: - - META_TRANSACTION_STATUS_NOT_FOUND - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - zid - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - PENDING_TRADES_ALREADY_EXIST: - type: object - properties: - name: - type: string - enum: - - PENDING_TRADES_ALREADY_EXIST - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - metaTransactionHash: - type: string - description: The hash of the meta-transaction provided by the caller - pendingMetaTransactionHashes: - type: array - items: - type: string - description: >- - The list of pending meta-transaction hashes for the same taker - and sell token - required: - - zid - - metaTransactionHash - - pendingMetaTransactionHashes - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - SELL_AMOUNT_TOO_SMALL: - type: object - properties: - name: - type: string - enum: - - SELL_AMOUNT_TOO_SMALL - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - minSellAmount: - allOf: - - {} - - type: string - pattern: ^[-+]?(0|[1-9]\d*)(\.\d+)?$ - description: The minimum sell amount required for the trade to go through - required: - - zid - - minSellAmount - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - RECIPIENT_NOT_SUPPORTED: - type: object - properties: - name: - type: string - enum: - - RECIPIENT_NOT_SUPPORTED - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - zid - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - SELL_TOKEN_NOT_AUTHORIZED_FOR_TRADE: - type: object - properties: - name: - type: string - enum: - - SELL_TOKEN_NOT_AUTHORIZED_FOR_TRADE - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - zid - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - SWAP_VALIDATION_FAILED: - type: object - properties: - name: - type: string - enum: - - SWAP_VALIDATION_FAILED - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - zid - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - TAKER_NOT_AUTHORIZED_FOR_TRADE: - type: object - properties: - name: - type: string - enum: - - TAKER_NOT_AUTHORIZED_FOR_TRADE - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - zid - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - RECIPIENT_NOT_AUTHORIZED_FOR_TRADE: - type: object - properties: - name: - type: string - enum: - - RECIPIENT_NOT_AUTHORIZED_FOR_TRADE - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - zid - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - XSTOCKS_NOT_AUTHORIZED: - type: object - properties: - name: - type: string - enum: - - XSTOCKS_NOT_AUTHORIZED - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - zid - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - TOKEN_NOT_SUPPORTED: - type: object - properties: - name: - type: string - enum: - - TOKEN_NOT_SUPPORTED - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - zid - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - USER_NOT_AUTHORIZED: - type: object - properties: - name: - type: string - enum: - - USER_NOT_AUTHORIZED - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - zid - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - TOKEN_PAIR_NOT_SUPPORTED: - type: object - properties: - name: - type: string - enum: - - TOKEN_PAIR_NOT_SUPPORTED - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - zid - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - TRADE_ALREADY_SUBMITTED: - type: object - properties: - name: - type: string - enum: - - TRADE_ALREADY_SUBMITTED - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - tradeHash: - type: string - description: The hash of the trade that was already submitted - required: - - zid - - tradeHash - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - UNABLE_TO_CALCULATE_GAS_FEE: - type: object - properties: - name: - type: string - enum: - - UNABLE_TO_CALCULATE_GAS_FEE - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - zid - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false - UNCATEGORIZED: - type: object - properties: - name: - type: string - enum: - - UNCATEGORIZED - message: - type: string - data: - type: object - properties: - zid: - type: string - description: The unique ZeroEx identifier of the request - required: - - zid - additionalProperties: false - required: - - name - - message - - data - additionalProperties: false -tags: - - name: Swap - description: Swap API endpoints - - name: Gasless - description: Gasless API endpoints - - name: Sources - description: Sources API endpoints - - name: Trade Analytics - description: Trade Analytics API endpoints