# P0 Quote/Swap — On-Chain Token Swap Quote

> P0 Quote/Swap — On-Chain Token Swap Quote is a paid API for AI agents from x402-bazaar-rank.x402-bazaar-rank-worker.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-11).

Returns an unsigned swap transaction (with approval details, gas estimate, and fee breakdown) for exchanging one ERC-20 token for another across major EVM chains, sourced from the best aggregator route available.

## Facts

- Endpoint: GET https://x402-bazaar-rank.x402-bazaar-rank-worker.workers.dev/quote/swap?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-11
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/p0-quote-swap-on-chain-token-swap-quote-fa0d824a
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_7QNrAY1ykZdfv_w36IbZW

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 p0-quote-swap-on-chain-token-swap-quote-fa0d824a
```

Example prompt: Get me a swap quote to sell 10 USDC (that's 10000000 base units) for WETH on Base using my wallet 0x1111111111111111111111111111111111111111, with a max slippage of 50 basis points.

## When to prefer this

Use this endpoint when an AI agent or autonomous wallet needs a ready-to-sign unsigned swap transaction across major EVM chains (Base, Arbitrum, Ethereum, Optimism, Polygon, BSC) with transparent fee breakdown and gas estimation, without custody or signing by any third party. Prefer it over raw DEX APIs when you want aggregated routing, integrator fee transparency, and a schema designed for machine-to-machine use in the x402 payment protocol ecosystem.

## Known failure modes

- Missing required query params (chain, from, to, amount, taker) → 400 error
- Ambiguous slippage value below 10 bps → rejected as ambiguous
- Unknown token symbol with no address provided → lookup failure
- Quote goes stale within seconds — must re-request if not broadcast immediately
- Unsupported chain identifier → error
- Invalid taker address format (not 0x + 40 hex chars) → schema validation failure
- Payment of $0.002 USDC not completed → 402 Payment Required

## How this service works

An open index of the machine-to-machine (agent) economy. x402 routes: ranked discovery over the live x402 service market, every indexed service scored by real 30-day calls and paying-wallet bounds, with a receipt naming the snapshot hash and scoring revision. /economy routes, for Tempo MPP, Virtuals ACP, Olas, Masumi, ERC-8004 agent registries, Solana agent registries, Base agent contracts and MCP servers (Official MCP Registry): each protocol's published figures (agent or server counts, transactions or payment events; payers and USD volume only where the source publishes them: payers for x402 and Tempo MPP, USD volume for x402 and Virtuals ACP), each with its unit, window and source; units differ, so totals are not summed. L402 and per-service MPP listings are not covered.

## Output

A JSON object containing: the unsigned swap transaction (to, from, data, value, chainId fields ready to sign and broadcast), an approval object (token address, amount, spender) if needed, buy/sell token metadata (symbol, address, decimals), buy and sell amounts, a gas estimate, the aggregator provider used, the quote timestamp, slippage in bps, and a detailed integrator fee breakdown (bps, token, amount, receiver, how the fee is split between P0 and the aggregator, and confirmation that the fee is embedded in calldata).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "chain",
      "from",
      "to",
      "amount",
      "taker"
     ],
     "properties": {
      "to": {
       "type": "string",
       "description": "token to buy: symbol or 0x address"
      },
      "from": {
       "type": "string",
       "description": "token to sell: symbol (USDC, WETH, ETH...) or 0x address"
      },
      "chain": {
       "type": "string",
       "description": "base, arbitrum, ethereum, optimism, polygon or bsc (or chain id)"
      },
      "taker": {
       "type": "string",
       "pattern": "^0x[0-9a-fA-F]{40}$",
       "description": "wallet that will sign and send the swap"
      },
      "amount": {
       "type": "string",
       "pattern": "^[0-9]{1,78}$",
       "description": "amount to sell in base units (10 USDC = 10000000)"
      },
      "to_decimals": {
       "type": "integer",
       "maximum": 36,
       "minimum": 0,
       "description": "only for tokens P0 does not know"
      },
      "slippage_bps": {
       "type": "integer",
       "default": 50,
       "maximum": 500,
       "minimum": 1,
       "description": "max slippage in basis points (50 = 0.5%). The alias 'slippage' is read as basis points too (Velora's unit); a 'slippage' below 10 is refused as ambiguous"
      },
      "from_decimals": {
       "type": "integer",
       "maximum": 36,
       "minimum": 0,
       "description": "only for tokens P0 does not know"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "required": [
      "chain",
      "chainId",
      "provider",
      "sellToken",
      "buyToken",
      "sellAmount",
      "buyAmount",
      "tx",
      "integratorFee",
      "quotedAt",
      "note"
     ],
     "properties": {
      "tx": {
       "type": "object",
       "required": [
        "from",
        "to",
        "data",
        "value",
        "chainId"
       ],
       "properti
… (truncated)
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "tx": {
   "to": "0x6a000f20005980200259b80c5102003040001068",
   "data": "0x876a02f6...(shortened example)",
   "from": "0x1111111111111111111111111111111111111111",
   "value": "0",
   "chainId": 8453
  },
  "note": "Unsigned transaction for you to review, sign and broadcast yourself. P0 never signs, holds or sends funds. Quotes go stale within seconds: run eth_estimateGas and send promptly, or request a new quote. Not financial advice.",
  "chain": "base",
  "chainId": 8453,
  "approval": {
   "token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
   "amount": "10000000",
   "spender": "0x6a000f20005980200259b80c5102003040001068"
  },
  "buyToken": {
   "symbol": "WETH",
   "address": "0x4200000000000000000000000000000000000006",
   "decimals": 18
  },
  "provider": "velora",
  "quotedAt": "2026-10-04T18:37:00.000Z",
  "buyAmount": "3695089715876312",
  "sellToken": {
   "symbol": "USDC",
   "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
   "decimals": 6
  },
  "sellAmount": "10000000",
  "gasEstimate": "131096",
  "slippageBps": 50,
  "fallbackFrom": null,
  "integratorFee": {
   "bps": 20,
   "note": "Integrator fee of 20 bps (0.20%) of this swap is taken by the aggregator contract inside the swap transaction you sign; buyAmount already excludes it. Velora keeps 15% of that fee and P0 receives 85% (about 17 bps).",
   "split": {
    "p0": 0.85,
    "aggregator": 0.15
   },
   "token": "0x4200000000000000000000000000000000000006",
   "amount": "7404989410574",
   "percent": 0.2,
   "receiver": "0xECa891e34b3E5873181Fb779672564E198C55354",
   "chargedOn": "output",
   "confirmed": true,
   "inCalldata": true
  },
  "fallbackReason": null
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/p0-quote-swap-on-chain-token-swap-quote-fa0d824a/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-bazaar-rank.x402-bazaar-rank-worker.workers.dev](https://www.zero.xyz/host/x402-bazaar-rank.x402-bazaar-rank-worker.workers.dev/llms.txt)
