# red-web-utils Swap Route

> red-web-utils Swap Route is a paid API for AI agents from red-web-utils.agent-tools-x402.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-11-04).

Returns an optimal cross-chain or same-chain token swap route given input/output tokens, amount, and sender address

## Facts

- Endpoint: POST https://red-web-utils.agent-tools-x402.workers.dev/api/swap/route?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-04
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/red-web-utils-swap-route-411ff7eb
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_oaiDtTCud74BPpt2EjYv7

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability red-web-utils-swap-route-411ff7eb -d '<json body>'
```

Example prompt: Find me the best swap route to exchange 500 USDC for ETH starting from my wallet address 0xAbC...123 on Base — use a 0.5% slippage tolerance.

## When to prefer this

Use this endpoint when an AI agent needs to look up swap routing and pricing information for onchain token exchanges without executing a transaction — ideal for quoting, planning, or presenting trade options to users. It supports cross-chain routing, making it suitable for multi-chain DeFi workflows. Prefer this over on-chain direct calls when you need a simple, pay-per-call REST interface priced in USDC via x402.

## Known failure modes

- Unsupported token pair returns an error or empty route
- Invalid fromAddress format causes a validation error
- fromAmount of zero or negative triggers a bad request error
- Insufficient liquidity for the requested pair returns no viable route
- Unsupported chain identifier causes a lookup failure
- Network timeouts when querying DEX aggregators

## How this service works

Pay-per-call web and onchain utilities for AI agents (MPP + x402, USDC on Base).

## Output

Returns the optimal swap route details including the routing path across liquidity sources, expected output token amount, price impact, gas estimates, and any intermediate hops needed to complete the exchange.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "toToken",
  "fromToken",
  "fromAmount",
  "fromAddress"
 ],
 "properties": {
  "toChain": {
   "type": "string"
  },
  "toToken": {
   "type": "string"
  },
  "slippage": {
   "type": "string"
  },
  "fromChain": {
   "type": "string"
  },
  "fromToken": {
   "type": "string"
  },
  "fromAmount": {
   "type": "string"
  },
  "fromAddress": {
   "type": "string"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/red-web-utils-swap-route-411ff7eb/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from red-web-utils.agent-tools-x402.workers.dev](https://www.zero.xyz/host/red-web-utils.agent-tools-x402.workers.dev/llms.txt)
