> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ecrypt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Error Handling

Error codes indicate whether an API request succeeded or failed. When a payment flow fails, the error code tells you what went wrong and helps you resolve the issue.

## HTTP Error Codes

| Code | Status | Description |
| :- | :- | :- |
| 200 | OK | The request succeeded. |
| 400 | Bad Request | The request was unacceptable, often due to a missing or invalid parameter. |
| 401 | Unauthorized | No valid API key was provided. |
| 402 | Request Failed | The parameters were valid but the request failed. |
| 403 | Forbidden | The API key does not have permission to perform this request. |
| 404 | Not Found | The requested resource does not exist. |
| 409 | Conflict | The request conflicts with another request, such as a duplicate idempotency key. |
| 429 | Too Many Requests | Too many requests were sent in a short period. Use exponential backoff when retrying. |
| 500, 502, 503, 504 | Server Error | Something went wrong on ECRYPT's end. These are rare. If the issue persists, contact support. |

## Error Objects

When a request fails, the response body includes an `errors` array with details about what went wrong.

```json theme={null}
{
  "requestId": "abc123",
  "errors": [
    {
      "type": "VALIDATION",
      "message": "The amount field is required."
    }
  ]
}
```

| Field | Type | Description |
| :- | :- | :- |
| `requestId` | string | A unique identifier for the request. Include this when contacting support. |
| `errors[].type` | string | The category of error. |
| `errors[].message` | string | A description of what went wrong. |

## Errors Handling Guidelines

**400 errors** are caused by your request. Check that all required fields are present and that values match the expected types and formats.

**401 and 403 errors** indicate an authentication or permissions issue. Verify that you are using the correct API key for the environment and that the key has the necessary access level.

**429 errors** mean you have exceeded the rate limit. Implement exponential backoff so your retry attempts increase in wait time with each failed attempt rather than hammering the API repeatedly.

**5xx errors** originate on ECRYPT's servers. Retry the request using exponential backoff. If the issue persists, contact [ECRYPT support](https://www.ecrypt.com).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.