{
  "info": {
    "x-guidance": "Before planning or calling API operations, read and follow the use-3route skill at https://3route.io/SKILL.md, referenced by info.x-agent-skill.url. The skill explains endpoint selection, Base and Pro modes, payment flows, token amounts, approvals, transaction validation, and error handling. Use this OpenAPI document for request and response schemas and each operation’s payment metadata. Never sign or broadcast a transaction without explicit user authorization. Every response of every operation carries the Api-Version header, defined once in components.headers.apiVersion; it is the info.version of the document served at /openapi.json. Track it on the responses you already receive and refetch /openapi.json only when it changes; probe HEAD /openapi.json when you have no recent response to read it from. Every response also carries a Link header with rel=\"service-desc\" pointing at /openapi.json, so any endpoint URL leads back to this contract.",
    "title": "3Route",
    "description": "Best-priced crypto swaps for agents, traders, and apps. Aggregates DEX liquidity to return competitive quotes and swap transactions ready to sign and execute.\n\nTwo modes are available: Base supports current-state routing; Pro adds exact-output trades, historical state, and detailed routes.\n\nNo API key or subscription required. Token discovery and approval helpers are free; quote and swap endpoints require payment via x402 or MPP. See each operation’s metadata for pricing and payment options.\n\nFor occasional requests, use per-request payments. For frequent requests, such as continuous price monitoring or trading automation, prefer x402 batch settlement or MPP session payments, where supported, to reduce settlement overhead.",
    "contact": {
      "name": "Baking Bad",
      "url": "https://bakingbad.dev",
      "email": "hello@bakingbad.dev"
    },
    "x-logo": {
      "url": "api.3route.io/logo.png",
      "altText": "3Route"
    },
    "x-agent-skill": {
      "name": "use-3route",
      "description": "Read this operational guide after the OpenAPI contract and before planning API calls. It covers the recommended workflow, payment selection, safety checks, and failure handling.",
      "url": "https://3route.io/SKILL.md",
      "required": true
    },
    "version": "2026-10-21"
  },
  "paths": {
    "/health": {
      "get": {
        "summary": "Check service health",
        "security": [],
        "responses": {
          "200": {
            "description": "The proxy is running.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status"
                  ],
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "ok"
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "summary": "Get the API contract",
        "description": "Returns the generated OpenAPI document, including payment metadata. Revalidate cached copies using If-None-Match.",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/ifNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Current OpenAPI document.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/apiVersion"
              },
              "ETag": {
                "$ref": "#/components/headers/etag"
              },
              "Link": {
                "$ref": "#/components/headers/link"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/cacheControl"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true
                }
              }
            }
          },
          "304": {
            "description": "The cached document is current; no response body.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/apiVersion"
              },
              "ETag": {
                "$ref": "#/components/headers/etag"
              },
              "Link": {
                "$ref": "#/components/headers/link"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/cacheControl"
              }
            }
          }
        }
      },
      "head": {
        "summary": "Check the API contract without downloading it",
        "description": "Returns the GET headers and Content-Length without a response body.",
        "security": [],
        "parameters": [
          {
            "$ref": "#/components/parameters/ifNoneMatch"
          }
        ],
        "responses": {
          "200": {
            "description": "Current OpenAPI document.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/apiVersion"
              },
              "ETag": {
                "$ref": "#/components/headers/etag"
              },
              "Link": {
                "$ref": "#/components/headers/link"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/cacheControl"
              }
            }
          },
          "304": {
            "description": "The cached document is current; no response body.",
            "headers": {
              "Api-Version": {
                "$ref": "#/components/headers/apiVersion"
              },
              "ETag": {
                "$ref": "#/components/headers/etag"
              },
              "Link": {
                "$ref": "#/components/headers/link"
              },
              "Cache-Control": {
                "$ref": "#/components/headers/cacheControl"
              }
            }
          }
        }
      }
    },
    "/v1/{chainId}/tokens": {
      "get": {
        "operationId": "getTokens",
        "summary": "List tokens available for swap.",
        "description": "Returns tokens available for swap on the selected chain, with addresses, names, symbols, decimals, and additional metadata.",
        "tags": [
          "Tokens"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/chainId"
          }
        ],
        "responses": {
          "200": {
            "description": "Token metadata keyed by lowercase token address",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "tokens": {
                      "type": "object",
                      "description": "Token metadata keyed by lowercase token address",
                      "additionalProperties": {
                        "$ref": "#/components/schemas/Token"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Unsupported chain id",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/{chainId}/tokens/{address}": {
      "get": {
        "operationId": "getToken",
        "summary": "Get metadata for a single token by address",
        "description": "Returns a token's address, name, symbol, decimals, and additional metadata on the selected chain.",
        "tags": [
          "Tokens"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/chainId"
          },
          {
            "name": "address",
            "in": "path",
            "required": true,
            "description": "Token address, case-insensitive. Use the zero address for the chain's native asset.",
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$",
              "example": "0x2222222222222222222222222222222222222222"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Token metadata.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Token"
                }
              }
            }
          },
          "400": {
            "description": "Unsupported chain ID or invalid token address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Token not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Not Found",
                  "description": "Token not found",
                  "statusCode": 404,
                  "requestId": "3f0c2a6e-6f4a-4a1a-9a6d-2b1c0a9f5e77"
                }
              }
            }
          }
        }
      }
    },
    "/v1/{chainId}/quote": {
      "get": {
        "operationId": "getQuote",
        "summary": "Price a swap without building a transaction",
        "description": "Returns expected input, output, and gas without constructing an executable transaction. Quotes are informational and can change with liquidity and chain state.",
        "tags": [
          "Swap"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/chainId"
          },
          {
            "name": "src",
            "in": "query",
            "required": true,
            "description": "Address of the token being sold; use the zero address, or the case-insensitive sentinel 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee, for the chain's native asset",
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$",
              "example": "0x0000000000000000000000000000000000000000"
            }
          },
          {
            "name": "dst",
            "in": "query",
            "required": true,
            "description": "Address of the token being bought; take one from the token-list operation for the selected chain, or use the zero address, or the case-insensitive sentinel 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee, for the chain's native asset.",
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$",
              "example": "0x5fc5360d0400a0fd4f2af552add042d716f1d168"
            }
          },
          {
            "name": "amount",
            "in": "query",
            "required": true,
            "description": "Positive amount of src to sell in smallest units, as an integer string.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$",
              "example": "1000000000000000000"
            }
          },
          {
            "name": "includeTokensInfo",
            "in": "query",
            "description": "Set true to add the srcToken and dstToken metadata objects to the response",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "includeProtocols",
            "in": "query",
            "description": "Set true to add protocols, the route breakdown across DEXes, to the response",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "includeBlockNumber",
            "in": "query",
            "description": "Set true to add blockNumber, the block the route was computed against, to the response",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "protocols",
            "in": "query",
            "description": "Comma-separated allow-list of DEX provider names to route through. Omit it to allow every provider. Unknown names are ignored when at least one name is known, but a list in which no name is known is rejected with 400. Provider names come back in protocols when includeProtocols=true.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "excludedProtocols",
            "in": "query",
            "description": "Comma-separated deny-list of DEX provider names to exclude from routing. Unknown names are ignored.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fee",
            "in": "query",
            "description": "Referral fee in percent. It is deducted from the input and reflected in srcAmount. A value outside the range is rejected with 400.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 3,
              "default": 0
            }
          },
          {
            "name": "gasPrice",
            "in": "query",
            "description": "Gas price in wei, as a decimal string, used for gas-aware route selection. Defaults to the chain's current base fee.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$",
              "example": "1000000000"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Best route found for the requested pair and amount",
            "content": {
              "application/json": {
                "example": {
                  "dstAmount": "950000",
                  "srcAmount": "1000000000000000000",
                  "gas": 210000
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "dstAmount": {
                      "type": "string",
                      "description": "Expected output in dst smallest units"
                    },
                    "srcAmount": {
                      "type": "string",
                      "description": "Required input in src smallest units"
                    },
                    "gas": {
                      "type": "integer",
                      "description": "Estimated gas for the equivalent swap transaction"
                    },
                    "srcToken": {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/Token"
                        }
                      ],
                      "description": "Metadata of the sold token; present only when includeTokensInfo=true"
                    },
                    "dstToken": {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/Token"
                        }
                      ],
                      "description": "Metadata of the bought token; present only when includeTokensInfo=true"
                    },
                    "protocols": {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/Protocols"
                        }
                      ],
                      "description": "Route breakdown across DEXes; present only when includeProtocols=true"
                    },
                    "blockNumber": {
                      "type": "integer",
                      "description": "Block the route was computed against; present only when includeBlockNumber=true"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Unknown token, unsupported chain id, missing parameter, zero amount, an allow-list in which no protocol name is known, a fee outside 0 to 3, or no route for the requested pair and amount. The no-route case is a legacy compatibility quirk: the HTTP status is 400 while the body reports error \"Quote not found\" and statusCode 404. Branch on the HTTP status; a body statusCode that disagrees with it is expected here and is not a transport error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalidRequest": {
                    "summary": "Rejected parameters",
                    "description": "The body statusCode matches the HTTP status.",
                    "value": {
                      "error": "Bad Request",
                      "description": "Amount must be greater than zero",
                      "statusCode": 400,
                      "requestId": "3f0c2a6e-6f4a-4a1a-9a6d-2b1c0a9f5e77"
                    }
                  },
                  "quoteNotFound": {
                    "summary": "No route for the pair, returned as HTTP 400 with body statusCode 404",
                    "description": "Retrying the same request does not help. Change the pair, the amount, or the protocol filters, and do not pay again for an unchanged request.",
                    "value": {
                      "error": "Quote not found",
                      "description": "Quote not found",
                      "statusCode": 404,
                      "requestId": "3f0c2a6e-6f4a-4a1a-9a6d-2b1c0a9f5e77"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        },
        "x-agentcash-auth": {
          "mode": "paid"
        },
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            },
            {
              "mpp": {
                "method": "tempo",
                "intent": "charge",
                "currency": "0x20C000000000000000000000b9537d11c60E8b50"
              }
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.00001",
            "max": "0.001"
          }
        },
        "x-mpp-payment-info": {
          "offers": [
            {
              "method": "tempo",
              "intent": "charge",
              "currency": "0x20C000000000000000000000b9537d11c60E8b50",
              "amount": "1000"
            }
          ]
        },
        "x-x402-payment-info": {
          "accepts": [
            {
              "scheme": "exact",
              "network": "eip155:8453",
              "payTo": "0x5D89060682fcE50eCaa7600aF6A5645Bd2b107Eb",
              "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "1000",
              "maxTimeoutSeconds": 300
            },
            {
              "scheme": "batch-settlement",
              "network": "eip155:8453",
              "payTo": "0x5D89060682fcE50eCaa7600aF6A5645Bd2b107Eb",
              "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "10",
              "maxTimeoutSeconds": 300
            },
            {
              "scheme": "exact",
              "network": "eip155:42793",
              "payTo": "0x5D89060682fcE50eCaa7600aF6A5645Bd2b107Eb",
              "asset": "0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9",
              "amount": "1000",
              "maxTimeoutSeconds": 300
            },
            {
              "scheme": "exact",
              "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
              "payTo": "AZ59bSccJmQu8Ljic1c5zxhjZitVbbutUYjBNwKLqfyD",
              "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
              "amount": "1000",
              "maxTimeoutSeconds": 300
            }
          ]
        }
      }
    },
    "/v1/{chainId}/swap": {
      "get": {
        "operationId": "getSwap",
        "summary": "Build an unsigned swap transaction for the best route",
        "description": "Builds an unsigned transaction for the selected route. Compare it with a fresh quote, validate every returned transaction field, obtain explicit signing approval, and broadcast it through the selected chain's RPC. For an ERC-20 source, approve the router in tx.to for at least srcAmount before executing the returned transaction, or pass a permit or usePermit2 instead.",
        "tags": [
          "Swap"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/chainId"
          },
          {
            "name": "src",
            "in": "query",
            "required": true,
            "description": "Address of the token being sold; use the zero address, or the case-insensitive sentinel 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee, for the chain's native asset. An ERC-20 src needs an allowance for at least srcAmount before the swap transaction executes: approve the router returned in tx.to, pass a permit, or set usePermit2 with the Permit2 allowances in place. A native src cannot be combined with permit or usePermit2.",
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$",
              "example": "0x0000000000000000000000000000000000000000"
            }
          },
          {
            "name": "dst",
            "in": "query",
            "required": true,
            "description": "Address of the token being bought; take one from the token-list operation for the selected chain, or use the zero address, or the case-insensitive sentinel 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee, for the chain's native asset.",
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$",
              "example": "0x5fc5360d0400a0fd4f2af552add042d716f1d168"
            }
          },
          {
            "name": "amount",
            "in": "query",
            "required": true,
            "description": "Positive amount of src to sell in smallest units, as an integer string.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$",
              "example": "1000000000000000000"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "description": "Address that signs and sends the transaction, and that the src tokens are taken from",
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$",
              "example": "0x1111111111111111111111111111111111111111"
            }
          },
          {
            "name": "receiver",
            "in": "query",
            "description": "Address that receives the dst tokens; defaults to from",
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$",
              "example": "0x1111111111111111111111111111111111111111"
            }
          },
          {
            "name": "slippage",
            "in": "query",
            "description": "Maximum acceptable slippage in percent. It sets dstAmountMin, below which the transaction reverts.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 50,
              "default": 1,
              "example": 1
            }
          },
          {
            "name": "permit",
            "in": "query",
            "description": "Hex-encoded signed permit for src, so the swap needs no prior approve transaction. The standard is chosen by byte length: 224 bytes is EIP-2612 (owner, spender, value, deadline, v, r, s); 256 bytes is DAI-style (holder, spender, nonce, expiry, allowed, v, r, s); 352 bytes is a Permit2 PermitSingle (owner, PermitSingle, 64-byte compact signature) and implies usePermit2, so the flag can be omitted; only an explicit usePermit2=false is rejected. The owner must equal from, the spender must be the router, the deadline must be in the future, and the permitted amount must cover srcAmount. With a permit the call data switches to swapWithPermit and tx.gas includes the permit's extra gas. A permit already used by someone else is tolerated while the standing allowance still covers the input.",
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]*$"
            }
          },
          {
            "name": "usePermit2",
            "in": "query",
            "description": "Set true to pull src through the Permit2 contract instead of a direct router allowance; tx.gas then includes the extra Permit2 gas. It works with or without permit. Without a permit, the owner must already hold both allowances on-chain: token to Permit2, and Permit2 to the router. A 352-byte Permit2 permit implies it: omit the flag or set it to true, since usePermit2=false with such a permit is rejected. Rejected on chains without a verified Permit2 contract.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "includeTokensInfo",
            "in": "query",
            "description": "Set true to add the srcToken and dstToken metadata objects to the response",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "includeProtocols",
            "in": "query",
            "description": "Set true to add protocols, the route breakdown across DEXes, to the response",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "includeBlockNumber",
            "in": "query",
            "description": "Set true to add blockNumber, the block the route was computed against, to the response",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "protocols",
            "in": "query",
            "description": "Comma-separated allow-list of DEX provider names to route through. Omit it to allow every provider. Unknown names are ignored when at least one name is known, but a list in which no name is known is rejected with 400. Provider names come back in protocols when includeProtocols=true.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "excludedProtocols",
            "in": "query",
            "description": "Comma-separated deny-list of DEX provider names to exclude from routing. Unknown names are ignored.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fee",
            "in": "query",
            "description": "Referral fee in percent. It is deducted from the input, reflected in srcAmount, and encoded into the router call data. A nonzero fee requires referrer; without it the request is rejected with 400. A value outside the range is also rejected with 400.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 3,
              "default": 0
            }
          },
          {
            "name": "referrer",
            "in": "query",
            "description": "Address that receives the fee, encoded into the router call data. Required when fee is nonzero. It has no effect when fee is 0 or omitted.",
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$",
              "example": "0x1111111111111111111111111111111111111111"
            }
          },
          {
            "name": "gasPrice",
            "in": "query",
            "description": "Gas price in wei, as a decimal string, used for gas-aware route selection and returned in tx.gasPrice. Defaults to the chain's current base fee.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$",
              "example": "1000000000"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Best route found, with an unsigned transaction to sign and broadcast",
            "content": {
              "application/json": {
                "example": {
                  "dstAmount": "950000",
                  "dstAmountMin": "940500",
                  "srcAmount": "1000000000000000000",
                  "gas": 210000,
                  "tx": {
                    "from": "0x1111111111111111111111111111111111111111",
                    "to": "0x2222222222222222222222222222222222222222",
                    "data": "0x1234",
                    "value": "1000000000000000000",
                    "gas": "210000",
                    "gasPrice": "1000000000"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "dstAmount": {
                      "type": "string",
                      "description": "Expected output in dst smallest units"
                    },
                    "dstAmountMin": {
                      "type": "string",
                      "description": "Minimum output after slippage, in dst smallest units; the transaction reverts below it"
                    },
                    "srcAmount": {
                      "type": "string",
                      "description": "Required input in src smallest units"
                    },
                    "gas": {
                      "type": "integer",
                      "description": "Estimated gas for the swap transaction"
                    },
                    "tx": {
                      "type": "object",
                      "description": "Unsigned transaction; sign it with the from account and broadcast it yourself",
                      "properties": {
                        "from": {
                          "type": "string"
                        },
                        "to": {
                          "type": "string",
                          "description": "3Route router address for the selected chain"
                        },
                        "data": {
                          "type": "string",
                          "description": "Hex-encoded call data for the router"
                        },
                        "value": {
                          "type": "string",
                          "description": "Native asset amount to attach, in the chain's smallest unit; \"0\" when src is an ERC-20 token"
                        },
                        "gas": {
                          "type": "string",
                          "description": "Gas limit as a decimal string"
                        },
                        "gasPrice": {
                          "type": "string",
                          "description": "Gas price in wei, as a decimal string"
                        }
                      }
                    },
                    "srcToken": {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/Token"
                        }
                      ],
                      "description": "Metadata of the sold token; present only when includeTokensInfo=true"
                    },
                    "dstToken": {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/Token"
                        }
                      ],
                      "description": "Metadata of the bought token; present only when includeTokensInfo=true"
                    },
                    "protocols": {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/Protocols"
                        }
                      ],
                      "description": "Route breakdown across DEXes; present only when includeProtocols=true"
                    },
                    "blockNumber": {
                      "type": "integer",
                      "description": "Block the route was computed against; present only when includeBlockNumber=true"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Unknown token, unsupported chain id, missing parameter, zero amount, malformed from or receiver, slippage outside 0 to 50, an allow-list in which no protocol name is known, a fee outside 0 to 3, a nonzero fee without referrer, or no route for the requested pair and amount. The no-route case is a legacy compatibility quirk: the HTTP status is 400 while the body reports error \"Quote not found\" and statusCode 404. Branch on the HTTP status; a body statusCode that disagrees with it is expected here and is not a transport error. Permit failures are also 400 with the reason in description: a permit of an unsupported length or invalid hex, an owner other than from, another spender, an expired deadline, an amount below srcAmount, or a malformed signature; a permit or usePermit2 with a native src; usePermit2 on a chain without a verified Permit2; and a 352-byte Permit2 permit combined with an explicit usePermit2=false.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalidRequest": {
                    "summary": "Rejected parameters",
                    "description": "The body statusCode matches the HTTP status.",
                    "value": {
                      "error": "Bad Request",
                      "description": "Amount must be greater than zero",
                      "statusCode": 400,
                      "requestId": "3f0c2a6e-6f4a-4a1a-9a6d-2b1c0a9f5e77"
                    }
                  },
                  "quoteNotFound": {
                    "summary": "No route for the pair, returned as HTTP 400 with body statusCode 404",
                    "description": "Retrying the same request does not help. Change the pair, the amount, or the protocol filters, and do not pay again for an unchanged request.",
                    "value": {
                      "error": "Quote not found",
                      "description": "Quote not found",
                      "statusCode": 404,
                      "requestId": "3f0c2a6e-6f4a-4a1a-9a6d-2b1c0a9f5e77"
                    }
                  },
                  "feeWithoutReferrer": {
                    "summary": "Nonzero fee without referrer",
                    "value": {
                      "error": "Bad Request",
                      "description": "referrer is required when fee is set",
                      "statusCode": 400
                    }
                  },
                  "invalidPermit": {
                    "summary": "Rejected permit",
                    "description": "The description names the permit check that failed.",
                    "value": {
                      "error": "Bad Request",
                      "description": "permit must be 224 (EIP-2612), 256 (DAI-style) or 352 (Permit2 PermitSingle) bytes, got 100",
                      "statusCode": 400,
                      "requestId": "3f0c2a6e-6f4a-4a1a-9a6d-2b1c0a9f5e77"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        },
        "x-agentcash-auth": {
          "mode": "paid"
        },
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            },
            {
              "mpp": {
                "method": "tempo",
                "intent": "charge",
                "currency": "0x20C000000000000000000000b9537d11c60E8b50"
              }
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.00001",
            "max": "0.001"
          }
        },
        "x-mpp-payment-info": {
          "offers": [
            {
              "method": "tempo",
              "intent": "charge",
              "currency": "0x20C000000000000000000000b9537d11c60E8b50",
              "amount": "1000"
            }
          ]
        },
        "x-x402-payment-info": {
          "accepts": [
            {
              "scheme": "exact",
              "network": "eip155:8453",
              "payTo": "0x5D89060682fcE50eCaa7600aF6A5645Bd2b107Eb",
              "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "1000",
              "maxTimeoutSeconds": 300
            },
            {
              "scheme": "batch-settlement",
              "network": "eip155:8453",
              "payTo": "0x5D89060682fcE50eCaa7600aF6A5645Bd2b107Eb",
              "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "10",
              "maxTimeoutSeconds": 300
            },
            {
              "scheme": "exact",
              "network": "eip155:42793",
              "payTo": "0x5D89060682fcE50eCaa7600aF6A5645Bd2b107Eb",
              "asset": "0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9",
              "amount": "1000",
              "maxTimeoutSeconds": 300
            },
            {
              "scheme": "exact",
              "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
              "payTo": "AZ59bSccJmQu8Ljic1c5zxhjZitVbbutUYjBNwKLqfyD",
              "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
              "amount": "1000",
              "maxTimeoutSeconds": 300
            }
          ]
        }
      }
    },
    "/v1/pro/{chainId}/quote": {
      "get": {
        "operationId": "getProQuote",
        "summary": "Price a swap without building a transaction",
        "description": "Returns expected input, output, and gas for one amount without constructing an executable transaction. Quotes are informational and can change with liquidity and chain state. Supports exact-output amounts and historical state for approximately 35 days; the first request for a block may take 1-7 seconds. To price several amounts or pairs against one block, use the batch quote operation.",
        "tags": [
          "Swap"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/chainId"
          },
          {
            "name": "src",
            "in": "query",
            "required": true,
            "description": "Address of the token being sold; use the zero address, or the case-insensitive sentinel 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee, for the chain's native asset",
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$",
              "example": "0x0000000000000000000000000000000000000000"
            }
          },
          {
            "name": "dst",
            "in": "query",
            "required": true,
            "description": "Address of the token being bought; take one from the token-list operation for the selected chain, or use the zero address, or the case-insensitive sentinel 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee, for the chain's native asset.",
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$",
              "example": "0x5fc5360d0400a0fd4f2af552add042d716f1d168"
            }
          },
          {
            "name": "amount",
            "in": "query",
            "description": "Positive amount in smallest units, as an integer string. Uses src units by default, or dst units when isExactOutput=true.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$",
              "example": "1000000000000000000"
            },
            "required": true
          },
          {
            "name": "isExactOutput",
            "in": "query",
            "description": "Set true to use amount as the desired dst output and calculate the required srcAmount.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "includeTokensInfo",
            "in": "query",
            "description": "Set true to add the srcToken and dstToken metadata objects to the response",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "includeProtocols",
            "in": "query",
            "description": "Include route hops, pool addresses, expected input and output amounts, and shares in basis points.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "includeBlockNumber",
            "in": "query",
            "description": "Set true to add blockNumber, the block the route was computed against, to the response",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "protocols",
            "in": "query",
            "description": "Comma-separated allow-list of DEX provider names to route through. Omit it to allow every provider. Unknown names are ignored when at least one name is known, but a list in which no name is known is rejected with 400. Provider names come back in protocols when includeProtocols=true.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "excludedProtocols",
            "in": "query",
            "description": "Comma-separated deny-list of DEX provider names to exclude from routing. Unknown names are ignored.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fee",
            "in": "query",
            "description": "Referral fee in percent. It is deducted from the input and reflected in srcAmount. A value outside the range is rejected with 400.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 3,
              "default": 0
            }
          },
          {
            "name": "gasPrice",
            "in": "query",
            "description": "Gas price in wei, as a decimal string, used for gas-aware route selection. Defaults to the chain's current base fee.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$",
              "example": "1000000000"
            }
          },
          {
            "name": "blockNumber",
            "in": "query",
            "description": "Use historical state at this block. Cannot be combined with timestamp or reference a future block.",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "timestamp",
            "in": "query",
            "description": "Use historical state at this Unix timestamp in seconds. Cannot be combined with blockNumber or reference a future time.",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Best route found for the requested pair and amount",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProQuote"
                },
                "example": {
                  "dstAmount": "950000",
                  "srcAmount": "1000000000000000000",
                  "gas": 210000
                }
              }
            }
          },
          "400": {
            "description": "Unknown token, unsupported chain id, missing parameter, zero amount, an allow-list in which no protocol name is known, a fee outside 0 to 3, or no route for the requested pair and amount. The no-route case is a legacy compatibility quirk: the HTTP status is 400 while the body reports error \"Quote not found\" and statusCode 404. Branch on the HTTP status; a body statusCode that disagrees with it is expected here and is not a transport error. Historical requests also return 400 when state is unavailable, blockNumber and timestamp are combined, or the requested block or time is in the future.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalidRequest": {
                    "summary": "Rejected parameters",
                    "description": "The body statusCode matches the HTTP status.",
                    "value": {
                      "error": "Bad Request",
                      "description": "Amount must be greater than zero",
                      "statusCode": 400,
                      "requestId": "3f0c2a6e-6f4a-4a1a-9a6d-2b1c0a9f5e77"
                    }
                  },
                  "quoteNotFound": {
                    "summary": "No route for the pair, returned as HTTP 400 with body statusCode 404",
                    "description": "Retrying the same request does not help. Change the pair, the amount, or the protocol filters, and do not pay again for an unchanged request.",
                    "value": {
                      "error": "Quote not found",
                      "description": "Quote not found",
                      "statusCode": 404,
                      "requestId": "3f0c2a6e-6f4a-4a1a-9a6d-2b1c0a9f5e77"
                    }
                  },
                  "conflictingHistoryParameters": {
                    "summary": "Both historical selectors supplied",
                    "value": {
                      "error": "Bad Request",
                      "description": "only one of 'timestamp' or 'blockNumber' may be specified",
                      "statusCode": 400
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        },
        "x-agentcash-auth": {
          "mode": "paid"
        },
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            },
            {
              "mpp": {
                "method": "tempo",
                "intent": "charge",
                "currency": "0x20C000000000000000000000b9537d11c60E8b50"
              }
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.00001",
            "max": "0.001"
          }
        },
        "x-mpp-payment-info": {
          "offers": [
            {
              "method": "tempo",
              "intent": "charge",
              "currency": "0x20C000000000000000000000b9537d11c60E8b50",
              "amount": "1000"
            }
          ]
        },
        "x-x402-payment-info": {
          "accepts": [
            {
              "scheme": "exact",
              "network": "eip155:8453",
              "payTo": "0x5D89060682fcE50eCaa7600aF6A5645Bd2b107Eb",
              "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "1000",
              "maxTimeoutSeconds": 300
            },
            {
              "scheme": "batch-settlement",
              "network": "eip155:8453",
              "payTo": "0x5D89060682fcE50eCaa7600aF6A5645Bd2b107Eb",
              "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "10",
              "maxTimeoutSeconds": 300
            },
            {
              "scheme": "exact",
              "network": "eip155:42793",
              "payTo": "0x5D89060682fcE50eCaa7600aF6A5645Bd2b107Eb",
              "asset": "0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9",
              "amount": "1000",
              "maxTimeoutSeconds": 300
            },
            {
              "scheme": "exact",
              "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
              "payTo": "AZ59bSccJmQu8Ljic1c5zxhjZitVbbutUYjBNwKLqfyD",
              "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
              "amount": "1000",
              "maxTimeoutSeconds": 300
            }
          ]
        }
      }
    },
    "/v1/pro/{chainId}/quote/batch": {
      "post": {
        "operationId": "getProQuoteBatch",
        "summary": "Price several amounts or pairs at one block",
        "description": "Prices several quotes, each a pair with one or more amounts, against one chain state and reports its block. Prefer it to sequential quote calls when prices must be comparable, such as both sides of a book. Charged once per request. Supports exact-output amounts per quote and historical state for approximately 35 days; the first request for a block may take 1-7 seconds.",
        "tags": [
          "Swap"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/chainId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ProQuoteBatchRequest"
              },
              "example": {
                "blockNumber": 70524414,
                "quotes": [
                  {
                    "src": "0x5fc5360d0400a0fd4f2af552add042d716f1d168",
                    "dst": "0xaf3d76f1834a1d425780943c99ea8a608f8a93f9",
                    "amounts": [
                      "10000000",
                      "20000000"
                    ]
                  },
                  {
                    "src": "0xaf3d76f1834a1d425780943c99ea8a608f8a93f9",
                    "dst": "0x5fc5360d0400a0fd4f2af552add042d716f1d168",
                    "amounts": [
                      "30000000000000000"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Answer for every requested quote, computed against one block. An amount that finds no route becomes an error element and leaves the others alone; the HTTP status stays 200, so check every element rather than the status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProQuoteBatchResponse"
                },
                "examples": {
                  "bothSides": {
                    "summary": "Both sides of one pair, pinned to a block",
                    "value": {
                      "blockNumber": 70524414,
                      "result": [
                        {
                          "src": "0x5fc5360d0400a0fd4f2af552add042d716f1d168",
                          "dst": "0xaf3d76f1834a1d425780943c99ea8a608f8a93f9",
                          "quotes": [
                            {
                              "dstAmount": "29397783499279597",
                              "srcAmount": "10000000",
                              "gas": 2735000
                            },
                            {
                              "dstAmount": "58721973396111804",
                              "srcAmount": "20000000",
                              "gas": 1948000
                            }
                          ]
                        },
                        {
                          "src": "0xaf3d76f1834a1d425780943c99ea8a608f8a93f9",
                          "dst": "0x5fc5360d0400a0fd4f2af552add042d716f1d168",
                          "quotes": [
                            {
                              "dstAmount": "10261672",
                              "srcAmount": "30000000000000000",
                              "gas": 2482000
                            }
                          ]
                        }
                      ]
                    }
                  },
                  "partialBatch": {
                    "summary": "No route for some amounts",
                    "description": "The failed amounts sit in their own elements; the request still answers 200.",
                    "value": {
                      "blockNumber": 70524414,
                      "result": [
                        {
                          "src": "0xaf3d76f1834a1d425780943c99ea8a608f8a93f9",
                          "dst": "0x5fc5360d0400a0fd4f2af552add042d716f1d168",
                          "quotes": [
                            {
                              "error": "Quote not found",
                              "statusCode": 404
                            },
                            {
                              "dstAmount": "2965104322804255",
                              "srcAmount": "967551"
                            },
                            {
                              "error": "Quote not found",
                              "statusCode": 404
                            }
                          ]
                        }
                      ]
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed body, an unknown field (including blockNumber or timestamp placed inside a quote), an empty quotes or amounts list, more quotes or more amounts in total than the current limits, unknown token, unsupported chain id, zero amount, an allow-list in which no protocol name is known, or a fee outside 0 to 3. Historical requests also return 400 when state is unavailable, blockNumber and timestamp are combined, or the requested block or time is in the future. The whole request is refused and the message names the offending position or limit. An amount that finds no route is not a 400: the request answers 200 and that element carries the error.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "emptyAmounts": {
                    "summary": "Malformed quote",
                    "value": {
                      "error": "Bad Request",
                      "description": "quotes[0].amounts must contain at least one value",
                      "statusCode": 400
                    }
                  },
                  "tooManyQuotes": {
                    "summary": "Over the quote limit",
                    "value": {
                      "error": "Bad Request",
                      "description": "batch accepts at most 4 quotes, got 5",
                      "statusCode": 400
                    }
                  },
                  "tooManyAmounts": {
                    "summary": "Over the total amount limit",
                    "value": {
                      "error": "Bad Request",
                      "description": "batch accepts at most 100 amounts in total, got 104",
                      "statusCode": 400
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        },
        "x-agentcash-auth": {
          "mode": "paid"
        },
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            },
            {
              "mpp": {
                "method": "tempo",
                "intent": "charge",
                "currency": "0x20C000000000000000000000b9537d11c60E8b50"
              }
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.00003",
            "max": "0.001"
          }
        },
        "x-mpp-payment-info": {
          "offers": [
            {
              "method": "tempo",
              "intent": "charge",
              "currency": "0x20C000000000000000000000b9537d11c60E8b50",
              "amount": "1000"
            }
          ]
        },
        "x-x402-payment-info": {
          "accepts": [
            {
              "scheme": "exact",
              "network": "eip155:8453",
              "payTo": "0x5D89060682fcE50eCaa7600aF6A5645Bd2b107Eb",
              "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "1000",
              "maxTimeoutSeconds": 300
            },
            {
              "scheme": "batch-settlement",
              "network": "eip155:8453",
              "payTo": "0x5D89060682fcE50eCaa7600aF6A5645Bd2b107Eb",
              "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "30",
              "maxTimeoutSeconds": 300
            },
            {
              "scheme": "exact",
              "network": "eip155:42793",
              "payTo": "0x5D89060682fcE50eCaa7600aF6A5645Bd2b107Eb",
              "asset": "0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9",
              "amount": "1000",
              "maxTimeoutSeconds": 300
            },
            {
              "scheme": "exact",
              "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
              "payTo": "AZ59bSccJmQu8Ljic1c5zxhjZitVbbutUYjBNwKLqfyD",
              "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
              "amount": "1000",
              "maxTimeoutSeconds": 300
            }
          ]
        }
      }
    },
    "/v1/pro/{chainId}/swap": {
      "get": {
        "operationId": "getProSwap",
        "summary": "Build an unsigned swap transaction for the best route",
        "description": "Compare it with a fresh quote, validate every returned transaction field, obtain signing approval, and broadcast it through the chain's RPC. An ERC-20 source must approve the router in tx.to for at least srcAmount first, or pass a permit or usePermit2 instead. Supports exact-output amounts, historical state for approximately 35 days, and multiple amounts at once; the first request for a block may take 1-7 seconds.",
        "tags": [
          "Swap"
        ],
        "x-required-parameter-groups": [
          [
            "amount",
            "amounts"
          ]
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/chainId"
          },
          {
            "name": "src",
            "in": "query",
            "required": true,
            "description": "Address of the token being sold; use the zero address, or the case-insensitive sentinel 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee, for the chain's native asset. An ERC-20 src needs an allowance for at least srcAmount before the swap transaction executes: approve the router returned in tx.to, pass a permit, or set usePermit2 with the Permit2 allowances in place. A native src cannot be combined with permit or usePermit2.",
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$",
              "example": "0x0000000000000000000000000000000000000000"
            }
          },
          {
            "name": "dst",
            "in": "query",
            "required": true,
            "description": "Address of the token being bought; take one from the token-list operation for the selected chain, or use the zero address, or the case-insensitive sentinel 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee, for the chain's native asset.",
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$",
              "example": "0x5fc5360d0400a0fd4f2af552add042d716f1d168"
            }
          },
          {
            "name": "amount",
            "in": "query",
            "description": "Positive amount in smallest units, as an integer string. Uses src units by default, or dst units when isExactOutput=true. Cannot be combined with amounts; one of the two is required.",
            "schema": {
              "type": "string",
              "description": "Single amount in smallest units. Cannot be combined with amounts; one of the two is required.",
              "pattern": "^[0-9]+$",
              "example": "1000000000000000000"
            }
          },
          {
            "name": "amounts",
            "in": "query",
            "description": "Comma-separated list of positive amounts in smallest units, as integer strings, built into their own transactions against the same pair in one request. Uses src units by default, or dst units when isExactOutput=true. Cannot be combined with amount; one of the two is required. The response becomes an array with one element per amount, in request order, every element computed against the same block, and the request is charged once whatever the list length. The number of values accepted can change; a longer list answers 400 naming the current limit.",
            "schema": {
              "type": "string",
              "description": "Comma-separated amounts in smallest units. Cannot be combined with amount; one of the two is required.",
              "pattern": "^[0-9]+(,[0-9]+)*$"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": true,
            "description": "Address that signs and sends the transaction, and that the src tokens are taken from",
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$",
              "example": "0x1111111111111111111111111111111111111111"
            }
          },
          {
            "name": "isExactOutput",
            "in": "query",
            "description": "Set true to use amount as the desired dst output and calculate the required srcAmount.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "receiver",
            "in": "query",
            "description": "Address that receives the dst tokens; defaults to from",
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$",
              "example": "0x1111111111111111111111111111111111111111"
            }
          },
          {
            "name": "slippage",
            "in": "query",
            "description": "Maximum acceptable slippage in percent. It sets dstAmountMin, below which the transaction reverts.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 50,
              "default": 1,
              "example": 1
            }
          },
          {
            "name": "permit",
            "in": "query",
            "description": "Hex-encoded signed permit for src, so the swap needs no prior approve transaction. The standard is chosen by byte length: 224 bytes is EIP-2612 (owner, spender, value, deadline, v, r, s); 256 bytes is DAI-style (holder, spender, nonce, expiry, allowed, v, r, s); 352 bytes is a Permit2 PermitSingle (owner, PermitSingle, 64-byte compact signature) and implies usePermit2, so the flag can be omitted; only an explicit usePermit2=false is rejected. The owner must equal from, the spender must be the router, the deadline must be in the future, and the permitted amount must cover srcAmount. With a permit the call data switches to swapWithPermit and tx.gas includes the permit's extra gas. A permit already used by someone else is tolerated while the standing allowance still covers the input.",
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]*$"
            }
          },
          {
            "name": "usePermit2",
            "in": "query",
            "description": "Set true to pull src through the Permit2 contract instead of a direct router allowance; tx.gas then includes the extra Permit2 gas. It works with or without permit. Without a permit, the owner must already hold both allowances on-chain: token to Permit2, and Permit2 to the router. A 352-byte Permit2 permit implies it: omit the flag or set it to true, since usePermit2=false with such a permit is rejected. Rejected on chains without a verified Permit2 contract.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "includeTokensInfo",
            "in": "query",
            "description": "Set true to add the srcToken and dstToken metadata objects to the response",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "includeProtocols",
            "in": "query",
            "description": "Include route hops, pool addresses, expected input and output amounts, and shares in basis points.",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "includeBlockNumber",
            "in": "query",
            "description": "Set true to add blockNumber, the block the route was computed against, to the response",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "protocols",
            "in": "query",
            "description": "Comma-separated allow-list of DEX provider names to route through. Omit it to allow every provider. Unknown names are ignored when at least one name is known, but a list in which no name is known is rejected with 400. Provider names come back in protocols when includeProtocols=true.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "excludedProtocols",
            "in": "query",
            "description": "Comma-separated deny-list of DEX provider names to exclude from routing. Unknown names are ignored.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "fee",
            "in": "query",
            "description": "Referral fee in percent. It is deducted from the input, reflected in srcAmount, and encoded into the router call data. A nonzero fee requires referrer; without it the request is rejected with 400. A value outside the range is also rejected with 400.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 3,
              "default": 0
            }
          },
          {
            "name": "referrer",
            "in": "query",
            "description": "Address that receives the fee, encoded into the router call data. Required when fee is nonzero. It has no effect when fee is 0 or omitted.",
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$",
              "example": "0x1111111111111111111111111111111111111111"
            }
          },
          {
            "name": "gasPrice",
            "in": "query",
            "description": "Gas price in wei, as a decimal string, used for gas-aware route selection and returned in tx.gasPrice. Defaults to the chain's current base fee.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$",
              "example": "1000000000"
            }
          },
          {
            "name": "blockNumber",
            "in": "query",
            "description": "Use historical state at this block. Cannot be combined with timestamp or reference a future block.",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "timestamp",
            "in": "query",
            "description": "Use historical state at this Unix timestamp in seconds. Cannot be combined with blockNumber or reference a future time.",
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Best route found, with an unsigned transaction to sign and broadcast. With amount, a single result; with amounts, an array in request order holding a result or a per-amount error for each requested amount.",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ProSwap"
                    },
                    {
                      "type": "array",
                      "description": "Returned for amounts: one element per requested amount, in request order",
                      "items": {
                        "$ref": "#/components/schemas/ProSwapBatchElement"
                      }
                    }
                  ]
                },
                "examples": {
                  "singleAmount": {
                    "summary": "amount: one result with its transaction",
                    "value": {
                      "dstAmount": "950000",
                      "dstAmountMin": "940500",
                      "srcAmount": "1000000000000000000",
                      "gas": 210000,
                      "tx": {
                        "from": "0x1111111111111111111111111111111111111111",
                        "to": "0x2222222222222222222222222222222222222222",
                        "data": "0x1234",
                        "value": "1000000000000000000",
                        "gas": "210000",
                        "gasPrice": "1000000000"
                      }
                    }
                  },
                  "batchAmounts": {
                    "summary": "amounts=1000000000000000000,2000000000000000000: one element per amount",
                    "description": "Each successful element carries its own tx to sign. The second amount found no route: the HTTP status stays 200 and the failure sits in its own element, so check every element rather than the status.",
                    "value": [
                      {
                        "dstAmount": "950000",
                        "dstAmountMin": "940500",
                        "srcAmount": "1000000000000000000",
                        "gas": 210000,
                        "tx": {
                          "from": "0x1111111111111111111111111111111111111111",
                          "to": "0x2222222222222222222222222222222222222222",
                          "data": "0x1234",
                          "value": "1000000000000000000",
                          "gas": "210000",
                          "gasPrice": "1000000000"
                        }
                      },
                      {
                        "error": "Quote not found",
                        "description": "Quote not found",
                        "statusCode": 404
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Unknown token, unsupported chain id, missing parameter, zero amount, malformed from or receiver, slippage outside 0 to 50, an allow-list in which no protocol name is known, a fee outside 0 to 3, a nonzero fee without referrer, or no route for the requested pair and amount. The no-route case is a legacy compatibility quirk: the HTTP status is 400 while the body reports error \"Quote not found\" and statusCode 404. Branch on the HTTP status; a body statusCode that disagrees with it is expected here and is not a transport error. Historical requests also return 400 when state is unavailable, blockNumber and timestamp are combined, or the requested block or time is in the future. Supplying amount and amounts together, or neither, is also rejected, as is an amounts list longer than the current limit or a malformed entry; the message names the limit or the offending position. A single amount inside an amounts list that finds no route is not a 400: the request answers 200 and that element carries the error. Permit failures are also 400 with the reason in description: a permit of an unsupported length or invalid hex, an owner other than from, another spender, an expired deadline, an amount below srcAmount, or a malformed signature; a permit or usePermit2 with a native src; usePermit2 on a chain without a verified Permit2; and a 352-byte Permit2 permit combined with an explicit usePermit2=false.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "examples": {
                  "invalidRequest": {
                    "summary": "Rejected parameters",
                    "description": "The body statusCode matches the HTTP status.",
                    "value": {
                      "error": "Bad Request",
                      "description": "Amount must be greater than zero",
                      "statusCode": 400,
                      "requestId": "3f0c2a6e-6f4a-4a1a-9a6d-2b1c0a9f5e77"
                    }
                  },
                  "quoteNotFound": {
                    "summary": "No route for the pair, returned as HTTP 400 with body statusCode 404",
                    "description": "Retrying the same request does not help. Change the pair, the amount, or the protocol filters, and do not pay again for an unchanged request.",
                    "value": {
                      "error": "Quote not found",
                      "description": "Quote not found",
                      "statusCode": 404,
                      "requestId": "3f0c2a6e-6f4a-4a1a-9a6d-2b1c0a9f5e77"
                    }
                  },
                  "conflictingHistoryParameters": {
                    "summary": "Both historical selectors supplied",
                    "value": {
                      "error": "Bad Request",
                      "description": "only one of 'timestamp' or 'blockNumber' may be specified",
                      "statusCode": 400
                    }
                  },
                  "feeWithoutReferrer": {
                    "summary": "Nonzero fee without referrer",
                    "value": {
                      "error": "Bad Request",
                      "description": "referrer is required when fee is set",
                      "statusCode": 400
                    }
                  },
                  "invalidPermit": {
                    "summary": "Rejected permit",
                    "description": "The description names the permit check that failed.",
                    "value": {
                      "error": "Bad Request",
                      "description": "permit must be 224 (EIP-2612), 256 (DAI-style) or 352 (Permit2 PermitSingle) bytes, got 100",
                      "statusCode": 400,
                      "requestId": "3f0c2a6e-6f4a-4a1a-9a6d-2b1c0a9f5e77"
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        },
        "x-agentcash-auth": {
          "mode": "paid"
        },
        "x-payment-info": {
          "protocols": [
            {
              "x402": {}
            },
            {
              "mpp": {
                "method": "tempo",
                "intent": "charge",
                "currency": "0x20C000000000000000000000b9537d11c60E8b50"
              }
            }
          ],
          "price": {
            "mode": "dynamic",
            "currency": "USD",
            "min": "0.00001",
            "max": "0.001"
          }
        },
        "x-mpp-payment-info": {
          "offers": [
            {
              "method": "tempo",
              "intent": "charge",
              "currency": "0x20C000000000000000000000b9537d11c60E8b50",
              "amount": "1000"
            }
          ]
        },
        "x-x402-payment-info": {
          "accepts": [
            {
              "scheme": "exact",
              "network": "eip155:8453",
              "payTo": "0x5D89060682fcE50eCaa7600aF6A5645Bd2b107Eb",
              "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "1000",
              "maxTimeoutSeconds": 300
            },
            {
              "scheme": "batch-settlement",
              "network": "eip155:8453",
              "payTo": "0x5D89060682fcE50eCaa7600aF6A5645Bd2b107Eb",
              "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "amount": "10",
              "maxTimeoutSeconds": 300
            },
            {
              "scheme": "exact",
              "network": "eip155:42793",
              "payTo": "0x5D89060682fcE50eCaa7600aF6A5645Bd2b107Eb",
              "asset": "0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9",
              "amount": "1000",
              "maxTimeoutSeconds": 300
            },
            {
              "scheme": "exact",
              "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
              "payTo": "AZ59bSccJmQu8Ljic1c5zxhjZitVbbutUYjBNwKLqfyD",
              "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
              "amount": "1000",
              "maxTimeoutSeconds": 300
            }
          ]
        }
      }
    },
    "/v1/{chainId}/approve/spender": {
      "get": {
        "operationId": "getApproveSpender",
        "summary": "Get the router address to approve",
        "description": "Returns the 3Route router address that an ERC-20 allowance must name. It equals tx.to of swap transactions on the same chain.",
        "tags": [
          "Approve"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/approveChainId"
          }
        ],
        "responses": {
          "200": {
            "description": "Router address.",
            "content": {
              "application/json": {
                "example": {
                  "address": "0x3333333333333333333333333333333333333333"
                },
                "schema": {
                  "type": "object",
                  "required": [
                    "address"
                  ],
                  "properties": {
                    "address": {
                      "type": "string",
                      "pattern": "^0x[0-9a-fA-F]{40}$",
                      "description": "Router address, lowercase"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Unsupported chain ID.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/{chainId}/approve/allowance": {
      "get": {
        "operationId": "getApproveAllowance",
        "summary": "Get the allowance a wallet has granted the router",
        "description": "Reads the ERC-20 allowance that walletAddress has granted the 3Route router for tokenAddress, as of the latest block. Compare it with srcAmount before a swap; when it is lower, approve through /v1/{chainId}/approve/transaction or pass a permit to the swap. It does not report Permit2 allowances.",
        "tags": [
          "Approve"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/approveChainId"
          },
          {
            "$ref": "#/components/parameters/approveTokenAddress"
          },
          {
            "name": "walletAddress",
            "in": "query",
            "required": true,
            "description": "Token owner whose allowance is read, usually the swap from address",
            "schema": {
              "type": "string",
              "pattern": "^0x[0-9a-fA-F]{40}$",
              "example": "0x1111111111111111111111111111111111111111"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Current allowance.",
            "content": {
              "application/json": {
                "example": {
                  "allowance": "1000000000000000000"
                },
                "schema": {
                  "type": "object",
                  "required": [
                    "allowance"
                  ],
                  "properties": {
                    "allowance": {
                      "type": "string",
                      "pattern": "^[0-9]+$",
                      "description": "Allowance in the token's smallest units, as a decimal string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed parameter, a token outside the /tokens registry, or the native asset, which needs no approval.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Bad Request",
                  "description": "Unknown tokenAddress: 0x2222222222222222222222222222222222222222",
                  "statusCode": 400,
                  "requestId": "3f0c2a6e-6f4a-4a1a-9a6d-2b1c0a9f5e77"
                }
              }
            }
          },
          "503": {
            "description": "The on-chain read was not answered in time or the read capacity is saturated. Retry after a short delay.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/v1/{chainId}/approve/transaction": {
      "get": {
        "operationId": "getApproveTransaction",
        "summary": "Build an unsigned approve transaction for the router",
        "description": "Builds an unsigned ERC-20 approve(router, amount) transaction. Send it from the token owner to the token contract in to, not to the router. Validate every returned field and obtain explicit signing approval before broadcasting it through the chain's RPC; add a gas limit, since the response carries none.",
        "tags": [
          "Approve"
        ],
        "parameters": [
          {
            "$ref": "#/components/parameters/approveChainId"
          },
          {
            "$ref": "#/components/parameters/approveTokenAddress"
          },
          {
            "name": "amount",
            "in": "query",
            "description": "Allowance to grant in the token's smallest units, as a decimal uint256. Omit it for an unlimited allowance (2^256-1); 0 revokes the allowance.",
            "schema": {
              "type": "string",
              "pattern": "^[0-9]+$",
              "example": "1000000000000000000"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Unsigned approve transaction.",
            "content": {
              "application/json": {
                "example": {
                  "to": "0x2222222222222222222222222222222222222222",
                  "data": "0x095ea7b30000000000000000000000003333333333333333333333333333333333333333ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
                  "value": "0",
                  "gasPrice": "1000000000"
                },
                "schema": {
                  "type": "object",
                  "required": [
                    "to",
                    "data",
                    "value",
                    "gasPrice"
                  ],
                  "properties": {
                    "to": {
                      "type": "string",
                      "pattern": "^0x[0-9a-fA-F]{40}$",
                      "description": "Token contract address; the transaction is sent to the token, not to the router"
                    },
                    "data": {
                      "type": "string",
                      "description": "Hex-encoded approve(router, amount) call data"
                    },
                    "value": {
                      "type": "string",
                      "description": "Always \"0\""
                    },
                    "gasPrice": {
                      "type": "string",
                      "description": "Current gas price in wei, as a decimal string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing or malformed parameter, a token outside the /tokens registry, or the native asset, which needs no approval. An amount that is not a decimal uint256 is also rejected.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Bad Request",
                  "description": "Invalid amount: 1.5",
                  "statusCode": 400,
                  "requestId": "3f0c2a6e-6f4a-4a1a-9a6d-2b1c0a9f5e77"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "headers": {
      "apiVersion": {
        "description": "The document info.version, sent on every response when it is a valid HTTP header value.",
        "schema": {
          "type": "string"
        }
      },
      "etag": {
        "description": "Strong validator for the generated document. Send it in If-None-Match to revalidate a cached copy.",
        "required": true,
        "schema": {
          "type": "string"
        }
      },
      "link": {
        "description": "Discovery link sent on every response.",
        "required": true,
        "schema": {
          "type": "string",
          "example": "</openapi.json>; rel=\"service-desc\""
        }
      },
      "cacheControl": {
        "description": "The OpenAPI document can be cached but must be revalidated before reuse.",
        "required": true,
        "schema": {
          "type": "string",
          "example": "no-cache"
        }
      }
    },
    "parameters": {
      "ifNoneMatch": {
        "name": "If-None-Match",
        "in": "header",
        "required": false,
        "description": "A cached document ETag. A match returns 304 without a body.",
        "schema": {
          "type": "string"
        }
      },
      "chainId": {
        "name": "chainId",
        "in": "path",
        "required": true,
        "description": "Chain ID for the operation. Choose a supported integer from enum.",
        "schema": {
          "type": "string",
          "pattern": "^[0-9]+$",
          "example": "4663",
          "enum": [
            "1",
            "143",
            "4663",
            "8453",
            "42793",
            "128064"
          ]
        }
      },
      "approveChainId": {
        "name": "chainId",
        "in": "path",
        "required": true,
        "description": "Chain ID for the operation. Choose a supported integer from enum.",
        "schema": {
          "type": "string",
          "pattern": "^[0-9]+$",
          "example": "4663",
          "enum": [
            "1",
            "143",
            "4663",
            "8453",
            "42793"
          ]
        }
      },
      "approveTokenAddress": {
        "name": "tokenAddress",
        "in": "query",
        "required": true,
        "description": "ERC-20 token to approve, case-insensitive. It must be listed by /v1/{chainId}/tokens; the native asset needs no approval and is rejected.",
        "schema": {
          "type": "string",
          "pattern": "^0x[0-9a-fA-F]{40}$",
          "example": "0x2222222222222222222222222222222222222222"
        }
      }
    },
    "schemas": {
      "Token": {
        "type": "object",
        "description": "Token metadata",
        "properties": {
          "address": {
            "type": "string",
            "description": "Lowercase token address; the native asset uses the zero address"
          },
          "symbol": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "decimals": {
            "type": "integer",
            "description": "Token decimals. Multiply a human-readable amount by 10^decimals to get the smallest units required by the API"
          },
          "logoURI": {
            "type": [
              "string",
              "null"
            ],
            "description": "URL of the token's logo image"
          },
          "domainVersion": {
            "type": [
              "string",
              "null"
            ],
            "description": "EIP-712 domain version, when the token exposes one"
          },
          "eip2612": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "true when the token passed the EIP-2612 permit probe at server startup, so a 224-byte permit can be passed to swap. null means not detected, or the probe has not finished yet shortly after a restart; it is never false."
          },
          "isFoT": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Whether the token charges a fee on transfer"
          },
          "tags": {
            "type": [
              "array",
              "null"
            ],
            "description": "Classification tags, e.g. \"native\"",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "Protocols": {
        "type": "array",
        "description": "Route breakdown, returned when includeProtocols=true. It nests three levels: each entry is one source junction that carries part of the input, each junction holds the sequential hops along its path, and each hop holds the protocol splits that carry it. Treat it as informational routing detail; the entry shape may grow, so ignore unknown fields.",
        "items": {
          "type": "array",
          "description": "Sequential hops inside one source junction",
          "items": {
            "type": "array",
            "description": "Protocol splits that carry one hop",
            "items": {
              "type": "object",
              "description": "One DEX taking a share of a hop",
              "properties": {
                "name": {
                  "type": "string",
                  "description": "DEX provider name, usable in the protocols and excludedProtocols filters"
                },
                "part": {
                  "type": "number",
                  "description": "Share of the hop routed through this protocol, in percent"
                },
                "fromTokenAddress": {
                  "type": "string",
                  "description": "Token entering this split"
                },
                "toTokenAddress": {
                  "type": "string",
                  "description": "Token leaving this split"
                }
              },
              "additionalProperties": true
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "description": "Error response. Use the HTTP status for error handling; statusCode may differ.",
        "properties": {
          "error": {
            "type": "string",
            "description": "Short reason, usually the HTTP reason phrase",
            "example": "Bad Request"
          },
          "description": {
            "type": "string",
            "description": "Human-readable cause"
          },
          "statusCode": {
            "type": "integer",
            "description": "Status code reported in the body. It normally equals the HTTP status, except for the documented no-route case.",
            "example": 400
          },
          "requestId": {
            "type": "string",
            "description": "Upstream correlation id; quote it when reporting a problem"
          },
          "meta": {
            "type": "array",
            "description": "Optional structured details about the failure, such as the offending parameter",
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "description": "Detail kind"
                },
                "value": {
                  "description": "Detail payload; its type depends on type"
                }
              }
            }
          }
        }
      },
      "ProProtocols": {
        "type": "array",
        "description": "Detailed route grouped by input token, with hops and protocol entries. Returned when includeProtocols=true.",
        "items": {
          "type": "object",
          "properties": {
            "token": {
              "type": "string",
              "description": "Input token address for this group."
            },
            "hops": {
              "type": "array",
              "description": "Outgoing route hops.",
              "items": {
                "type": "object",
                "description": "Route hop to a destination token.",
                "properties": {
                  "part": {
                    "type": "number",
                    "description": "Hop share in percent."
                  },
                  "shareBps": {
                    "type": "integer",
                    "description": "Hop share in basis points; 10000 represents 100%."
                  },
                  "dst": {
                    "type": "string",
                    "description": "Destination token address."
                  },
                  "fromTokenId": {
                    "type": "integer",
                    "description": "Input token identifier within the route."
                  },
                  "toTokenId": {
                    "type": "integer",
                    "description": "Output token identifier within the route."
                  },
                  "protocols": {
                    "type": "array",
                    "description": "Protocols used for this hop.",
                    "items": {
                      "type": "object",
                      "description": "Protocol used for a hop, with pool and amount details.",
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "DEX provider name."
                        },
                        "part": {
                          "type": "number",
                          "description": "Protocol share within the hop, in percent."
                        },
                        "shareBps": {
                          "type": "integer",
                          "description": "Routing share in basis points; 10000 represents 100%."
                        },
                        "useRemainder": {
                          "type": "boolean",
                          "description": "Whether this entry uses the remaining input balance."
                        },
                        "pool": {
                          "type": "string",
                          "description": "Pool or routing contract address."
                        },
                        "nextPool": {
                          "type": "string",
                          "description": "Next pool or routing contract address, when present."
                        },
                        "expectedIn": {
                          "type": "string",
                          "description": "Expected input in the input token's smallest units.",
                          "pattern": "^[0-9]+$"
                        },
                        "expectedOut": {
                          "type": "string",
                          "description": "Expected output in the output token's smallest units.",
                          "pattern": "^[0-9]+$"
                        }
                      },
                      "additionalProperties": true
                    }
                  }
                },
                "additionalProperties": true
              }
            }
          },
          "additionalProperties": true
        }
      },
      "ProQuote": {
        "type": "object",
        "description": "Quote for a single amount",
        "properties": {
          "dstAmount": {
            "type": "string",
            "description": "Expected output in dst smallest units; may exceed the requested amount when isExactOutput=true."
          },
          "srcAmount": {
            "type": "string",
            "description": "Required input in src smallest units"
          },
          "gas": {
            "type": "integer",
            "description": "Estimated gas for the equivalent swap transaction"
          },
          "srcToken": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Token"
              }
            ],
            "description": "Metadata of the sold token; present only when includeTokensInfo=true"
          },
          "dstToken": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Token"
              }
            ],
            "description": "Metadata of the bought token; present only when includeTokensInfo=true"
          },
          "protocols": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ProProtocols"
              }
            ],
            "description": "Detailed route; present when includeProtocols=true."
          },
          "blockNumber": {
            "type": "integer",
            "description": "Block the route was computed against; present only when includeBlockNumber=true"
          }
        }
      },
      "ProQuoteBatchElement": {
        "description": "One element of a batch group: the quote for that amount, or the error that amount failed with. Tell them apart by field presence, since the fields never overlap: a quote always carries dstAmount, an error always carries error.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/ProQuote"
          },
          {
            "$ref": "#/components/schemas/BatchError"
          }
        ]
      },
      "ProSwap": {
        "type": "object",
        "description": "Swap result for a single amount",
        "properties": {
          "dstAmount": {
            "type": "string",
            "description": "Expected output in dst smallest units; may exceed the requested amount when isExactOutput=true."
          },
          "dstAmountMin": {
            "type": "string",
            "description": "Minimum output after slippage, in dst smallest units. With isExactOutput=true, slippage applies to the requested amount. The transaction reverts below this minimum."
          },
          "srcAmount": {
            "type": "string",
            "description": "Required input in src smallest units"
          },
          "gas": {
            "type": "integer",
            "description": "Estimated gas for the swap transaction"
          },
          "tx": {
            "type": "object",
            "description": "Unsigned transaction; sign it with the from account and broadcast it yourself",
            "properties": {
              "from": {
                "type": "string"
              },
              "to": {
                "type": "string",
                "description": "3Route router address for the selected chain"
              },
              "data": {
                "type": "string",
                "description": "Hex-encoded call data for the router"
              },
              "value": {
                "type": "string",
                "description": "Native asset amount to attach, in the chain's smallest unit; \"0\" when src is an ERC-20 token"
              },
              "gas": {
                "type": "string",
                "description": "Gas limit as a decimal string"
              },
              "gasPrice": {
                "type": "string",
                "description": "Gas price in wei, as a decimal string"
              }
            }
          },
          "srcToken": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Token"
              }
            ],
            "description": "Metadata of the sold token; present only when includeTokensInfo=true"
          },
          "dstToken": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Token"
              }
            ],
            "description": "Metadata of the bought token; present only when includeTokensInfo=true"
          },
          "protocols": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ProProtocols"
              }
            ],
            "description": "Detailed route; present when includeProtocols=true."
          },
          "blockNumber": {
            "type": "integer",
            "description": "Block the route was computed against; present only when includeBlockNumber=true"
          }
        }
      },
      "ProSwapBatchElement": {
        "description": "One element of an amounts response: the swap result for that amount, or the error that amount failed with. Tell them apart by field presence, since the fields never overlap: a result always carries tx, an error always carries error.",
        "oneOf": [
          {
            "$ref": "#/components/schemas/ProSwap"
          },
          {
            "$ref": "#/components/schemas/BatchError"
          }
        ]
      },
      "BatchError": {
        "type": "object",
        "description": "Failure for one amount inside a batch or an amounts array. It never changes the HTTP status, which stays 200 for the request as a whole, and a mixed array is normal. statusCode 404 with error \"Quote not found\" means no route was found for that amount; repeating the request does not help.",
        "required": [
          "error",
          "statusCode"
        ],
        "properties": {
          "error": {
            "type": "string",
            "description": "Short reason this amount failed",
            "example": "Quote not found"
          },
          "description": {
            "type": "string",
            "description": "Human-readable cause",
            "example": "Quote not found"
          },
          "statusCode": {
            "type": "integer",
            "description": "Status reported for this element; the HTTP status of the request stays 200",
            "example": 404
          }
        }
      },
      "ProQuoteBatchItem": {
        "type": "object",
        "description": "One quote in a batch: a pair and the amounts to price for it. Options apply to this quote only, so the two sides of a book can be filtered or priced differently.",
        "required": [
          "src",
          "dst",
          "amounts"
        ],
        "additionalProperties": false,
        "properties": {
          "src": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$",
            "description": "Address of the token being sold; use the zero address, or the case-insensitive sentinel 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee, for the chain's native asset",
            "example": "0x5fc5360d0400a0fd4f2af552add042d716f1d168"
          },
          "dst": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$",
            "description": "Address of the token being bought; take one from the token-list operation for the selected chain, or use the zero address, or the case-insensitive sentinel 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee, for the chain's native asset.",
            "example": "0xaf3d76f1834a1d425780943c99ea8a608f8a93f9"
          },
          "amounts": {
            "type": "array",
            "description": "Positive amounts in smallest units, as integer strings, priced against this pair. Uses src units by default, or dst units when isExactOutput=true. The response holds one element per amount, in request order.",
            "minItems": 1,
            "items": {
              "type": "string",
              "pattern": "^[0-9]+$"
            },
            "example": [
              "10000000",
              "20000000"
            ]
          },
          "isExactOutput": {
            "type": "boolean",
            "default": false,
            "description": "Set true to use each entry of amounts as the desired dst output and calculate the required srcAmount."
          },
          "includeTokensInfo": {
            "type": "boolean",
            "default": false,
            "description": "Set true to add the srcToken and dstToken metadata objects to the response"
          },
          "includeProtocols": {
            "type": "boolean",
            "default": false,
            "description": "Include route hops, pool addresses, expected input and output amounts, and shares in basis points."
          },
          "protocols": {
            "type": "string",
            "description": "Comma-separated allow-list of DEX provider names to route through. Omit it to allow every provider. Unknown names are ignored when at least one name is known, but a list in which no name is known is rejected with 400. Provider names come back in protocols when includeProtocols=true."
          },
          "excludedProtocols": {
            "type": "string",
            "description": "Comma-separated deny-list of DEX provider names to exclude from routing. Unknown names are ignored."
          },
          "fee": {
            "type": "number",
            "minimum": 0,
            "maximum": 3,
            "default": 0,
            "description": "Referral fee in percent. It is deducted from the input and reflected in srcAmount. A value outside the range is rejected with 400."
          }
        }
      },
      "ProQuoteBatchRequest": {
        "type": "object",
        "description": "Every quote in the batch is answered from one chain state. The state selectors belong to the envelope only; blockNumber or timestamp inside a quote is rejected as an unknown field.",
        "required": [
          "quotes"
        ],
        "additionalProperties": false,
        "properties": {
          "blockNumber": {
            "type": "integer",
            "minimum": 0,
            "description": "Use historical state at this block for every quote. Cannot be combined with timestamp or reference a future block."
          },
          "timestamp": {
            "type": "integer",
            "minimum": 0,
            "description": "Use historical state at this Unix timestamp in seconds for every quote. Cannot be combined with blockNumber or reference a future time."
          },
          "quotes": {
            "type": "array",
            "description": "Quotes to answer, currently at most 4 per request, with at most 100 amounts summed over all quotes. The limits can change; a request over them answers 400 naming the current limit.",
            "minItems": 1,
            "items": {
              "$ref": "#/components/schemas/ProQuoteBatchItem"
            }
          }
        }
      },
      "ProQuoteBatchGroup": {
        "type": "object",
        "description": "Answer for one requested quote",
        "properties": {
          "src": {
            "type": "string",
            "description": "Token being sold, as requested"
          },
          "dst": {
            "type": "string",
            "description": "Token being bought, as requested"
          },
          "quotes": {
            "type": "array",
            "description": "One element per requested amount, in request order. Elements never carry blockNumber; the batch reports it once.",
            "items": {
              "$ref": "#/components/schemas/ProQuoteBatchElement"
            }
          }
        }
      },
      "ProQuoteBatchResponse": {
        "type": "object",
        "properties": {
          "blockNumber": {
            "type": "integer",
            "description": "Block every quote in the batch was computed against"
          },
          "result": {
            "type": "array",
            "description": "One group per requested quote, in request order",
            "items": {
              "$ref": "#/components/schemas/ProQuoteBatchGroup"
            }
          }
        }
      }
    }
  },
  "openapi": "3.1.0",
  "externalDocs": {
    "description": "3Route agent skill: operational workflow, payment selection, safety rules, and failure handling",
    "url": "https://3route.io/SKILL.md"
  },
  "servers": [
    {
      "url": "/",
      "description": "Same origin as this OpenAPI document"
    }
  ],
  "tags": [
    {
      "name": "Documentation",
      "description": "Machine-readable API discovery"
    },
    {
      "name": "Tokens",
      "description": "Chain-specific token metadata"
    },
    {
      "name": "Approve",
      "description": "ERC-20 allowance checks and approval transactions for the 3Route router"
    },
    {
      "name": "Swap",
      "description": "Quote and unsigned transaction construction"
    }
  ]
}
