Skip to content

Errors

All error responses follow a consistent envelope format. When a request fails, the response body contains success: false along with an error message and optional field-level details.

Error Response Format

{

"hl-key">"success": false,

"hl-key">"error": "Human-readable error message",

"hl-key">"fields": {

"hl-key">"quote_id": "Required field missing"

}

}

FieldTypeDescription
successbooleanAlways false for errors
errorstringHuman-readable description of what went wrong
fieldsobject \undefinedOptional. Per-field validation error details. Only present on 400 responses with validation failures.

---

HTTP Status Codes

StatusMeaningWhen It Occurs
400Bad RequestValidation failure -- missing fields, invalid values, malformed body
401UnauthorizedMissing Authorization header, invalid API key, or expired key
404Not FoundResource does not exist (e.g., unknown swap ID, quote ID, or endpoint)
429Too Many RequestsRate limit exceeded. Back off and retry after the indicated interval.
500Internal Server ErrorUnexpected server-side failure. Retry with exponential backoff.

---

Common Error Scenarios

StatusError MessageFix
400"command is required"Include a command field in the POST /execute body
400"Command exceeds 500 character limit"Shorten the command string to 500 characters or fewer
400"quote_id is required"Include a quote_id field in the POST /swap/execute body
400"Quote expired"Request a new quote via POST /quote and execute promptly
400"Invalid status filter"Use one of: "submitted", "pending", "completed", "failed"
400"limit must be between 1 and 100"Set limit to a value between 1 and 100
400"No callback_url configured"Set a callback_url in your agent profile via PATCH /me before testing webhooks
400"Unable to parse command"Rephrase the natural language command in a supported format
401"Unauthorized"Check that the Authorization: Bearer header is present and the key is valid
404"Swap not found"Verify the swap ID exists and belongs to your agent
404"Quote not found"Verify the quote ID; it may have expired or been consumed
404"No managed wallet found"Create a managed wallet via POST /wallets before executing swaps
429"Rate limit exceeded"Wait and retry. Check the Retry-After header for the recommended delay.
500"Internal server error"Retry with exponential backoff. Contact support if it persists.

---

JSON-RPC Errors (MCP / A2A)

For agents connecting via MCP or A2A protocols, errors follow the JSON-RPC 2.0 error format:

{

"hl-key">"jsonrpc": "2.0",

"hl-key">"id": 1,

"hl-key">"error": {

"hl-key">"code": -32601,

"hl-key">"message": "Method not found"

}

}

Standard JSON-RPC Error Codes

CodeNameDescription
-32700Parse ErrorInvalid JSON received by the server
-32600Invalid RequestThe JSON payload is not a valid JSON-RPC request
-32601Method Not FoundThe requested method does not exist or is not available
-32602Invalid ParamsInvalid method parameters (wrong type, missing required fields)

Application-Specific Error Codes

CodeNameDescription
-32001Task Not FoundThe referenced task ID does not exist
-32002Unsupported OperationThe requested operation is not supported by this agent

Example JSON-RPC Error Responses

Parse Error:
{

"hl-key">"jsonrpc": "2.0",

"hl-key">"id": null,

"hl-key">"error": {

"hl-key">"code": -32700,

"hl-key">"message": "Parse error: invalid JSON"

}

}

Invalid Params:
{

"hl-key">"jsonrpc": "2.0",

"hl-key">"id": 3,

"hl-key">"error": {

"hl-key">"code": -32602,

"hl-key">"message": "Invalid params: 'from_token' is required"

}

}

Task Not Found:
{

"hl-key">"jsonrpc": "2.0",

"hl-key">"id": 5,

"hl-key">"error": {

"hl-key">"code": -32001,

"hl-key">"message": "Task not found: task_abc123"

}

}