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

# Errors and limits

> Error codes, rate limits, credits and how to retry.

Every error the API sends is `application/problem+json` ([RFC 9457](https://www.rfc-editor.org/rfc/rfc9457)). Branch on `code`, which never changes within `v1`. `title` and `detail` are for people and may change.

```json theme={null}
{
  "type": "https://api.getriskdata.com/v1/errors/invalid-request",
  "title": "Invalid request",
  "status": 400,
  "code": "invalid_request",
  "detail": "The request body does not match CreateAnalysisRequest.",
  "request_id": "4f0c2a9e8d7b4c1fa6e3b2d1c0f9e8a7",
  "errors": [
    { "field": "latitude", "message": "Input should be a valid number" }
  ]
}
```

`errors` names each field that failed validation. It never repeats the value you sent.

Our edge proxy can answer `413` (request body over 10 MiB), `408`, `502` or `504` itself. These answers have no problem body, no `X-Request-Id` and no `X-API-Version`.

## Error codes

| HTTP | `code` | When |
| - | - | - |
| 400 | `invalid_request` | The body is not valid JSON or does not match the schema, the ID is not a UUID, or a query parameter is wrong. |
| 400 | `query_api_key_forbidden` | The API key was sent in the query string or the body. See [Authentication](https://docs.getriskdata.com/authentication.md). |
| 401 | `unauthorized` | The `Authorization` header is missing, or the key is invalid or revoked. |
| 403 | `forbidden` | The key's role may not do this, for example submit a location. |
| 403 | `insufficient_credits` | A credit limit on this key, its organization or a parent organization has no credit left or has ended. |
| 404 | `not_found` | The analysis does not exist or is outside your organization and its sub-organizations. Unknown paths answer this too. |
| 405 | `invalid_request` | The path does not accept this method. |
| 429 | `too_many_requests` | The key created analyses too fast. Wait for `Retry-After`. |
| 500 | `internal_error` | Something failed on our side. |
| 503 | `maintenance_in_progress` | Planned maintenance. Wait for `Retry-After`. |
| 503 | `service_unavailable` | A temporary outage. Retry with exponential backoff. |

## Rate limits

Each API key can send up to 10 `POST /analyses` requests per second. Your organization's limit can differ; ask support. Every authenticated `POST` counts, including one later refused as invalid. Above the limit, the API answers `429 too_many_requests` with `Retry-After: 1`, and the refused request uses no credit.

Reading analyses and downloading the OpenAPI contract are not limited.

## Credits

Each new analysis uses one credit from each credit limit set on the key, its organization or a parent organization. Polling and reading analyses are free. A request refused with a `4xx`, `429` or `503` uses no credit. A `500`, `502` or `504` on `POST` may still have created an analysis and used a credit.

## Retrying safely

* `GET`: retry `500`, `502`, `503` and `504`. Wait for `Retry-After` when present, otherwise back off exponentially.
* `POST`: retry `429` and `503` after `Retry-After`. If a `503` has none, back off exponentially. A retry after `500`, `502` or `504` can create a second analysis and use a second credit.
* Do not retry other `4xx` errors unchanged. Fix the request first.
* `POST /analyses` is not idempotent: each accepted request creates a new analysis and uses a credit. A retry after a timeout can create a second analysis, so keep each `analysis_id` you receive.

## Request IDs

Every API response carries an `X-Request-Id` header, and every error repeats it as `request_id`. Include it when you contact [support@getriskdata.com](mailto:support@getriskdata.com).

## Response headers

| Header | Meaning |
| - | - |
| `X-API-Version` | `v1` on every API response. |
| `X-Request-Id` | The ID of this request. |
| `Retry-After` | Seconds to wait, on in-progress analyses, `429` and `503 maintenance_in_progress`. Other `503` answers may omit it. |
| `Location` | On `202 Accepted`, the URL of the new analysis. |


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