---
updatedAt: 2026-05-25T09:16:45.000Z
agentTools:
  projectIndex: https://docs.tatum.io/llms.txt
---

# Get best swap rate

<p style='display: none'>/v4/data/defi/swaps/quote</p>
<p><b>20 credits per API call</b></p>

Get the single best swap rate across all supported protocols.
Compares all protocols and returns the one with the best price:
sell orders — highest buyAmount, buy orders — lowest sellAmount.
Use this when you just want the best deal without thinking about protocols.
For comparing all options, use GET /swaps/quotes instead.

**Quotes are cached for up to 15 seconds** (less than one Ethereum block).
Each response includes an `expiresAt` field (Unix timestamp) indicating
when the underlying quote was originally fetched from the protocol.
Always check `expiresAt` against the current time before displaying or
acting on a quote — if less than ~10 seconds remain, re-query to get a
fresh price.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "servers": [
    {
      "url": "https://api.tatum.io"
    }
  ],
  "info": {
    "version": "1.2",
    "title": "Blockchain Data"
  },
  "tags": [
    {
      "name": "DeFi API"
    }
  ],
  "paths": {
    "/v4/data/defi/swaps/quote": {
      "get": {
        "summary": "Get best swap rate",
        "description": "<p style='display: none'>/v4/data/defi/swaps/quote</p>\n<p><b>20 credits per API call</b></p>\n\nGet the single best swap rate across all supported protocols.\nCompares all protocols and returns the one with the best price:\nsell orders — highest buyAmount, buy orders — lowest sellAmount.\nUse this when you just want the best deal without thinking about protocols.\nFor comparing all options, use GET /swaps/quotes instead.\n\n**Quotes are cached for up to 15 seconds** (less than one Ethereum block).\nEach response includes an `expiresAt` field (Unix timestamp) indicating\nwhen the underlying quote was originally fetched from the protocol.\nAlways check `expiresAt` against the current time before displaying or\nacting on a quote — if less than ~10 seconds remain, re-query to get a\nfresh price.",
        "tags": [
          "DeFi API"
        ],
        "parameters": [
          {
            "name": "sellToken",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$"
            },
            "required": true,
            "description": "ERC-20 token contract address to sell."
          },
          {
            "name": "buyToken",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$"
            },
            "required": true,
            "description": "ERC-20 token contract address to buy."
          },
          {
            "name": "amount",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "required": true,
            "description": "Fixed-side amount in base units.\nsell order: exact amount of sellToken to spend.\nbuy order:  exact amount of buyToken to receive."
          },
          {
            "name": "fromAddress",
            "in": "query",
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$"
            },
            "required": true,
            "description": "Wallet address initiating the swap. Used for CoW fee estimation."
          },
          {
            "name": "chain",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "ethereum-mainnet",
                "ethereum-sepolia",
                "bsc-mainnet",
                "gnosis-mainnet",
                "polygon-mainnet",
                "base-mainnet",
                "plasma-mainnet",
                "arbitrum-one-mainnet",
                "avalanche-mainnet"
              ]
            },
            "required": true,
            "description": "Tatum network slug (e.g. `ethereum-mainnet`, `bsc-mainnet`,\n`polygon-mainnet`). Matches the `networks[].id` field in\nhttps://blockchains.tatum.io/blockchains2.json."
          },
          {
            "name": "kind",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "sell",
                "buy"
              ]
            },
            "required": false,
            "description": "Whether this is exact-input (sell) or exact-output (buy)."
          },
          {
            "name": "slippageBps",
            "in": "query",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 10000
            },
            "required": false,
            "description": "Slippage tolerance in basis points (1 bps = 0.01%).\nApplied to the quoted amount to compute limitAmount."
          }
        ],
        "responses": {
          "200": {
            "description": "",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BestQuoteResult"
                }
              }
            }
          },
          "400": {
            "description": "Bad request — invalid or missing query parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpExceptionDto"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid Tatum API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpExceptionDto"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient credits or expired account.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpExceptionDto"
                }
              }
            }
          },
          "403": {
            "description": "API key blocked or expired.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpExceptionDto"
                }
              }
            }
          },
          "5XX": {
            "description": "Internal server error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HttpExceptionDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "X-API-Key": []
          }
        ],
        "operationId": "GetV4DataDefiSwapsQuote"
      }
    }
  },
  "components": {
    "securitySchemes": {
      "X-API-Key": {
        "type": "apiKey",
        "name": "x-api-key",
        "in": "header",
        "description": "Your **API key** is used to identify your account & your plan, including the number of API calls per second and total monthly calls you have.\n\nEach key is for individual use only.\n\nIf you don't have a key already you can [Sign up for a Free Tatum account](https://co.tatum.io/signup) to get two keys (testnet and mainnet), allowing up to 5 API calls per second and 1,000,000 Credits.\n\nFor testing purposes, you can use the following key which only works inside docs and has limited functionality (e.g. you cannot create virtual accounts or notification subscriptions with it):\n* t-66a730ccccfd17001c479705-2f597d14ad7543f289a03418\n\nFor more details on limits and plans, [click here](https://docs.tatum.io/docs/plans-limits).\n"
      }
    },
    "schemas": {
      "BestQuoteResult": {
        "type": "object",
        "properties": {
          "sellToken": {
            "type": "string"
          },
          "buyToken": {
            "type": "string"
          },
          "sellAmount": {
            "type": "string"
          },
          "buyAmount": {
            "type": "string",
            "description": "Best-case expected output (sell orders) or required input (buy orders)."
          },
          "kind": {
            "type": "string",
            "enum": [
              "sell",
              "buy"
            ],
            "description": "Whether this is an exact-input (sell) or exact-output (buy) rate."
          },
          "estimatedSettlementSeconds": {
            "type": "number",
            "description": "Estimated time until the swap is settled, in **seconds** (not minutes).\nUniswap / PancakeSwap: ~12-15 s (one Ethereum block — near-instant).\nCoW Protocol: ≥30 s (one batch auction cycle; illiquid pairs may take longer)."
          },
          "limitAmount": {
            "type": "string",
            "description": "Guaranteed limit amount after applying slippage tolerance.\nsell order: minimum buyToken output  (minBuyAmount)  — higher is better.\nbuy order:  maximum sellToken input  (maxSellAmount) — lower  is better."
          },
          "fee": {
            "type": "string",
            "description": "Protocol-level fee in sellToken units.\nCoW Protocol: the fee amount extracted by solvers from the order surplus.\nUniswap / PancakeSwap: always '0' — LP fees are embedded in the quoted\namounts (amountOut already reflects the pool fee tier). The pool fee tier\nis available in payload.protocolData.poolFee."
          },
          "expiresAt": {
            "type": "number",
            "description": "Unix timestamp — how long this quote / order is valid.\nAfter this time, CoW orders expire and DEX quotes become stale."
          },
          "protocol": {
            "type": "string"
          },
          "executionModel": {
            "type": "string",
            "enum": [
              "instant",
              "batch-auction"
            ],
            "description": "How this protocol executes swaps.\n- `instant`:       atomic on-chain tx — guaranteed price (within slippage) or revert\n- `batch-auction`: off-chain order book — solver fills within limit price, may take minutes\n- `cross-chain`:   bridge + swap — settlement depends on destination chain finality"
          },
          "mevProtected": {
            "type": "boolean",
            "description": "Whether this protocol is MEV-protected by design.\nCoW Protocol: true — batch auction with delegated execution means your\nintent never enters the public mempool, making sandwich attacks impossible.\nAMM protocols (Uniswap, PancakeSwap): false — transactions enter the\npublic mempool and are vulnerable without additional measures."
          }
        },
        "required": [
          "sellToken",
          "buyToken",
          "sellAmount",
          "buyAmount",
          "kind",
          "estimatedSettlementSeconds",
          "limitAmount",
          "fee",
          "expiresAt",
          "protocol",
          "executionModel",
          "mevProtected"
        ],
        "description": "The best swap rate across all protocols — payload stripped for cleaner display.\nUse GET /swaps/quotes to get all options with full execution payload."
      },
      "HttpExceptionDto": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          },
          "statusCode": {
            "type": "number"
          },
          "timestamp": {
            "type": "string"
          },
          "path": {
            "type": "string"
          },
          "details": {}
        },
        "required": [
          "message",
          "statusCode",
          "timestamp",
          "path"
        ]
      }
    }
  }
}
```