Developer API
SwapTitan REST API: no-KYC swaps for 1,250+ coins, multi-chain RPC, AI agent and MCP server. Pay per call or subscribe.
Quick Start
CLI v1.7.0
Swaps, wallet and AI agent from your terminal. Download it straight from us, no npm package needed.
curl -fsSL https://swaptitan.net/cli -o terafab chmod +x terafab npm i commander ethers ./terafab swap:quote -f btc -t sol -a 0.01
Node 18+. For Solana commands also: npm i @solana/web3.js bs58
JS SDK v1.1.0
Browser and Node.js, MCP client included, no build step.
<script src="https://swaptitan.net/agent-sdk.js"></script>
const sdk = new SwapTitanAgent();
sdk.quote("btc", "sol", 0.01).then(console.log);MCP Server
Model Context Protocol: connect any AI agent via JSON-RPC 2.0. 23 tools.
POST https://swaptitan.net/mcp
{"jsonrpc":"2.0","method":"tools/list","id":1}REST API Endpoints
| Method | Endpoint | Description | Price |
|---|---|---|---|
| GET | /v1/riftbeam/quote | RiftBeam: own Solana aggregator (Raydium CLMM + Orca), Jupiter-compatible schema, drop-in by swapping the base URL | free |
| GET | /v1/riftbeam/docs | RiftBeam API docs and OpenAPI 3.1 (no login) | free |
| GET | /v1/riftbeam/health | RiftBeam indexer status and coverage | free |
| GET | /v1/prices | Live prices BTC, ETH, SOL, XMR and more | free |
| GET | /v1/assets | 1,250+ supported swap assets | free |
| GET | /v1/swap/quote?from=btc&to=sol&amount=0.01 | Quote with best-rate routing | free |
| GET | /v1/swap/compare?from=sol&to=usdc&amount=1 | Live best-price comparison across own rails and partners | free |
| POST | /v1/swap/create | Create swap, returns deposit address | 10/day free · x402 |
| GET | /v1/swap/status?id=&provider= | Poll swap: waiting, confirming, done | free |
| POST | /v1/ai/chat | AI agent: swaps, portfolio, rug check | 5/day free · x402 |
| POST | /v1/rpc/sol | Solana RPC, edge cached | trial 50 · plan |
| POST | /mcp | MCP server: JSON-RPC 2.0, tools/list, tools/call | free |
| GET | /v1/nowpayments/currencies | 300+ payable cryptos | free |
| GET | /v1/nowpayments/estimate?amount=100&from=usd&to=btc | Fiat to crypto estimate | free |
| GET | /v1/nowpayments/min?from=btc&to=xmr | Minimum payment amount for a pair | free |
| POST | /v1/nowpayments/payment | Create crypto payment, returns pay address (AI-payable) | free |
| GET | /v1/nowpayments/status/:id | Poll payment status | free |
| POST | /v1/ap4m/permission | Register agent and set daily spending limit | AP4M |
| GET | /v1/ap4m/status?agent_id= | Budget, daily spend, TX history | AP4M |
| POST | /v1/ap4m/transact | Execute swap with limit enforcement, rejected on exceed | AP4M |
| POST | /v1/ap4m/credential | Agentic token (HMAC-signed, 30-day expiry) | AP4M |
Base URL: https://api.swaptitan.net · EU mirror: https://api.terafabpay.de
Code examples
# Live prices (free)
curl https://api.swaptitan.net/v1/prices
# Swap quote (free)
curl "https://api.swaptitan.net/v1/swap/quote?from=btc&to=sol&amount=0.01"
# Create swap (10/day free, then x402)
curl -X POST https://api.swaptitan.net/v1/swap/create \
-H "Content-Type: application/json" \
-d '{"from":"btc","to":"sol","amount":0.01,"address":"YOUR_SOL_ADDR"}'
# AI agent (5/day free)
curl -X POST https://api.swaptitan.net/v1/ai/chat \
-H "Content-Type: application/json" \
-d '{"message":"How much SOL would I get for 0.1 BTC?"}'// Browser or Node.js, SDK v1.1.0
// <script src="https://swaptitan.net/agent-sdk.js"></script>
const agent = new SwapTitanAgent({ apiKey: "YOUR_KEY" }); // key optional
// Quote
const quote = await agent.quote("btc", "sol", 0.01);
console.log(quote.estimatedAmount);
// Create swap
const swap = await agent.swap("btc", "sol", 0.01, "YOUR_SOL_ADDR");
console.log(swap.payinAddress); // send BTC here
// AI agent
const reply = await agent.ask("rug check token So11111...");
// MCP client (protocol 2024-11-05)
const mcp = agent.mcp();
await mcp.initialize();
const result = await mcp.call("swap_quote", { from: "btc", to: "sol", amount: 0.01 });import requests
API = "https://api.swaptitan.net"
HEADERS = {"X-License-Key": "YOUR_KEY"} # optional
prices = requests.get(f"{API}/v1/prices").json()
print(prices["btc"])
q = requests.get(f"{API}/v1/swap/quote",
params={"from": "btc", "to": "sol", "amount": 0.01}).json()
print(q["estimatedAmount"])
s = requests.post(f"{API}/v1/swap/create", headers=HEADERS,
json={"from": "btc", "to": "sol", "amount": 0.01, "address": "YOUR_SOL"}).json()
print(s["payinAddress"]) # send BTC hereAP4M · Agentic Payment Protocol
- x402 (Coinbase protocol)
- USDC on Base and Solana
- A2A Agent Card
- MCP server (23 tools)
- Spending limit enforcement
- DMV verifiable identity
# Register agent with spending limit
curl -X POST https://api.swaptitan.net/v1/ap4m/permission \
-H "Content-Type: application/json" \
-d '{"agent_id":"my_agent_001","spending_limit_usdc":100,"currency":"USDC","chains":["base","solana"]}'
# Response
{"success":true,"agent_id":"my_agent_001","token":"ap4m_abc123...","spending_limit_usdc":100,"status":"active"}# Execute swap (limit enforced)
curl -X POST https://api.swaptitan.net/v1/ap4m/transact \
-H "Content-Type: application/json" \
-d '{"token":"ap4m_abc123...","agent_id":"my_agent_001","action":"swap","from_asset":"btc","to_asset":"sol","amount":"0.01","amount_usdc":0.05}'
# Limit exceeded: HTTP 402
{"error":"Daily spending limit exceeded","code":"LIMIT_EXCEEDED","remaining_usdc":0.45,"requested_usdc":0.05}# Agent status and TX history
curl "https://api.swaptitan.net/v1/ap4m/status?agent_id=my_agent_001"
# Response
{"agent_id":"my_agent_001","spending_limit_usdc":100,"spent_today_usdc":4.55,
"remaining_today_usdc":95.45,"spent_total_usdc":4.55,"status":"active",
"transactions":[{"id":"tx_abc","action":"swap","amount_usdc":0.05,"status":"success"}]}x402 Pay-per-Call
When the free tier is used up, the API answers HTTP 402 with payment details. Your client signs a USDC payment on Base and retries with the X-Payment header. CLI and SDK do this automatically.
# CLI: one-time setup, then every paid call is signed automatically
./terafab pay:setup <EVM_PRIVATE_KEY_WITH_USDC_ON_BASE>
./terafab swap -f btc -t sol -a 0.01 -d YOUR_SOL_ADDR
# 402 response when payment is needed
{ "x402Version":1, "accepts":[{ "scheme":"exact", "network":"base-mainnet",
"payTo":"0xb973a20768a2a771ed89a9e8d0a03dcbb7de6eb4", "asset":"USDC" }] }Need more than the free tier?
Plans from €2.49/month, paid with BTC, USDC or card. Instant license key.
FAQ
Do I need an API key?
No. Prices, assets and quotes are free without a key. Creating swaps is free for 10 calls per IP per day, AI chat for 5. After that you pay per call with x402 (USDC on Base) or use a plan from €2.49 per month.
How do I install the CLI?
Download it from swaptitan.net/cli, make it executable and install its two dependencies with npm i commander ethers. Node 18 or newer is required. No npm package from us is needed.
How do I connect an AI agent?
Point any MCP client to https://swaptitan.net/mcp (JSON-RPC 2.0). It exposes 23 tools for prices, quotes, best-route swaps, private Monero swaps, Solana and EVM swaps, wallets and rug checks.
What is x402?
An open pay-per-call standard. When the free tier is used up the API answers HTTP 402 with payment details. Your client signs a USDC payment on Base and retries with the X-Payment header. Our CLI and SDK do this automatically.