# Limits

One file per request, at most 10 MB or 30 MB for a video. Starter workspaces share a test-signature allowance; approved organizations share request limits and, when billed, a monthly credit limit.

## File size

The cap depends on the media type of the file:

- An image or a PDF can be up to 10 MB, which is 10,000,000 bytes.
- A video (MP4 or MOV) can be up to 30 MB, which is 30,000,000 bytes.
- A video sent to [`POST /v1/validate`](/docs/validate) can be up to 32 MB, which is 32,000,000 bytes. Signing adds a manifest to the file, so a signed 30 MB video comes back a little over 30 MB, and the validation cap leaves room for it.

A file over the cap for its media type gets `413` with the code `file_too_large`, and nothing is signed or validated. The API stops reading as soon as the body passes that cap, and it refuses a request whose `Content-Length` is over that cap before it reads the body.

One request carries one file. To sign or validate several files, send one request for each file.

## Starter workspaces

A new starter workspace has 10 test-certificate signatures shared across every key in the workspace. Creating or rotating a key does not reset the allowance. There is no per-minute trial limit, but server capacity and a daily capacity shared across trial workspaces still apply.

An admitted request consumes one starter signature even if signing later fails. A request refused before admission does not consume one. When the workspace has no starter signatures left, the API returns `402` with `insufficient_credits`. For more API access, [contact sales](https://lensproof.app/contact-sales).

If shared trial capacity is reached, the API returns `429` with `trial_daily_cap`. Wait for `Retry-After` before trying again. The console shows the workspace's remaining starter allowance.

## Rate limits

Each approved organization has two limits, shared across every API key in the organization. Lens Proof sets these limits when approving the organization, and can update them later:

- A number of requests per minute, counted per calendar minute.
- A number of requests per day, counted per UTC day.

Unless Lens Proof chose other limits for your organization, those limits are 30 requests per minute and 1,000 requests per day. Every key in your organization counts toward the same limits. To ask for higher limits, [contact sales](https://lensproof.app/contact-sales).

When your organization reaches a limit, the API answers `429` with the code `rate_limited_per_minute` or `rate_limited_per_day`, and with a `Retry-After` header. The header holds the number of whole seconds until that limit resets. The API checks the daily limit first, so an organization that is out of requests for the day is told to wait until the next UTC day, not the next minute.

## Monthly credit limit

Lens Proof sets a monthly credit limit for an approved organization that it bills. The limit is the number of requests the organization may have admitted in one UTC month, counted the way the daily limit is counted. The count starts again at 00:00 UTC on the first day of each month. An organization with no monthly credit limit has only the per-minute and per-day limits.

When the count reaches the limit, the API answers `402` with the code `credit_limit_reached` and a `Retry-After` header. The header holds the number of whole seconds until the count starts again, which is days, not a short wait, so do not retry on a timer. A refused request does not count. To raise the limit, an organization admin can ask in the developer console, and Lens Proof approves or declines the request. You can also [contact sales](https://lensproof.app/contact-sales).

Lens Proof can also put an organization's signing on hold. A held organization gets `402` with `billing_hold`, keeps all of its API keys, and signs again as soon as the hold ends. The hold is checked before the per-minute and per-day limits, and a held request does not count. Validation is not held.

## How billing works

Lens Proof bills an approved organization after the fact, not in advance. Each finished UTC month, Lens Proof makes one invoice for that month's successful signatures, at the organization's price per signature. The invoice has a number such as `LPS-2026-0001`, and the number is the payment reference. Organization admins see their invoices in the developer console.

The console also shows an estimate for the month so far. The estimate is the successful signatures so far times the price per signature, before tax. It is an estimate, not an invoice, and the invoice for the month can differ from it.

An invoice has a due date. If it is still unpaid seven days after that date, signing is put on hold, as described above. Starting three days before the due date, the console shows a banner, and `X-Lens-Warnings` carries `invoice_due_soon`. If you question the invoice before its due date, Lens Proof can pause that invoice's hold for up to 30 days from when you raised it, and the console banner then says the invoice is under review. Other unpaid invoices still count. If the invoice stands, you get at least 7 more days to pay. Paying the invoice ends the hold, and signing resumes on the same keys with the next request.

### Which requests count

A request counts once the API admits it. Admission comes after the key, the organization's status, the `Content-Type`, and the server's capacity have been checked, and before the body is read. An admitted request counts even if it then ends in `400`, `413`, `415`, or `502`, because the file is checked after admission.

A request that the API refuses before admission does not count. Requests that end in `400` for a query string, an extra header, or an AI disclosure error (`invalid_ai_disclosure`, `ai_disclosure_required`, `ai_disclosure_locked`), `401`, `402`, `403`, `404`, `405`, `415` for an unsupported `Content-Type`, `429`, or `503` are refused before admission.

## Response headers

Every response from `POST /v1/sign` and `POST /v1/validate` carries `X-Request-Id`. A `200`, `402`, or `429` from `POST /v1/sign` for an approved organization also reports where the organization stands, so your code can raise an alert before a refusal. Each `Used` value is the number of requests admitted so far in that window. On a `200` it includes the request just admitted. On a refusal it is the count as it stands, and the refused request is not in it.

| Header | Meaning |
| --- | --- |
| `X-Request-Id` | The id of this request in Lens Proof's record of it. Quote it when you ask about a request. |
| `X-Lens-Limit-Minute`, `X-Lens-Used-Minute` | The per-minute limit, and the requests admitted in the current calendar minute. |
| `X-Lens-Limit-Day`, `X-Lens-Used-Day` | The daily limit, and the requests admitted in the current UTC day. |
| `X-Lens-Limit-Month`, `X-Lens-Used-Month` | The monthly credit limit, and the requests admitted in the current UTC month. Sent only when Lens Proof set a monthly credit limit for your organization. |
| `X-Lens-Warnings` | Warning words separated by commas. Absent when there are none. |
| `X-Lens-Starter-Remaining` | The starter signatures a starter workspace has left. A starter workspace gets this header and none of the others above. |

### Reading `X-Lens-Warnings`

Split the value on commas and compare each word exactly. Ignore a word you do not know, because new words can be added. Today there are two:

- `limit_near`: the month's count has reached 80% of the monthly credit limit and has not yet reached the limit. Alert on it, because signing stops at the limit until the next UTC month.

- `invoice_due_soon`: an invoice is due in 3 days or less, or is past its due date, and the hold has not started. The invoice number and dates are in the developer console, for every member of the organization.

A response with no `X-Lens-Warnings` header has no warning. The same warning shows in the developer console as a banner above the key list.

## Server capacity

Each API server signs a small number of files at a time. When a server is full, it answers `503` with the code `server_busy` and a `Retry-After` header, and the request does not count toward your limits.

## Validation

Requests to [`POST /v1/validate`](/docs/validate) do not use a signature, do not use a starter signature, and do not count toward the rate limits above. Validation has its own limit of 60 requests per calendar minute for each organization, shared across every key in the organization. At that limit, the API answers `429` with `rate_limited_per_minute` and a `Retry-After` header.

A validation request counts toward that limit once the key, the organization's status, the `Content-Type`, and the server's capacity have been checked, even if it then ends in `400`, `413`, `415`, `422`, `502`, `503`, or `504`. Each API server also validates a small number of files at a time. When it is full, it answers `503` with `server_busy` before it counts the request, so that request does not count. A `503` with `server_busy` from the busy validator behind the servers comes after the count, so that one does.

## Retries

A retry is a new request. The API does not deduplicate files or recover a previous output. If a signing retry is admitted, it consumes another starter signature or counts toward the organization's signing limits, even when the previous response was lost. An admitted validation retry counts toward the validation per-minute limit, never toward signing limits or starter signatures. Keep retries bounded.

- On `429`, wait the number of seconds in `Retry-After`, and then send the request again.
- On `402` with `credit_limit_reached`, do not retry on a timer. `Retry-After` is the time until the next UTC month. On `402` with `billing_hold`, do not retry until the hold ends. Neither counts toward your limits.
- On `503` with `server_busy`, wait the number of seconds in `Retry-After`, and then send the request again.
- On `500`, `502`, or `503` with `service_unavailable`, retry with exponential backoff, for example after 2, 4, and 8 seconds, and stop after a few attempts.
- On `504` with `validation_timeout`, retry once. A file that times out again is likely to keep timing out.
- On any other `4xx` status, fix the request before you send it again, as described in [Errors](/docs/errors).
