Errors
The LedgerOS API uses conventional HTTP response codes and returns structured error objects to indicate the success or failure of API requests.Error Response Format
All errors follow this structure:| Field | Description |
|---|---|
type | The category of error |
code | Specific error code for programmatic handling |
message | Human-readable description |
request_id | Unique ID for support requests |
Error Types
| Type | Description |
|---|---|
authentication_error | Invalid or missing API key |
authorization_error | Valid auth but insufficient permissions |
invalid_request_error | Invalid parameters or malformed request |
validation_error | Request body failed validation |
not_found_error | Resource doesn’t exist |
conflict_error | Resource state conflict |
rate_limit_error | Too many requests |
service_error | Internal or upstream service error |
Common Error Codes
Authentication Errors
| Code | Status | Description |
|---|---|---|
missing_api_key | 401 | No Api-Key header provided |
invalid_api_key | 401 | API key is invalid or revoked |
expired_api_key | 401 | API key has expired |
Authorization Errors
| Code | Status | Description |
|---|---|---|
access_denied | 403 | No permission to access this resource |
insufficient_permissions | 403 | Operation requires elevated permissions |
Validation Errors
| Code | Status | Description |
|---|---|---|
validation_failed | 400 | Request body failed schema validation |
parameter_missing | 400 | Required parameter not provided |
parameter_invalid | 400 | Parameter value is invalid |
body_parse_error | 400 | Request body is not valid JSON |
Resource Errors
| Code | Status | Description |
|---|---|---|
not_found | 404 | Resource not found |
user_not_found | 404 | User ID doesn’t exist |
agent_not_found | 404 | Agent ID doesn’t exist |
card_not_found | 404 | Card ID doesn’t exist |
transaction_not_found | 404 | Transaction ID doesn’t exist |
Card Errors
| Code | Status | Description |
|---|---|---|
card_not_active | 400 | Card must be active for this operation |
card_already_closed | 409 | Card has already been closed |
card_already_frozen | 409 | Card is already frozen |
agent_suspended | 400 | Cannot create cards for suspended agent |
max_cards_reached | 400 | Agent has reached maximum card limit |
raw_pan_acknowledgment_required | 400 | Must acknowledge risk for raw PAN access |
Rate Limiting
| Code | Status | Description |
|---|---|---|
rate_limit_exceeded | 429 | Too many requests, retry after delay |
Retry-After header for seconds until you can retry.
HTTP Status Codes
| Code | Meaning |
|---|---|
200 | Success |
201 | Created |
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid API key |
403 | Forbidden - Access denied |
404 | Not Found - Resource doesn’t exist |
409 | Conflict - Resource state conflict |
429 | Too Many Requests - Rate limited |
500 | Server Error - Internal error |
502 | Bad Gateway - Upstream service error |
503 | Service Unavailable - Temporary outage |
Handling Errors
Getting Help
When contacting support, always include:- The
request_idfrom the error response - The endpoint you were calling
- The timestamp of the request