API ReferenceTransfers
Swap Tokens
Swap one token for another on the same chain.
Swap Tokens
Execute a token swap on a specified chain using the wallet's funds.
Authentication
Requires X-API-Key header.
Path parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Wallet UUID |
Request body
Both camelCase and snake_case parameter names are accepted.
Request
curl -X POST http://localhost:4000/v1/wallets/WALLET_ID/swap \
-H "X-API-Key: ak_your_key" \
-H "Content-Type: application/json" \
-d '{
"chain": "base",
"inputToken": "ETH",
"outputToken": "USDC",
"amount": "0.1"
}'Response (200)
{
"transaction_id": "tx-uuid",
"tx_hash": "0xabc123...",
"input_token": "ETH",
"output_token": "USDC",
"input_amount": "0.1",
"output_amount": "300.00",
"chain": "base",
"status": "confirmed"
}Errors
| Status | Code | Description |
|---|---|---|
| 400 | INVALID_INPUT | Missing or invalid fields |
| 404 | NOT_FOUND | Wallet not found |
| 500 | SWAP_FAILED | Swap execution failed |