# Errors

> Every error code the Deeper Research API returns, with its HTTP status and what to do about it.

Source: https://deeperesearch.com/docs/api/errors/

Every error has the same body. Handle errors by `code`, which is stable; the `message` is written for people and may change.

```json
{ "error": { "code": "exceeds_max_cost", "message": "Worst case is $6.10, above max_cost_usd $5.00" } }
```

## Request problems

| Status | Code               | Meaning and what to do                                                                               |
| ------ | ------------------ | ---------------------------------------------------------------------------------------------------- |
| `400`  | `invalid_json`     | The body isn’t valid JSON                                                                            |
| `413`  | `body_too_large`   | The body is over 128 KB. Upload large content as a [file](https://deeperesearch.com/docs/api/files/) |
| `422`  | `invalid_request`  | A field is missing or invalid. The message names the field, e.g. `query: Too small`                  |
| `422`  | `duplicate_vendor` | The same provider tier is listed twice                                                               |
| `404`  | `not_found`        | No such endpoint, or no research, report, file or webhook with that id in your organization          |

## Authentication

| Status | Code           | Meaning and what to do                                                                          |
| ------ | -------------- | ----------------------------------------------------------------------------------------------- |
| `401`  | `unauthorized` | No API key, or the key is invalid or revoked                                                    |
| `403`  | `forbidden`    | The key lacks the scope this needs, or this endpoint is for signed-in users in the web app only |

## Research and money

| Status | Code                   | Meaning and what to do                                                                                           |
| ------ | ---------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `402`  | `insufficient_credit`  | Not enough available credit for the worst case, or the account has debt. Add credit, or choose cheaper providers |
| `422`  | `exceeds_max_cost`     | The worst case is above `max_cost_usd`. Raise it, or choose cheaper providers. Nothing was charged               |
| `422`  | `vendor_unavailable`   | A provider or tier can’t run on this account. See `GET /v1/vendors`                                              |
| `422`  | `attachment_not_found` | A file id in `attachments` isn’t in your organization                                                            |
| `422`  | `attachment_not_ready` | A file is still uploading or processing, or failed. Wait until its `status` is `ready`                           |
| `409`  | `idempotency_conflict` | This `Idempotency-Key` was already used with a different body. Use a new key                                     |
| `409`  | `not_cancellable`      | The research already finished                                                                                    |
| `409`  | `research_active`      | Research can’t be deleted while it, or a merge on it, is running. Cancel it or wait                              |
| `409`  | `credit_held`          | Research can’t be deleted while credit is still held for it. Try again shortly                                   |

## Merges

| Status | Code                             | Meaning and what to do                                                                   |
| ------ | -------------------------------- | ---------------------------------------------------------------------------------------- |
| `422`  | `insufficient_mergeable_vendors` | A merge requested with research needs at least two mergeable providers                   |
| `422`  | `no_mergeable_reports`           | No finished reports can be merged yet, or none of the chosen ones are mergeable          |
| `422`  | `report_not_found`               | A `report_ids` entry isn’t a provider report of this research                            |
| `422`  | `invalid_merge_config`           | Unknown model, or a thinking level the model doesn’t support. See `GET /v1/merge/models` |
| `503`  | `merge_unavailable`              | Synthesis merging isn’t available right now                                              |

## Webhooks

| Status | Code                  | Meaning and what to do                 |
| ------ | --------------------- | -------------------------------------- |
| `422`  | `invalid_webhook_url` | The URL must be public and use `https` |

## Limits

| Status | Code             | Meaning and what to do                                                                                                                 |
| ------ | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `429`  | `rate_limited`   | Over 120 requests a minute for your organization. Wait for `Retry-After` seconds                                                       |
| `429`  | `quota_exceeded` | Too much research or merging is running at once, the daily spending budget is used up, or file storage is full. The message says which |

## Server errors

| Status | Code             | Meaning and what to do                                                                                                                           |
| ------ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `500`  | `internal_error` | Something went wrong on our side. Retry with backoff; for `POST /v1/research`, retry with the same `Idempotency-Key` so you can’t start it twice |
