# Limits

Rate limits, one conversion at a time, and file limits.

> **Coming soon:** The Developer API opens soon. You can read the docs now; API keys arrive when it opens.

Every account has the same limits. If you need more, email contact@perfectvector.com: we can raise
them for your account.

## Request limits

| Limit | Live keys | Test keys | When you reach it |
|---|---|---|---|
| Conversions created per minute | 20 | 20 | `429 rate_limited` |
| `POST /v1/vectorizations` attempts per minute (every `POST`, also replays and refused requests) | about 40 | about 40 | `429 rate_limited` |
| Other requests per minute (status, downloads, `DELETE`, `GET /v1/account`) | about 120 | about 120 | `429 rate_limited` |
| Live conversions in progress at once | 1 | no limit | `429 too_many_in_flight` |
| Active API keys | 10, live and test together | | `409` in the Developers area |

- Limits apply to the whole account, across all of its keys. Test keys have their own counters.
- **Creates** are counted over the last 60 seconds: the next one is allowed when the oldest is a
  minute old. With test keys you can send 20 at once; live keys also run one conversion at a time
  (below). A replay with the same `Idempotency-Key` does not count as a create.
- **`POST` attempts** count every `POST`, including replays and requests refused with an error. The
  limit is twice the create limit, so it only matters for clients that retry in a tight loop.
- **Attempts and other requests** are counted by each of our servers separately, so these limits are
  approximate. Other requests allow a burst of up to 30 at once, then the rate of about 120 a minute.
- **One conversion at a time.** A second live `POST` while one is running answers
  `429 too_many_in_flight` with `Retry-After: 5`, or `402 insufficient_credits` when your available
  credits cover only the running conversion. Send the next image when the first one has finished.
  Requests are not queued for you.
- **Busy service.** When the API as a whole is at capacity, a `POST` answers `503 service_busy` with
  a `Retry-After`. Retry with the same `Idempotency-Key`.
- **Failed authentication.** Many requests with invalid keys from one IP address get
  `429 rate_limited` for a few minutes.

## Rate-limit headers

Authenticated responses carry the limit the request counted against: for a `POST` that created or
replayed a conversion, the create limit; for a `POST` refused before that, the attempts limit; for
everything else, the limit for other requests.

| Header | Meaning |
|---|---|
| `X-RateLimit-Limit` | Requests a minute for this limit. |
| `X-RateLimit-Remaining` | Requests you can send right now. For other requests this is at most the burst of 30. |
| `X-RateLimit-Reset` | Seconds until the next request is allowed again under this limit (for creates: until the oldest create in the window is a minute old). |
| `Retry-After` | On `429` and `503`: seconds to wait before the next try. |

Every `429` and `503` problem body also carries `retry_after` (seconds), except
`too_many_in_flight`, which uses the header only.

## Responses from the edge

Our network edge can answer some requests before they reach the API, with a `403` or a `429` whose
body is **not** `application/problem+json` and has no `request_id`. Slow down and retry later. If it
keeps happening, contact us with the time of the request and your IP address.

## File limits

| Limit | Value |
|---|---|
| Formats | PNG, JPEG, WebP (checked from the file's content, not its name) |
| File size | 5 MiB (5,242,880 bytes) |
| Image size | 100 to 4096 pixels on each side |
| Frames | One. Animated images are refused. |
| Request | `multipart/form-data` with the field `image` (required) and the field `options` (optional). No other fields. |

`GET /v1/account` returns your current limits in `limits`:

```json
"limits": {
  "requests_per_minute": { "create": 20, "read": 120 },
  "max_in_flight": 1,
  "max_variants": 1,
  "max_file_bytes": 5242880,
  "min_dimension": 100,
  "max_dimension": 4096,
  "formats": ["png", "jpeg", "webp"]
}
```

With a test key, `max_in_flight` is `null`.

[Site index](https://perfectvector.com/llms.txt) — available pages and descriptions.
