Error Handling
The Covered API uses standard HTTP status codes and returns errors in a consistent JSON format.Error response format
All error responses follow this structure:| Field | Description |
|---|---|
code | Machine-readable error code for programmatic handling |
message | Human-readable error message |
details | Optional array of field-level validation errors |
HTTP status codes
Success codes
| Code | Description |
|---|---|
200 | Request succeeded |
201 | Resource created successfully |
Client error codes
| Code | Description |
|---|---|
400 | Bad request - invalid parameters or request body |
401 | Unauthorized - missing or invalid API key |
403 | Forbidden - insufficient permissions |
404 | Not found - resource doesn’t exist |
409 | Conflict - resource already exists or state conflict |
422 | Unprocessable - request understood but cannot be processed |
429 | Rate limited - too many requests |
Server error codes
| Code | Description |
|---|---|
500 | Internal server error |
502 | Bad gateway |
503 | Service unavailable |
Common error codes
Authentication errors
| Error Code | HTTP Status | Description |
|---|---|---|
MISSING_API_KEY | 401 | No API key provided |
INVALID_API_KEY | 401 | API key is invalid or revoked |
API_KEY_EXPIRED | 401 | API key has expired |
RATE_LIMITED | 429 | Too many requests |
Validation errors
| Error Code | HTTP Status | Description |
|---|---|---|
VALIDATION_ERROR | 400 | Request body validation failed |
INVALID_PARAMETER | 400 | Query parameter is invalid |
MISSING_REQUIRED_FIELD | 400 | Required field is missing |
Resource errors
| Error Code | HTTP Status | Description |
|---|---|---|
NOT_FOUND | 404 | Resource not found |
ALREADY_EXISTS | 409 | Resource already exists |
INVALID_STATE | 400 | Resource is in wrong state for operation |
Payment errors
| Error Code | HTTP Status | Description |
|---|---|---|
INSUFFICIENT_BALANCE | 400 | Not enough funds in treasury |
PAYMENT_FAILED | 500 | Payment processing failed |
ONBOARDING_REQUIRED | 400 | KYB verification not complete |
ONBOARDING_PENDING | 400 | KYB verification in progress |
Handling errors
Retry strategies
Rate limiting
When you receive a429 response, check the X-RateLimit-Reset header for when to retry:
Server errors
For5xx errors, implement exponential backoff:
Idempotency
ForPOST requests that create resources, you can include an Idempotency-Key header to safely retry requests:
