# Error

**API Error Responses**

When an error occurs in the OxaPay API, the response will be structured in a standardized format. This allows users to easily identify and address issues with their requests. Below is an overview of the error response structure, the possible status codes, and the types of errors you may encounter.

{% tabs %}
{% tab title="Error response structure" %}

```json
{
  "data": {},
  "message": string, // A message containing additional information about the result of the request.
  "error": {
    "type": string,
    "key": string,
    "message": string
  } || {}, // An object that provides details about any errors that occurred.
  "status": integer, // The status of the request response. Typically provided as a numeric code (e.g., 200 for success or other codes for errors).
  "version": string // The version of the API being used.
}
```

{% endtab %}
{% endtabs %}

#### Statuses

| **Status Code**               | **Meaning**                                               | **Common Causes**                                                               |
| ----------------------------- | --------------------------------------------------------- | ------------------------------------------------------------------------------- |
| **200 OK**                    | The request was successful.                               | The request was processed without errors.                                       |
| **400 Bad Request**           | The request was invalid or malformed.                     | Missing required fields, invalid data format, or unacceptable parameter values. |
| **401 Unauthorized**          | The user is not authenticated or has invalid credentials. | Missing or invalid API key, incorrect session or token.                         |
| **404 Not Found**             | The requested resource could not be found.                | The resource doesn't exist or the endpoint is incorrect.                        |
| **500 Internal Server Error** | An unexpected server-side error occurred.                 | Server failure, issues with third-party integrations or dependencies.           |
| **503 Service Unavailable**   | One of the services is temporarily unavailable.           | Server overload, service downtime, or maintenance.                              |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.oxapay.com/api-reference/error.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
