# Errors and limits

Every error the API returns, what it means and what to do about it, and the limits on keys, styles, videos and file links.

## The shape of an error

Every error is JSON with a sentence you can show a person. Some carry a `code` your software can act on.

```json
{
  "error": "This key may not make or delete formats. Change what it may reach on the API keys page at https://10xvid.com/app/api-keys.",
  "code": "scope"
}
```

## Status codes

| Status | What it means | What to do |
|---|---|---|
| `400` | Something sent is not right. The sentence says what. | Fix the request. |
| `401` | No key, or the key may not be used. | Send a key that works. |
| `402` | It cannot be paid for. | Add funds, or raise the key's limit. |
| `403` | The key may not reach this part of the API. | Use a key that may, or change its access. |
| `404` | No such format, video or route. | Check the id or the path. |
| `409` | Not yet: the format is not ready. The sentence says what it waits for. | Ask again later. |
| `429` | Too many videos are being made at once, or too many calls in a minute. The sentence says which. | Start more as others finish, or wait the seconds `Retry-After` gives. |

## Codes

| Code | With | Meaning |
|---|---|---|
| `key` | `401` | No key was sent, or it is not one, was deleted, is switched off, or ran out |
| `scope` | `403` | The key may not reach this part of the API |
| `funds` | `402` | Your credits and your top up balance do not cover it. `need` and `left` are in dollars. |
| `limit` | `402` | The key's monthly limit cannot pay for it. `limit`, `spent` and `need` are in dollars. |
| `route` | `404` | There is no such route |
| `rate` | `429` | Too many calls in a minute, from your account or from one address. `Retry-After` says when to try again. |

## Limits

| What | Limit |
|---|---|
| Videos being made at once | 10 for an account, the app and the API together. A call that would pass it gets `429`; the videos a format makes by itself start as others finish. |
| Calls | 120 a minute for an account, and 300 a minute from one address. Past them a call gets `429` with `code: "rate"`. |
| Styles in one format | 10 |
| Videos in one call | 6 |
| Shapes | 9:16, 1:1 and 16:9 |
| Length | 5 to 30 seconds |
| A file's link | Works for 7 days. Ask again for a fresh one. |
| Keys | 20 for an account |
| One top up | From $5 to $5,000 |
