# Error Handling

## Success and Error codes

Each API request will return a response. A successful request will typically return a 200 OK status code along with any requested data. Errors or issues with your request will return different status codes (e.g., 400 Bad Request, 401 Unauthorized) and an error message explaining what went wrong.

### Success Codes

<table><thead><tr><th width="132">Code</th><th>Description</th></tr></thead><tbody><tr><td>200</td><td>OK - The request has succeeded.</td></tr><tr><td>201</td><td>Created - The request has been fulfilled and has resulted in one or more new resources being created.</td></tr><tr><td>202</td><td>Accepted - The request has been accepted for processing, but the processing has not been completed.</td></tr><tr><td>204</td><td>No Content - The server successfully processed the request, but is not returning any content.</td></tr></tbody></table>

### Error codes

<table><thead><tr><th width="132">Code</th><th>Description</th></tr></thead><tbody><tr><td>400</td><td>Bad Request - The server cannot process the request due to a client error (e.g., malformed request syntax).</td></tr><tr><td>401</td><td>Unauthorised - The request lacks valid authentication credentials for the target resource.</td></tr><tr><td>404</td><td>Not Found - The server can't find the requested resource.</td></tr><tr><td>500</td><td>Internal Server Error - The server encountered an unexpected condition that prevented it from fulfilling the request.</td></tr></tbody></table>

## Error Message Standard

Error handling for all API methods must adhere to the RFC7807 standard, ensuring standardized and informative error responses for clients. Please see <https://www.rfc-editor.org/rfc/rfc7807>.&#x20;

Please see below of a standard example.&#x20;

{% code overflow="wrap" %}

```json
{
   "type":"",
   "title":"Your request parameter didn't validate.",
   "exception":{
      "reference":[
         "Mandate with the reference already exists."
      ],
      "individuals":[
         {
            "reference":[
               "Individual with the reference already exists."
            ]
         },
         {
            "reference":[
               "Individual with the reference already exists."
            ]
         }
      ]
   },
   "status":"400"
}
```

{% endcode %}

**RFC7807: Problem Details for HTTP APIs**

RFC7807 is a standard for providing machine-readable error details in HTTP API responses. It was designed to offer a consistent way for servers to return error information in a structured format, making it easier for clients to understand and react to issues.

#### Key Features of RFC7807

1. **Structured Error Responses**: RFC7807 proposes a standard format for error messages, including fields like `type`, `title`, `status`, `detail`, and `instance`. This structure ensures that error information is conveyed in a predictable and easily parsable manner.
2. **Extensibility**: The standard allows for custom properties to be added to the error response. This means that while there's a common base of error information, additional details specific to an application or domain can be included.
3. **Machine-Readable and Human-Friendly**: The error responses are designed to be both machine-readable (easy for software to parse) and human-friendly (easy for developers to understand and debug).
4. **Uniform Handling of Errors Across APIs**: By adhering to a standard, it simplifies the client's task in handling errors because the format remains consistent across different APIs.


---

# 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://verify-doc.tiller-verify.com/verify-api/endpoints/error-handling.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.
