# Error Handling

### Error Handling

#### Error Response Format

```json
{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Validation failed",
    "details": [
      {
        "field": "domain",
        "message": "Please provide a valid domain name"
      }
    ]
  }
}
```

#### Common Error Codes

| HTTP Status | Code                   | Description                    |
| ----------- | ---------------------- | ------------------------------ |
| 400         | `VALIDATION_ERROR`     | Invalid request body           |
| 401         | `UNAUTHORIZED`         | Missing or invalid token       |
| 403         | `FORBIDDEN`            | Insufficient permissions       |
| 404         | `DOMAIN_NOT_FOUND`     | Domain does not exist          |
| 409         | `DOMAIN_EXISTS`        | Domain already being monitored |
| 422         | `UNPROCESSABLE_ENTITY` | Business logic error           |
| 429         | `RATE_LIMITED`         | Too many requests              |
| 500         | `INTERNAL_ERROR`       | Server error                   |

#### Rate Limiting

The API implements rate limiting to ensure fair usage:

* **Standard limit:** 100 requests per minute per user
* **Bulk operations:** Count as single request
* **Rate limit headers:**
  * `X-RateLimit-Limit`: Maximum requests allowed
  * `X-RateLimit-Remaining`: Requests remaining
  * `X-RateLimit-Reset`: Unix timestamp when limit resets

***


---

# 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.payshield.ai/merchant-monitoring-api/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.
