> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.divert.ly/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.divert.ly/_mcp/server.

# Rate Limits & Errors

> Divertly API rate limits by plan, the error response format, HTTP status codes, and the full error code reference.

## Rate limits

Rate limits apply to every authenticated request, counted against a calls-per-minute (CPM) allowance over a rolling 60-second window:

| Credential                                 | Plan | Limit   |
| ------------------------------------------ | ---- | ------- |
| [API key](/docs/developers/authentication) | Free | 90 CPM  |
| [API key](/docs/developers/authentication) | Paid | 180 CPM |
| Session token (the dashboard)              | —    | 60 CPM  |

> **Warning**
>
> These limits may change without notice, to keep the platform available for everyone. Treat the numbers above as current guidance, not a guarantee — call the entitlements endpoint below for the authoritative, live value.

To see your organization's current allowance, call:

```bash
curl https://api.divert.ly/v1/organizations/{org_id}/entitlements \
  -H "Authorization: Key $CREDENTIAL"
```

The response includes `rateLimitCpm` — the number of calls your organization may currently make per minute.

If you go over the allowance, the request is refused with `429 Too Many Requests`, and the key is placed into a 60-second cooldown. During the cooldown, every request from that key is refused immediately, without waiting to see whether it would have fit inside the allowance.

> **Note**
>
> Dashboard session tokens are limited to 60 calls per minute. If you're building an integration, use an API key.

> **Note**
>
> If you're building an integration that calls the API on a schedule, back off for at least 60 seconds after a `429` before retrying, and check `rateLimitCpm` if you're not sure how much headroom you have.

## The error envelope

Every failed request returns the same shape:

```json
{
  "error": "invalid or missing authentication",
  "meta": {
    "errorCode": "E1740"
  }
}
```

`error` is a short, human-readable message. Its wording can change between releases, so don't match against it in code. `errorCode` is stable and machine-readable — use it to detect specific failure conditions.

## HTTP status codes

| Status                      | Meaning                                                                    |
| --------------------------- | -------------------------------------------------------------------------- |
| `400 Bad Request`           | The request body or parameters failed validation.                          |
| `401 Unauthorized`          | The credential is missing, malformed, or invalid.                          |
| `403 Forbidden`             | The credential is valid, but its role doesn't permit this action.          |
| `404 Not Found`             | No resource matches the given ID, or the path doesn't exist.               |
| `409 Conflict`              | A resource with that identifier already exists.                            |
| `429 Too Many Requests`     | The rate limit described above was exceeded.                               |
| `500 Internal Server Error` | An unexpected error occurred. The error is logged; retrying later is safe. |
| `501 Not Implemented`       | The endpoint exists but isn't implemented yet.                             |

## Error code reference

The tables below list the `errorCode` values you can expect to see from the documented endpoints, grouped by the part of the API that produced them.

### Authentication and authorization

| Code    | Meaning                                                  |
| ------- | -------------------------------------------------------- |
| `E1690` | The `Authorization` header is missing.                   |
| `E1700` | The `Authorization` header isn't in the expected format. |
| `E1710` | The credential wasn't sent with a recognized scheme.     |
| `E1740` | The credential is invalid or has expired.                |
| `E3300` | No authenticated credential was found on the request.    |
| `E3310` | The credential's role doesn't permit this action.        |
| `E3400` | The rate limit was exceeded.                             |

### Organizations and users

| Code    | Meaning                                                                          |
| ------- | -------------------------------------------------------------------------------- |
| `E1035` | The authenticated user no longer exists.                                         |
| `E1036` | The authenticated user's organization no longer exists.                          |
| `E1330` | No organization was found with that ID.                                          |
| `E1335` | The organization ID in the request doesn't match the authenticated organization. |
| `E1340` | The organization's data couldn't be retrieved.                                   |
| `E1230` | The new user request failed validation.                                          |
| `E1231` | The new user's email address was rejected.                                       |
| `E1240` | The new user couldn't be created.                                                |
| `E1250` | The user was created, but the welcome email couldn't be sent.                    |
| `E1260` | The list of users couldn't be retrieved.                                         |
| `E1270` | The user couldn't be deleted.                                                    |
| `E1280` | No user was found with that ID.                                                  |
| `E1290` | The user update request failed validation.                                       |
| `E1300` | The user couldn't be updated.                                                    |
| `E1310` | The user's audit events couldn't be retrieved.                                   |
| `E1320` | The organization's audit events couldn't be retrieved.                           |
| `E1325` | The organization's emails couldn't be retrieved.                                 |
| `E1820` | The organization's entitlements couldn't be retrieved.                           |

### API keys

| Code    | Meaning                                                  |
| ------- | -------------------------------------------------------- |
| `E3200` | The new API key request failed validation.               |
| `E3210` | The new API key couldn't be issued.                      |
| `E3220` | The list of API keys couldn't be retrieved.              |
| `E3230` | The API key deletion request failed validation.          |
| `E3240` | The API key couldn't be deleted.                         |
| `E3250` | The requested role exceeds what you're allowed to grant. |

### Domains

| Code              | Meaning                                                            |
| ----------------- | ------------------------------------------------------------------ |
| `E1350`           | The list of domains couldn't be retrieved.                         |
| `E1360`           | The new domain request failed validation.                          |
| `E1365`           | The domain couldn't be checked against the blocklist.              |
| `E1636`           | The domain matched a blocklist entry and can't be added.           |
| `E1370`           | The domain couldn't be created.                                    |
| `E1380`           | No domain was found with that ID.                                  |
| `E1390`           | The domain deletion request failed validation.                     |
| `E1395`           | The domain couldn't be deleted.                                    |
| `E1400` / `E1410` | The domain to verify couldn't be found.                            |
| `E1420`           | Domain verification failed — the required DNS record wasn't found. |
| `E1430`           | The TXT verification record didn't match the expected value.       |
| `E1440`           | The domain's verified status couldn't be saved.                    |
| `E1450`           | The domain's enabled state couldn't be changed.                    |

### Routes

| Code    | Meaning                                     |
| ------- | ------------------------------------------- |
| `E1460` | The list of routes couldn't be retrieved.   |
| `E1470` | The new route request failed validation.    |
| `E1480` | The route couldn't be created.              |
| `E1490` | The route update request failed validation. |
| `E1500` | The route couldn't be updated.              |
| `E1510` | No route was found with that ID.            |
| `E1520` | The route couldn't be deleted.              |
| `E3410` | No route matched the request path.          |

### Targets

| Code    | Meaning                                            |
| ------- | -------------------------------------------------- |
| `E1530` | The list of targets couldn't be retrieved.         |
| `E1540` | The new target request failed validation.          |
| `E1571` | The target URL's scheme must be `http` or `https`. |
| `E1550` | The target couldn't be created.                    |
| `E1560` | No target was found with that ID.                  |
| `E1570` | The target update request failed validation.       |
| `E1580` | The target couldn't be updated.                    |
| `E1590` | The target couldn't be deleted.                    |

### Risk

| Code    | Meaning                                                     |
| ------- | ----------------------------------------------------------- |
| `E3450` | The risk service couldn't be reached. Try again shortly.    |
| `E3460` | The domain was refused because the risk service flagged it. |
| `E3480` | The stored risk verdict couldn't be retrieved.              |
| `E3490` | The subject couldn't be re-scored on demand.                |

### QR codes

| Code              | Meaning                                        |
| ----------------- | ---------------------------------------------- |
| `E2100`           | The route for this QR code couldn't be found.  |
| `E2110`           | The domain for this QR code couldn't be found. |
| `E2120`           | The QR code couldn't be generated.             |
| `E2130` / `E2140` | The QR code couldn't be written.               |
| `E2150`           | No QR code was found.                          |
| `E2160` / `E3190` | The QR code couldn't be deleted.               |
| `E2170`           | The QR code couldn't be saved.                 |
| `E2180`           | The QR code couldn't be retrieved.             |

### General

| Code    | Meaning                       |
| ------- | ----------------------------- |
| `E3430` | The request was malformed.    |
| `E3440` | An unexpected error occurred. |