Skip to main content

The error object

All error responses share the same structure:
{
  "status": "400",
  "message": "You don't have enough funds for this transfer. Your available balance is 1,250.00 USD.",
  "type": "error_transfer_insufficient_funds"
}
status
string
required
The HTTP status code as a string, mirroring the response status header.
message
string
required
A human-readable description of what went wrong and what to do next. Safe to surface to your users.
type
string
required
A machine-readable error code. Use this to handle specific error cases programmatically. Follows the format error_{domain}_{specific_condition}.
validations
array
Present only on validation errors (error_validation_error). Contains field-level details when multiple fields fail.

Validation error example

When a request fails validation on multiple fields, the validations array provides field-level detail:
{
  "status": "422",
  "message": "Validation failed for one or more fields.",
  "type": "error_validation_error",
  "validations": [
    {
      "email": {
        "error_type": "error_validation_email_invalid",
        "message": "That email address doesn't look right. Please check it and try again."
      }
    },
    {
      "phone": {
        "error_type": "error_validation_phone_invalid",
        "message": "Please enter a valid phone number with country code (e.g., +1234567890)."
      }
    }
  ]
}

HTTP status codes

CodeMeaningWhen it occurs
400Bad RequestMalformed request or a business rule violation (e.g. insufficient funds, invalid state)
401UnauthorizedMissing, invalid, or expired API key
403ForbiddenValid key but insufficient permissions for this action
404Not FoundThe requested resource doesn’t exist
409ConflictA uniqueness or state conflict (e.g. duplicate resource, concurrent modification)
422Unprocessable EntityRequest is well-formed but fails a business rule (e.g. KYC incomplete, compliance rejection)
429Too Many RequestsRate limit exceeded
500Internal Server ErrorUnexpected error on Nuvion’s end
503Service UnavailableA Nuvion service or downstream dependency is temporarily unavailable
504Gateway TimeoutRequest timed out

Handling errors

Check the type field to handle specific error cases in your integration. Use the message field to surface a reason to your users.
const response = await fetch('https://api.nuvion.dev/transfers', {
  method: 'POST',
  headers: { 'Authorization': `Bearer ${API_KEY}` },
  body: JSON.stringify(payload)
});

if (!response.ok) {
  const error = await response.json();

  switch (error.type) {
    case 'error_transfer_insufficient_funds':
      // Prompt the user to fund their account
      break;
    case 'error_auth_rate_limit_exceeded':
      // Back off and retry after a delay
      break;
    case 'error_validation_error':
      // Surface field-level errors from error.validations
      break;
    default:
      // Log the error and surface error.message to the user
  }
}
Every error response includes an X-Request-ID header. Include this in any support request — it lets the Nuvion team trace the exact request in our systems.

Error reference

Error types follow the format error_{domain}_{specific_condition}. The domain indicates which part of the API the error originates from.

Authentication & authorization

Validation

Entities

KYC

KYB

Accounts

Transfers

Counterparties

Stablecoin wallets

Account details resolution

Card acquiring

Webhooks

Resources & system