docs/api

# API Guide

Choose the service that matches your integration. MAS compares aggregator routes; Smart Router supplies its own AMM route and the token catalog.

AgentSwap service endpoints
ServiceBase URLUse
MASmeta-api.agentswap.coCompare executable routes
Smart Routerapi.agentswap.coAMM routing and catalog

## Multi-aggregator quote

POST https://meta-api.agentswap.co/quote

Replace YOUR_WALLET_ADDRESS with the actual taker. This request quotes 1 USDC on Base. Amounts are decimal strings in raw token units.

curl https://meta-api.agentswap.co/quote \
  -H 'Content-Type: application/json' \
  -d '{
    "chainId": 8453,
    "tokenIn": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "tokenOut": "0x4200000000000000000000000000000000000006",
    "amountIn": "1000000",
    "taker": "YOUR_WALLET_ADDRESS",
    "slippageBps": 50,
    "quoteType": "exactInput",
    "calldataPolicy": "strict",
    "dryRun": true
  }'

The response contains best, quotes, failures, and timing data. Route fields include amountOut, target, approveTarget, calldata, and value.

With dryRun: true, inspect simulation results before execution. A route can be pending, reverted, or unavailable; an HTTP success alone is not an execution check. MAS returns calldata and does not sign or broadcast transactions.

Complete MAS request and response reference →

Stream the comparison

POST /quote/stream accepts the same exact-input body and returns server-sent events. Process initial, late quote events, and sim_update events by provider until done.

Simulation can change the selected winner. Long-running streams can also emit keep_alive and refresh.

For exact-output quotes, use POST /quote with quoteType: "exactOutput", targetOut, maxIn, and strict calldata policy. Exact-output streaming is not supported.

## Smart Router and discovery

# Public, read-only discovery
curl https://api.agentswap.co/api/chains
curl https://api.agentswap.co/api/tokens
curl 'https://api.agentswap.co/api/token-list?chain_id=8453'

Smart Router quotes use POST /quote with snake_case fields and an X-API-Key header. Check route_executable before using its execution payload.

Use agentswap pricing for current quota terms and agentswap key-info to inspect your API key usage.

Smart Router API and authentication →

Build an agent or solver

CLI and MCP expose quote, trade, intent, and policy tools. For direct protocol integration, start with the order signing guide or solver integration guide.

Machine-readable service links: agent metadata.