Stablecoin routing for agents.
Free quotes. Pay-per-call swaps via x402 ($0.02 USDC on Base) — no signup, no API key. Or grab a free HMAC key for higher-volume B2B flows. Routes the SADC and EU-diaspora corridors (USDT-TRC20 ↔ USDC/EURC) that Jumper and generic aggregators won't serve.
Three ways to call SwapEazi.
No signup. POST to /api/x402/swap; first call returns a 402 challenge with payment details. Pay, retry, receive an unsigned tx. Best for AI agents that already hold USDC on Base.
Issue a key in the form above, paste it in x-swapeazi-key, call /api/v1/*. Best for B2B integrations, batch disbursement, server-to-server.
Same handler as x402, alt payment rail. POST to /api/mpp/swap with an MPP authorization header. Useful for Tempo-native agents.
The data no aggregator can copy.
Every swap SwapEazi routes is recorded — bridge reliability, real settlement time, actual slippage — across African corridors nobody else runs at volume. We expose that as a read API: GET /api/v1/intelligence/corridor/{pair}. Ask it the best route before you send.
Recommended bridge, reliability band, sample size. Capped at 100 calls/month per IP. Just GET — no signup.
Per-bridge p50/p95 settlement time & slippage, the historically optimal route, and corridor failure patterns. Unmetered, metered for billing. Send an se_ key as Authorization: Bearer.
Copy, paste, route.
# Coarse signal, no key. Add an se_ key for full p50/p95 + optimal route.
curl https://swapeazi.io/api/v1/intelligence/corridor/EUR-ZAR?amount=5000
# Pro tier — full metrics
curl https://swapeazi.io/api/v1/intelligence/corridor/BAS-TRON \
-H 'authorization: Bearer se_your_key_here'curl -X POST https://swapeazi.io/api/x402/quote \
-H 'content-type: application/json' \
-d '{
"fromChain": "BAS",
"toChain": "POL",
"fromToken": "USDC",
"toToken": "USDC",
"fromAmount": "100",
"fromAddress": "0xYourWallet"
}'from langchain.tools import Tool
import requests, base64, json
def swapeazi_quote(payload: dict) -> dict:
"""Free quote on any cross-chain stablecoin pair."""
r = requests.post("https://swapeazi.io/api/x402/quote", json=payload, timeout=15)
r.raise_for_status()
return r.json()
def swapeazi_swap(payload: dict, x402_payment_b64: str) -> dict:
"""Paid swap — caller has already constructed the x402 payment payload."""
r = requests.post(
"https://swapeazi.io/api/x402/swap",
json=payload,
headers={"X-PAYMENT": x402_payment_b64},
timeout=30,
)
return r.json()
quote_tool = Tool(
name="swapeazi_quote",
func=swapeazi_quote,
description="Quote a cross-chain stablecoin swap. Args: fromChain, toChain, fromToken, toToken, fromAmount, fromAddress.",
){
"type": "function",
"function": {
"name": "swapeazi_quote",
"description": "Quote a cross-chain stablecoin swap on SwapEazi (free, no payment).",
"parameters": {
"type": "object",
"required": ["fromChain","toChain","fromToken","toToken","fromAmount","fromAddress"],
"properties": {
"fromChain": { "type": "string", "enum": ["ETH","POL","ARB","OPT","BAS","BNB"] },
"toChain": { "type": "string", "enum": ["ETH","POL","ARB","OPT","BAS","BNB"] },
"fromToken": { "type": "string" },
"toToken": { "type": "string" },
"fromAmount": { "type": "string" },
"fromAddress": { "type": "string" },
"slippage": { "type": "number" }
}
}
}
}// First call (no payment) returns HTTP 402 with the challenge body.
// Pay the requested amount with your USDC-on-Base wallet, sign the
// x402 payload, base64url-encode it, retry the same body with X-PAYMENT.
const challenge = await fetch("https://swapeazi.io/api/x402/swap", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify(params),
});
if (challenge.status === 402) {
const { accepts } = await challenge.json();
const xPayment = await signX402Payment(accepts[0]); // your USDC-on-Base wallet
const final = await fetch("https://swapeazi.io/api/x402/swap", {
method: "POST",
headers: { "content-type": "application/json", "X-PAYMENT": xPayment },
body: JSON.stringify(params),
});
const { transactionRequest } = await final.json();
// Sign + broadcast transactionRequest with the user's wallet.
}