Error Handling

The Neutron API uses standard HTTP status codes and returns consistent JSON error responses to help you quickly identify and resolve issues.

HTTP Status Codes

CodeCategoryDescription
200✅ SuccessRequest completed successfully
400❌ Bad RequestThe request was malformed or missing required fields
401🔒 UnauthorizedAuthentication failed — invalid API key, signature, or expired token
403🚫 ForbiddenValid credentials but insufficient permissions (e.g., accessing another account's resources)
404❓ Not FoundThe requested resource doesn't exist (transaction, webhook, account, etc.)
429⏳ Rate LimitedToo many requests — see Rate Limiting
500💥 Server ErrorSomething went wrong on our end — retry with exponential backoff

Error Response Format

All error responses return JSON with an error field, and optionally a message field with more detail:

{
  "error": "unauthorized",
  "message": "invalid token or token expired"
}

Some endpoints return a simpler format:

{
  "error": "invalid api signature"
}

Common Errors by Category

Authentication Errors

ErrorHTTP CodeCauseSolution
invalid API key or signature401Missing or incorrect X-Api-Key or X-Api-Signature headersVerify your API key and regenerate the HMAC-SHA256 signature — see Signature Generation
invalid api signature401The signature doesn't match the expected valueEnsure you're signing the string {apiKey}&payload={payload} with your API secret using HMAC-SHA256
invalid token or token expired401The JWT access token has expired or is malformedRequest a new token via POST /api/v2/authentication/token-signature. Tokens have a limited lifespan — check the expiredAt field

Account & Wallet Errors

ErrorHTTP CodeCauseSolution
failed to get account400Invalid account ID formatVerify the account ID (format: ne01-xxxx...)
you are not authorized to view this account401Trying to access an account you don't ownYou can only access your own account or subaccounts where you're the parent
Permission denied403Subaccount accessing parent resources or vice versaEnsure the token matches the account being accessed

Transaction Errors

ErrorHTTP CodeCauseSolution
unauthorized401Missing or invalid Bearer tokenInclude a valid JWT in the Authorization: Bearer {token} header
not found404Transaction ID doesn't existVerify the transaction ID from the create response
bad request400Invalid transaction parametersCheck required fields: sourceReq and destReq with valid ccy, method, and reqDetails

Webhook Errors

ErrorHTTP CodeCauseSolution
unauthorized401Missing or invalid authenticationInclude a valid Bearer token
not found404Webhook ID doesn't existList your webhooks via GET /api/v2/webhook to find valid IDs

Error Handling Best Practices

  1. Always check the HTTP status code first — it tells you the error category
  2. Parse the JSON error and message fields for specifics
  3. Implement token refresh logic — tokens expire, so catch 401s and re-authenticate automatically
  4. Use idempotent retries for 5xx errors — server errors are usually transient; retry with exponential backoff
  5. Don't retry 4xx errors without fixing the request — these indicate a problem with your input
  6. Log error responses — include the full response body in your logs for debugging
  7. Set up webhooks to track transaction failures asynchronously instead of polling