# quote

API reference to fetch a quote for a swap.

{% hint style="info" %}
**Enzyme**

To execute swap with your Enzyme vault note the following:

* taker: Address of your Enzyme vault
* txOrigin: Address of the authorized "Manager" or "Asset Manager"
* encodingType: Set to "enzyme-vault"
  {% endhint %}

## GET /1.3/swap/quote

> Get quote for a swap

```json
{"openapi":"3.0.0","info":{"title":"31Third Trading API","version":"1.3"},"tags":[{"name":"swap","description":"Calculate swaps"}],"paths":{"/1.3/swap/quote":{"get":{"operationId":"SwapController_getSwapQuote","summary":"Get quote for a swap","parameters":[{"name":"x-api-key","in":"header","description":"31Third API key (Request via dev@31third.com)","schema":{"type":"string"}},{"name":"chain-id","in":"header","description":"Chain ID as hex string. (e.g.: 0x1 for Ethereum mainnet)","schema":{"type":"string"}},{"name":"sellToken","required":true,"in":"query","description":"Address of the sell token","schema":{"type":"string"}},{"name":"buyToken","required":true,"in":"query","description":"Address of the buy token","schema":{"type":"string"}},{"name":"sellAmount","required":true,"in":"query","description":"Sell amount in token base units (e.g. Wei for ETH)","schema":{"type":"string"}},{"name":"taker","required":true,"in":"query","description":"Address which holds the sellToken. (Allowance has to be set before execution)","schema":{"type":"string"}},{"name":"txOrigin","required":false,"in":"query","description":"Address of the external account that executed the tx. (Only needed if taker is a contract)","schema":{"type":"string"}},{"description":"(WIP) Liquidity sources types","required":false,"name":"types","in":"query","schema":{"type":"array"}},{"description":"Configuration allows three strategies: empty, include or exclude.\n - Empty: all sources are enabled. \n - Include (Whitelisting): only the given sources are enabled. \n - Exclude (Blacklisting): all sources except the given ones are enabled.","oneOf":[{"$ref":"#/components/schemas/IncludeLiquiditySourcesDto"},{"$ref":"#/components/schemas/ExcludeLiquiditySourcesDto"}],"required":false,"name":"sources","in":"query","schema":{}},{"name":"maxSlippageBps","required":false,"in":"query","description":"Maximum allowed slippage for the swap. (in basis points)","schema":{"minimum":0,"maximum":10000,"default":50,"type":"number"}},{"name":"maxPriceImpactBps","required":false,"in":"query","description":"Max price impact for the swap. (in basis points)","schema":{"minimum":0,"maximum":10000,"default":10000,"type":"number"}},{"name":"priceImpactExceedsError","required":false,"in":"query","description":"If true an error is returned if the price impact is exceeded. Otherwise an issue (warning) is added to the response. Defaults to false.","schema":{"default":false,"type":"boolean"}},{"name":"minExpirySec","required":false,"in":"query","description":"Min quote expiry. (in seconds)\nRFQ/OTC quotes from market makers have hard expiries between 40-90 seconds. If minExpiry is set higher then MM expiries these MMs are excluded. (Keep in mind that MM pricing might be better than DEX pricing, especially if quantity is high)","schema":{"minimum":10,"maximum":120,"default":35,"type":"number"}},{"name":"skipSimulation","required":false,"in":"query","description":"Skip Tenderly simulation","schema":{"default":false,"type":"boolean"}},{"name":"skipChecks","required":false,"in":"query","description":"Skip balance and allowance checks","schema":{"default":false,"type":"boolean"}},{"name":"encodingType","required":false,"in":"query","description":"Encoding type for the returned raw transaction.","schema":{"default":"basic","enum":["basic","enzyme-vault"],"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SwapQuoteDto"}}}}},"tags":["swap"]}}},"components":{"schemas":{"IncludeLiquiditySourcesDto":{"type":"object","properties":{"include":{"type":"object","description":"Sources to include. Default for all others is disabled. (Whitelisting)","additionalProperties":{"$ref":"#/components/schemas/SubLiquiditySourceSelectionDto"}}},"required":["include"]},"SubLiquiditySourceSelectionDto":{"type":"object","properties":{"subSources":{"type":"object","description":"Map of sub-source identifiers to an empty object marker, signifying selection.","additionalProperties":{"type":"object","description":"An empty object {} marker."}}}},"ExcludeLiquiditySourcesDto":{"type":"object","properties":{"exclude":{"type":"object","description":"Sources to exclude. Default for all others is enabled. (Blacklisting)","additionalProperties":{"$ref":"#/components/schemas/SubLiquiditySourceSelectionDto"}}},"required":["exclude"]},"SwapQuoteDto":{"type":"object","properties":{"id":{"type":"string","description":"Unique ID of the calculated swap price."},"sellToken":{"description":"Sell token.","allOf":[{"$ref":"#/components/schemas/SimpleTokenDto"}]},"buyToken":{"description":"Buy token.","allOf":[{"$ref":"#/components/schemas/SimpleTokenDto"}]},"sellAmount":{"format":"int64","type":"integer","description":"Amount to sell. (In sell token units)"},"buyAmount":{"format":"int64","type":"integer","description":"Estimated buy amount. (In buy token units)"},"price":{"type":"number","description":"Price of the <code>buy</code> token in <code>sell</code> token. E.g. 1 BTC = 100.000 USD; you sell WBTC and buy USDC; the price is 0.000001"},"priceImpactBps":{"type":"number","description":"Estimated price impact in basis points. [-10_000;10_000]. > 0 = value loss. < 0 = value gain","minimum":-10000,"maximum":10000},"minBuyAmount":{"format":"int64","type":"integer","description":"Minimal buy amount. (In buy token units)"},"guaranteedPrice":{"type":"number","description":"Guaranteed price of the <code>buy</code> token in <code>sell</code> token."},"maxPriceImpactBps":{"type":"number","description":"Maximum price impact in basis points. [-10_000;10_000]. > 0 = value loss. < 0 = value gain","minimum":-10000,"maximum":10000},"expiresAt":{"format":"date-time","type":"string","description":"If the swap contains RFQ/OTC fills this is a hard deadline. If not this can be considered as soft deadline. (Can be null if all fills are DEX based.)\nA new swap should be calculated every 20 - 30 seconds since market prices might change quickly."},"transaction":{"description":"Raw transaction.","allOf":[{"$ref":"#/components/schemas/RawTransactionDto"}]},"issues":{"description":"Balance and allowance check results.","allOf":[{"$ref":"#/components/schemas/SwapIssuesDto"}]},"tenderlySimulation":{"description":"Tenderly simulation results.","allOf":[{"$ref":"#/components/schemas/TenderlySimulationDto"}]}},"required":["id","sellToken","buyToken","sellAmount","buyAmount","price","priceImpactBps","minBuyAmount","guaranteedPrice","maxPriceImpactBps","expiresAt","transaction"]},"SimpleTokenDto":{"type":"object","properties":{"address":{"type":"string","description":"Address of the token"},"name":{"type":"string","description":"Name of the token"},"symbol":{"type":"string","description":"Symbol of the token"},"imageUrl":{"type":"string","description":"Url of the token icon"},"decimals":{"type":"number","description":"Decimals of the token"},"sliderColor":{"type":"string","description":"Color based on the icon that can be used for elements in the frontend"},"chain":{"description":"Chain on which the token is deployed","allOf":[{"$ref":"#/components/schemas/ChainDto"}]},"tags":{"description":"Tags categorizing the token","type":"array","items":{"type":"string"}},"deflationary":{"type":"boolean","description":"Describes if this token is deflationary (e.g.: transfer fees)"}},"required":["address","name","symbol","imageUrl","decimals","sliderColor","chain","tags","deflationary"]},"ChainDto":{"type":"object","properties":{"name":{"type":"string","description":"Name of the chain"},"identifier":{"type":"string","description":"ID of the EVM base chain as hex value"},"enabled":{"type":"boolean","description":"Describes if rebalancings are enabled"},"batchTradeSupported":{"type":"boolean","description":"Describes if batch trade is supported"},"batchTradeAddress":{"type":"string","description":"Address of the deployed 31third-protocol BatchTrade contract"},"blockExplorerLink":{"type":"string","description":"Link of the most common block explorer"},"nativeTokenAddress":{"type":"string","description":"(Pseudo)-address of the chains native token"},"wrappedNativeTokenAddress":{"type":"string","description":"Address of the chains wrapped native token"},"tokenHelperAddress":{"type":"string","description":"Address of a helper contract capable of doing batch reads"},"portfolioEnabled":{"type":"boolean","description":"Describes if portfolio feature is enabled"}},"required":["name","identifier","enabled","batchTradeSupported","batchTradeAddress","blockExplorerLink","nativeTokenAddress","wrappedNativeTokenAddress","tokenHelperAddress","portfolioEnabled"]},"RawTransactionDto":{"type":"object","properties":{"to":{"type":"string","description":"Address of the contract to send the tx to. In most cases this is the 31Third BatchTrade contract.\nIf encodingType is set to \"enzyme-vault\" on the request, this will bethe accessor of the Enzyme vault."},"data":{"type":"string","description":"The encoded tx data.\nSet encodingType to \"enzyme-vault\" if you want the calldata to be encodedfor an Enzyme vault."},"value":{"format":"int64","type":"integer","description":"The amount of native currency (e.g., Wei for Ethereum) to be transferred with the transaction, represented as a string to handle large numbers precisely."},"gasLimit":{"type":"string","description":"Estimated gasLimit. (Just returned if simulation is enabled and possible. Simulation might not be possible if there are outstanding approvals)"},"gasPrice":{"type":"string","description":"Suggested gasPrice. (Just returned if available)"}},"required":["to","data","value"]},"SwapIssuesDto":{"type":"object","properties":{"balance":{"description":"Not enough balance","allOf":[{"$ref":"#/components/schemas/SwapBalanceIssueDto"}]},"allowance":{"description":"Not enough allowance","allOf":[{"$ref":"#/components/schemas/SwapAllowanceIssueDto"}]},"priceImpact":{"description":"Max price impact exceeded","allOf":[{"$ref":"#/components/schemas/SwapPriceImpactIssueDto"}]}}},"SwapBalanceIssueDto":{"type":"object","properties":{"token":{"description":"Token the balance check was done for (sellToken)","allOf":[{"$ref":"#/components/schemas/SimpleTokenDto"}]},"actual":{"format":"int64","type":"integer","description":"Actual balance of the taker"},"required":{"format":"int64","type":"integer","description":"Required balance of the taker"}},"required":["token","actual","required"]},"SwapAllowanceIssueDto":{"type":"object","properties":{"token":{"description":"Token the allowance check was done for (sellToken)","allOf":[{"$ref":"#/components/schemas/SimpleTokenDto"}]},"spender":{"type":"string","description":"Token the balance check was done for (sellToken)"},"actual":{"format":"int64","type":"integer","description":"Actual allowance the taker has approved to the spender"},"required":{"format":"int64","type":"integer","description":"Required allowance the taker has to approve to the spender"}},"required":["token","spender","actual","required"]},"SwapPriceImpactIssueDto":{"type":"object","properties":{"sellToken":{"description":"Sell token","allOf":[{"$ref":"#/components/schemas/SimpleTokenDto"}]},"buyToken":{"description":"Buy token","allOf":[{"$ref":"#/components/schemas/SimpleTokenDto"}]},"actual":{"type":"number","description":"Actual price impact in BPS (including slippage)"},"max":{"type":"number","description":"Max requested price impact in BPS"}},"required":["sellToken","buyToken","actual","max"]},"TenderlySimulationDto":{"type":"object","properties":{"status":{"type":"boolean","description":"Simulation status. True if tx simulation succeeded, false otherwise."},"errorMessage":{"type":"string","description":"Error message. Just present if <code>status</code> is <code>false</code>."},"blockNumber":{"type":"number","description":"Block number used for the simulation."},"gas":{"format":"int64","type":"integer","description":"Amount of gas provided for the simulation."},"gasUsed":{"format":"int64","type":"integer","description":"Amount of gas used for the simulation."}},"required":["status","errorMessage","blockNumber","gas","gasUsed"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.31third.com/31third-api/swap/quote.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
