# Errors and limits

> Every error says what happened, in plain words, with a code your code can act on.

Web page: https://www.signalvan.com/developers/errors-and-limits

## The shape of an error

Errors are `application/problem+json` (RFC 9457). Act on `code`; show `detail` and `hint` to people. Some carry an `app_url` to finish in SignalVan.

402 · application/problem+json:

```json
{
  "type": "https://api.signalvan.com/problems/not_entitled",
  "title": "Not enough credits",
  "status": 402,
  "detail": "This needs 600 credits and your account has 120 available. Add credits in SignalVan to continue.",
  "code": "not_entitled",
  "hint": "Lower max_credits, or top up in the app.",
  "app_url": "https://www.signalvan.com/settings/billing",
  "needed": 600,
  "available": 120,
  "next_step": "add_credits"
}
```

## Every code

| Status | Code | When | What to do |
| --- | --- | --- | --- |
| `400` | `invalid` | A field is not valid | Fix the field named in detail |
| `401` | `unauthorized` | No key, or a revoked or expired one | Check the key; make a new one |
| `402` | `not_entitled` | Not enough credits | Lower max_credits or top up |
| `403` | `scope_missing` | The key lacks a permission | Make a key with it |
| `404` | `not_found` | Unknown, or not yours | Check the id and the website |
| `409` | `plan_expired` | The plan is over 15 minutes old | Plan again |
| `409` | `busy` | Two lead searches already running | Wait for one, then start |
| `409` | `idempotency_conflict` | Same Idempotency-Key, another body | Use a new key |
| `422` | `needs_input` | The plan needs a setting | Plan again with it |
| `429` | `rate_limited` | Too many requests | Wait Retry-After seconds |
| `503` | `unavailable` | A short outage | Retry with backoff |

## Rate limits

- **300 a minute**: Reads, per key
- **60 a minute**: Plans and starts, per key
- **2 at once**: Lead searches running per website

Every answer carries the IETF RateLimit headers, so your code can slow down before it is refused. Over the limit, the answer is `429` with `Retry-After`.

Headers:

```text
RateLimit-Policy: "default";q=300;w=60
RateLimit: "default";r=287;t=41

HTTP/1.1 429 Too Many Requests
Retry-After: 12
```

## Retrying safely

Send an `Idempotency-Key` with every plan and start: the same request with the same key returns the first answer for 24 hours, so a network blip never starts a lead search twice.

> Retry `429` and `503` with backoff and jitter. Retrying `400`, `401`, `403` or `404` unchanged returns the same answer.
