# Chainhilt Token Swap Executor

> Chainhilt Token Swap Executor is a paid API for AI agents from chainhilt.ai, paid per call via x402, $0.01/call, status unknown (last checked 2026-10-31).

Selects the best available DEX swap quote across multiple aggregators and returns ordered unsigned transaction actions (approvals + swap) ready to execute on-chain.

## Facts

- Endpoint: POST https://chainhilt.ai/api/v1/swap/execute?utm_source=zero.xyz
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-31
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/chainhilt-token-swap-executor-4ed80a1d
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Bpxd6OqIqjOlX_gliUqGE

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 chainhilt-token-swap-executor-4ed80a1d -d '<json body>'
```

Example prompt: Swap 1000 USDC (0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48) for ETH (0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE) on Ethereum mainnet (chainId 1) from my wallet 0xAbCd...1234, with 50 bps slippage tolerance — give me the best route excluding 1inch.

## When to prefer this

Choose this endpoint when you need a single call that aggregates quotes from multiple DEX sources (1inch, 0x, KyberSwap, Velora, Enso, OKX, Bebop, OpenOcean) and returns pre-built, ready-to-sign transaction calldata in the correct execution order. Prefer it over calling individual DEX APIs directly when you want best-execution routing without managing aggregator integrations yourself. Particularly useful for AI agents that need deterministic, ordered unsigned transactions they can pass directly to a wallet signer.

## Known failure modes

- Insufficient liquidity for the requested swap pair/amount — no route found
- Invalid token address format (must be checksummed 0x hex, 40 chars)
- sellAmount of zero or non-numeric string
- chainId not supported by any available aggregator
- slippageBps out of range (must be 0–5000)
- takerAddress not provided or malformed — required for constructing approval transactions
- All connectors excluded — no aggregators left to route through
- x402 payment failure — $0.01 USDC micropayment not completed

## How this service works

Select the best available swap quote and return ordered unsigned transaction actions. Run the returned actions in order: up to two approvals, then the swap.

## Output

Returns an ordered list of unsigned transaction actions: up to two token approval transactions (if needed) followed by the swap transaction itself, all pre-populated with calldata, target addresses, and values. The agent or wallet must execute them in sequence to complete the swap at the best available rate across supported aggregators (1inch, 0x, KyberSwap, Velora, Enso, OKX, Bebop, OpenOcean).

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "chainId": {
   "type": "integer",
   "minimum": 1
  },
  "buyToken": {
   "type": "string",
   "pattern": "^0x[a-fA-F0-9]{40}$"
  },
  "sellToken": {
   "type": "string",
   "pattern": "^0x[a-fA-F0-9]{40}$"
  },
  "sellAmount": {
   "type": "string",
   "pattern": "^[0-9]+$"
  },
  "slippageBps": {
   "type": "integer",
   "maximum": 5000,
   "minimum": 0
  },
  "takerAddress": {
   "type": "string",
   "pattern": "^0x[a-fA-F0-9]{40}$"
  },
  "excludedConnectors": {
   "type": "array",
   "items": {
    "enum": [
     "1inch",
     "0x",
     "kyberswap",
     "velora",
     "enso",
     "okx",
     "bebop",
     "openocean"
    ],
    "type": "string"
   },
   "uniqueItems": true
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "swap": {
   "tx": {
    "to": "0x0000000000000000000000000000000000000005",
    "data": "0xabcdef",
    "value": "0"
   },
   "gas": "150000",
   "chainId": 8453,
   "approval": {
    "token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "amount": "1000000",
    "spender": "0x0000000000000000000000000000000000000004"
   },
   "buyAmount": "560000000000000",
   "aggregator": "0x",
   "sellAmount": "1000000"
  },
  "response": {
   "errors": [],
   "actions": [
    {
     "data": {
      "to": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "data": "0x095ea7b3",
      "from": "0xE4934BB19E0B97109033dBfDcCc6957E32F9Cc60",
      "value": "0"
     },
     "type": "transaction",
     "chainId": 8453
    },
    {
     "data": {
      "to": "0x0000000000000000000000000000000000000005",
      "data": "0xabcdef",
      "from": "0xE4934BB19E0B97109033dBfDcCc6957E32F9Cc60",
      "value": "0"
     },
     "type": "transaction",
     "chainId": 8453
    }
   ],
   "warnings": []
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/chainhilt-token-swap-executor-4ed80a1d/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from chainhilt.ai](https://www.zero.xyz/host/chainhilt.ai/llms.txt)
