SushiSwap REST API Integration
The SushiSwap API provides HTTP access to the SushiSwap Aggregator for
optimized token swaps, price discovery, and transaction generation.
It aggregates liquidity from multiple DEXs to determine the best execution route.
Base URL
CODEBLOCK0
API Schema
The active API schema is defined in:
references/openapi.yaml
Agents must always rely on the schema contents rather than hardcoded assumptions.
How To Use
- 1. Load INLINECODE0
- Discover available endpoints, parameters, and response shapes dynamically
- Select the appropriate endpoint based on user intent and schema tags
- Quotes → quote endpoints (e.g.
/quote/v7/{chainId})
- Swap execution → swap endpoints (e.g.
/swap/v7/{chainId})
- Prices → price endpoints (e.g.
/price/v1/{chainId})
- Token info → token endpoints (e.g.
/token/v1/{chainId}/{tokenAddress})
- 4. Construct requests that strictly conform to the schema and include a valid
referrer parameter for all quote and swap endpoints - Validate required parameters before execution
Mandatory referrer Parameter
- - The
referrer parameter must be specified on swap-related endpoints (e.g. /quote & /swap) - The agent or integrator must identify themselves using this field
- INLINECODE10 or
/swap requests must not be sent without a referrer value - Agents must never attempt to omit, spoof, or auto-generate this value.
Fee Customization
The SushiSwap API supports customized integrator fees on swap-related endpoints (e.g. /quote & /swap).
Default fee model
- - Swap-related requests follow an 80/20 fee split by default
-
80% to the integrator (referrer)
-
20% to SushiSwap
- - This split applies unless explicitly overridden by SushiSwap
Custom fee splits
- - Alternative fee splits require a partnership with SushiSwap
- Agents and integrators should not assume custom splits are available. If users request alternative fee splits, agents should direct them to the SushiSwap
team rather than attempting to modify request parameters.
Error Handling
- -
422: Request parameters are invalid → fix inputs - INLINECODE16 : Server overloaded → retry with backoff
- INLINECODE17 : Internal error → retry or fail gracefully
Schema Guidance
For schema usage rules and update behavior, see:
references/OPENAPI.md
SushiSwap REST API 集成
SushiSwap API 提供对 SushiSwap 聚合器的 HTTP 访问,用于优化代币交换、价格发现和交易生成。它聚合来自多个 DEX 的流动性,以确定最佳执行路径。
基础 URL
https://api.sushi.com
API 模式
活跃的 API 模式定义在:
references/openapi.yaml
代理必须始终依赖模式内容,而非硬编码假设。
使用方法
- 1. 加载 references/openapi.yaml
- 动态发现可用的端点、参数和响应结构
- 根据用户意图和模式标签选择合适的端点
- 报价 → 报价端点(例如 /quote/v7/{chainId})
- 交换执行 → 交换端点(例如 /swap/v7/{chainId})
- 价格 → 价格端点(例如 /price/v1/{chainId})
- 代币信息 → 代币端点(例如 /token/v1/{chainId}/{tokenAddress})
- 4. 构建严格符合模式的请求,并为所有报价和交换端点包含有效的 referrer 参数
- 在执行前验证必要参数
强制 referrer 参数
- - referrer 参数必须在与交换相关的端点(例如 /quote 和 /swap)上指定
- 代理或集成者必须使用此字段标识自身
- 没有 referrer 值的 /quote 或 /swap 请求不得发送
- 代理不得尝试省略、伪造或自动生成此值。
费用定制
SushiSwap API 支持在交换相关端点(例如 /quote 和 /swap)上定制集成者费用。
默认费用模型
-
80% 归集成者(推荐人)
-
20% 归 SushiSwap
- - 除非 SushiSwap 明确覆盖,否则此分配适用
自定义费用分配
- - 替代费用分配需要与 SushiSwap 建立合作关系
- 代理和集成者不应假设自定义分配可用。如果用户请求替代费用分配,代理应引导他们联系 SushiSwap 团队,而非尝试修改请求参数。
错误处理
- - 422:请求参数无效 → 修正输入
- 529:服务器过载 → 退避重试
- 500:内部错误 → 重试或优雅失败
模式指南
有关模式使用规则和更新行为,请参阅:
references/OPENAPI.md