# Lens Proof Sign API docs

This file holds every page of the Lens Proof Sign API docs, followed by the OpenAPI description of the API. Each part starts with its source address.

---

Source: https://sign.lensproof.app/docs.md

# Lens Proof Sign API

The Lens Proof Sign API adds Content Credentials to one file that your server sends, and validates Content Credentials in a file as JSON.

## How it works

Your server sends one `POST` request to `https://sign-api.lensproof.app/v1/sign`, with an API key in a header and the file as the request body. Lens Proof Sign adds a C2PA manifest to the file, signs it with the Lens Proof Sign certificate, and sends the signed file back as the response body. There is no job to poll, and Lens Proof Sign does not store the file or the signed file.

To validate a file programmatically, your server sends a `POST` request to `https://sign-api.lensproof.app/v1/validate` with the same API key and file bytes. The API returns the C2PA validation report as crJSON without modifying the file or using a signature.

The request body contains only the file. On `/v1/sign`, optional closed-enum AI disclosure headers and the API key's AI disclosure policy can affect the manifest. The API refuses freeform titles, filenames, author fields, and other customer-supplied metadata.

## Start with a test signature

Sign in to the [developer console](/developers), start a workspace, and copy the API key shown once. New starter workspaces receive 10 test-certificate signatures without payment or manual approval. The [quickstart](/docs/quickstart) takes you from a key to a signed sample file. Starter results use a test certificate that is not publicly trusted.

Prefer to see a result before signing in? Try the [browser playground](https://sign.lensproof.app/#playground).

## What you need

- An API key, which an admin of your organization creates in the [developer console](/developers). See [Authentication](/docs/authentication).
- A server that can make HTTPS requests. Keys are for servers, and the API refuses requests that come from a web page.
- A file of a [supported media type](/docs/media-types) that is at most 10 MB, or at most 30 MB for a video.

## Where to go next

- [Quickstart](/docs/quickstart) signs a first file with curl, Node, or Python.
- [`POST /v1/sign`](/docs/reference) describes the signing request, the response, and the order of checks.
- [`POST /v1/validate`](/docs/validate) describes how to validate a file and read the crJSON report.
- [Errors](/docs/errors) lists every error code and what to do about it.
- [Rules for AI agents](/docs/agents) lists the rules that an AI coding agent must follow when it writes code that calls the API.

## Versions and changes

The API version is part of the URL path, so requests go to `/v1/sign` and `/v1/validate`. Breaking changes ship under a new major version path rather than changing `/v1/` behavior in place, and any deprecation is announced in the [changelog](/changelog) with migration guidance before removal.

## Docs for agents and tools

Every page is also available as Markdown at its address plus `.md`, for example [/docs/quickstart.md](/docs/quickstart.md), and **Copy page as Markdown** at the top of each page copies the same text. [/llms.txt](/llms.txt) lists every page, and [/llms-full.txt](/llms-full.txt) holds every page and the API description in one file. [/openapi.json](/openapi.json) and [/openapi.yaml](/openapi.yaml) publish the OpenAPI 3.1 description of the API, and [/.well-known/api-catalog](/.well-known/api-catalog) exposes the RFC 9727 API catalog.

## Commercial terms

These docs do not cover plans or prices. [Limits](/docs/limits#how-billing-works) explains how monthly invoices work. For commercial terms, [contact sales](https://lensproof.app/contact-sales).

---

Source: https://sign.lensproof.app/docs/quickstart.md

# Quickstart

Sign a first file by sending it from your server with an API key, then check the signed file in Lens Proof Check.

## Before you start

- Sign in to the [developer console](/developers) and start a workspace for 10 test-certificate signatures and an API key. Copy the key when it appears; it is shown only once. If you already belong to a team, ask its admin for a key. See [Authentication](/docs/authentication).
- Put the key in an environment variable named `LENS_PROOF_SIGN_API_KEY` on your server. Never put the key in browser code or in a repository.
- Choose a file of a [supported media type](/docs/media-types) that is at most 10 MB, or at most 30 MB for a video. The samples below sign a JPEG named `photo.jpg`.
- If you want a sample image to test with, download [photo.jpg](/samples/photo.jpg).

## Send the file

Send the file's bytes as the request body, and set `Content-Type` to the file's media type. Do not send a form upload (`multipart/form-data`), a query string, or freeform metadata. Optional AI disclosure headers are listed in [Headers](/docs/reference#headers).

To sign your own file, change only `FILE`, for example `FILE=/path/to/IT.png`. The curl sample sets `Content-Type` from the file's bytes with `file --mime-type`, because the API checks the bytes, not the name: a JPEG saved as `IT.png` is still a JPEG. The signed file is saved as `signed-` followed by your file's name. Slim server images such as Alpine or Debian slim often leave out `file`; the sample then stops with `file: command not found` before it sends anything. Install it (`apk add file` or `apt-get install file`), or replace the `TYPE` line with the type itself, such as `TYPE=image/jpeg &&`. If you write your own command, keep two things:

- Keep the `@` before the path, as in `--data-binary @photo.jpg`. Without it, curl sends the path as text, and the API answers `400` with the code `unrecognized_file`.
- Set `Content-Type` to the type of the file's bytes, not the type its name suggests. If the two disagree, the API answers `415` with the code `type_mismatch`, and the message names the type to send. If `file` prints a type that is not in [Media types](/docs/media-types), the API does not accept the file.

The signed file is always the same type as the file you send. The API does not convert between types. To get another type, convert the file first and then sign it, because converting a signed file breaks its credentials.

```bash title="curl"
FILE=photo.jpg &&
TYPE=$(file --mime-type -b "$FILE") &&
curl https://sign-api.lensproof.app/v1/sign \
  --request POST \
  --header "Authorization: Bearer $LENS_PROOF_SIGN_API_KEY" \
  --header "Content-Type: $TYPE" \
  --data-binary @"$FILE" \
  --fail-with-body \
  --output "signed-$(basename "$FILE")"
```

```js title="Node"
import { readFile, writeFile } from "node:fs/promises";

const response = await fetch("https://sign-api.lensproof.app/v1/sign", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.LENS_PROOF_SIGN_API_KEY}`,
    "Content-Type": "image/jpeg",
  },
  body: await readFile("photo.jpg"),
});

if (!response.ok) {
  const { error } = await response.json();
  throw new Error(`Signing failed with ${response.status} ${error.code}: ${error.message}`);
}

await writeFile("signed.jpg", Buffer.from(await response.arrayBuffer()));
```

```python title="Python"
import os
from pathlib import Path

import requests

response = requests.post(
    "https://sign-api.lensproof.app/v1/sign",
    headers={
        "Authorization": f"Bearer {os.environ['LENS_PROOF_SIGN_API_KEY']}",
        "Content-Type": "image/jpeg",
    },
    data=Path("photo.jpg").read_bytes(),
    timeout=120,
)

if not response.ok:
    error = response.json()["error"]
    raise RuntimeError(f"Signing failed with {response.status_code} {error['code']}: {error['message']}")

Path("signed.jpg").write_bytes(response.content)
```

The Node sample is an ES module that needs Node 18 or later, so save it in a file named `sign.mjs`. The Python sample uses the `requests` package. To sign another file with the Node or Python sample, change `photo.jpg`, `image/jpeg`, and `signed.jpg` together. `Content-Type` must be the type of the file's bytes, as listed in [Media types](/docs/media-types).

## Read the response

A `200` response body is the signed file, with the same `Content-Type` that you sent, so save it as it is. Any other status has a JSON body with an error code, for example:

```json
{
  "error": {
    "code": "unauthorized",
    "message": "A valid API key is required."
  }
}
```

With `--fail-with-body`, curl writes the error JSON to `signed-photo.jpg` and exits with code 22, so check the exit code before you use the file. Run `cat signed-photo.jpg` to read the error. [Errors](/docs/errors) lists every code and what to do about it.

## Check the signed file

Open [Lens Proof Check](https://check.lensproof.app) and select the signed file (`signed-photo.jpg` from the curl sample, `signed.jpg` from the Node or Python sample). Check shows the Content Credentials in the file, and it reports signature integrity, signer certificate trust, and timestamp trust as separate results. To check a file from your server without using a signature, send it to [`POST /v1/validate`](/docs/validate) for the crJSON validation report. [Signed output](/docs/output) explains what the file contains.

## Sign AI-generated media

When your backend signs media generated or edited by an AI model, pass the closed-enum disclosure headers or attach a locked AI disclosure policy to the API key in the [developer console](/developers).

```bash
curl https://sign-api.lensproof.app/v1/sign \
  --request POST \
  --header "Authorization: Bearer $LENS_PROOF_SIGN_API_KEY" \
  --header "Content-Type: image/jpeg" \
  --header "X-Lens-AI-Source: trained_algorithmic_media" \
  --header "X-Lens-AI-Oversight: prompt_guided" \
  --data-binary @generated.jpg \
  --fail-with-body \
  --output signed.jpg
```

See [`POST /v1/sign`](/docs/reference#headers) for every supported AI disclosure value and the per-key disclosure policies.

---

Source: https://sign.lensproof.app/docs/authentication.md

# Authentication

Every request carries a Lens Proof Sign API key as a bearer token, and a key works only from a server.

## Send the key

Send the key in the `Authorization` header:

```text
Authorization: Bearer lps_live_<keyId>_<secret>
```

The prefix does not identify certificate trust. Starter-workspace keys also use this format and sign with a test certificate.

Each key starts with the fixed prefix `lps_live_`, followed by a key id of 16 lowercase hexadecimal characters, an underscore, and a secret of 43 characters. The key id is not secret, and the developer console shows it next to each key. The whole key is the secret.

A request with a missing, malformed, unknown, or wrong key gets `401` with the code `unauthorized` and a `WWW-Authenticate: Bearer` header. The answer is the same in all four cases, so it does not show whether a key exists.

## Keep the key on your server

The API refuses every request that carries an `Origin` header, with `403` and the code `origin_not_allowed`. Browsers add an `Origin` header to a `POST` request, so a key can't be used from a web page. The API also sets no cookies and allows no cross-origin requests.

- Keep the key in a secret store or an environment variable on your server.
- Never put the key in browser code, a mobile app, or anything else that runs on a user's device.
- Never put the key in a repository, a log, or an error report.
- Give each environment its own key, so that you can revoke one key without stopping the others.

If people upload files in your web app, send the files to your own server first, and call the API from there.

## Create a key

Sign in to the [developer console](/developers) with your Google account. If you do not belong to an organization yet, start a workspace to receive 10 test-certificate signatures and an automatically created API key. Copy the key when it appears; it is shown only once. No approval or payment is needed for this starter workspace.

If you already belong to a team, use that team's workspace. An organization waiting for approval follows the access status shown in the console. For access beyond the starter allowance, [contact sales](https://lensproof.app/contact-sales).

- Only an admin of the organization can create, rotate, or revoke keys. Any member of a trial or approved organization can see the list of keys.
- Each key has a label of 1 to 60 characters, and it lasts 1 to 365 days.
- An organization can hold 10 keys that are not revoked.
- The console shows the full key once, when it is created. Copy it into your secret store at that point, because it can't be shown again. If you lose a key, create another key and revoke the lost one.
- Starter signatures are shared across every key in the workspace. Approved organizations have shared request limits. See [Limits](/docs/limits) for admission, retries, and what consumes an allowance.

Lens Proof can also issue a key to you directly, under your organization's limits.

## Rotate a key

Rotate a key to replace it without a gap. Rotation creates a new key with the same label and AI disclosure policy, and the old key keeps working until you revoke it. The new key lasts as long as the old key was set to last, counted from the day you rotate it, up to 365 days.

1. Rotate the key in the console, and copy the new key into your secret store.
2. Deploy the new key to your servers.
3. Revoke the old key once no server uses it.

## Revoke a key

Revoke a key in the console when you no longer need it, and revoke it at once if it may have leaked. A revoked key stops working on the next request, and requests with it get `403` with the code `key_revoked`. A request that is already running when you revoke its key still finishes.

A key also stops working when it expires, and requests with it then get `403` with the code `key_expired`. Rotate a key before its expiry date to avoid a gap. If Lens Proof pauses your organization's access, requests with any of its keys get `403` with the code `customer_paused`.

---

Source: https://sign.lensproof.app/docs/reference.md

# POST /v1/sign

Signs one file and returns the signed file as the response body.

## Request

```text
POST https://sign-api.lensproof.app/v1/sign
Authorization: Bearer lps_live_<keyId>_<secret>
Content-Type: image/jpeg

<the bytes of the file>
```

### Body

The body is the raw bytes of one file, at most 10 MB for an image or a PDF and at most 30 MB for a video. Send the bytes as they are. A form upload (`multipart/form-data`) gets `415` because its `Content-Type` is not a file type, and base64 text or JSON sent with a file's `Content-Type` gets `400` with the code `unrecognized_file`.

### Headers

| Header | Required | Value |
| --- | --- | --- |
| `Authorization` | Yes | `Bearer` and your API key, as described in [Authentication](/docs/authentication). |
| `Content-Type` | Yes | The file's media type, one of the [supported media types](/docs/media-types). Parameters such as `; charset=binary` are ignored, and case does not matter. |
| `Content-Length` | No | Most clients set it. A `Content-Length` over the cap for the file's type (10 MB, or 30 MB for a video) gets `413` before the body is read. |
| `X-Lens-AI-Source` | No | Optional downstream AI disclosure: `trained_algorithmic_media` (AI-generated) or `composite_with_trained_algorithmic_media` (edited with AI). Records `c2pa.ai-disclosure` and, on unsigned inputs, `c2pa.ingredient.v3.digitalSourceType`. A key's AI disclosure policy can require, default, or lock this value. |
| `X-Lens-AI-Oversight` | No | Optional human oversight level (`fully_autonomous`, `prompt_guided`, or `human_validated`) recorded in `c2pa.ai-disclosure`. Accepted only when `X-Lens-AI-Source` is also sent in the request. |

The API accepts only these other headers, which HTTP clients and proxies add on their own: `Transfer-Encoding`, `Expect`, `Host`, `Connection`, `Keep-Alive`, `TE`, `Accept`, `Accept-Encoding`, `Accept-Language`, `User-Agent`, `Cache-Control`, `Pragma`, `Forwarded`, `Via`, `Traceparent`, `Tracestate`, `X-Real-IP`, and headers that start with `X-Forwarded-`, `X-Cloud-`, `X-Goog-`, or `Sec-Fetch-`.

A request with an `Origin` header gets `403` with the code `origin_not_allowed`. A request with any other header outside the list, including `Cookie`, `Content-Disposition`, `Content-Encoding`, and custom `X-` headers, gets `400` with the code `unsupported_request`.

### Per-key AI disclosure policies

Organization admins can set an optional AI disclosure policy when creating an API key in the [developer console](/developers). Rotation preserves the key's policy.

- `optional`: the default behavior; callers decide whether to send AI disclosure headers.
- `required`: requests without `X-Lens-AI-Source` get `400` with `ai_disclosure_required` before the body is read.
- `default`: applies the key's configured source and optional oversight when the request omits AI disclosure headers, while letting callers override per request.
- `locked`: always applies the key's configured source and optional oversight, and refuses conflicting headers with `400` and `ai_disclosure_locked`.

### Query string

The API accepts no query string. A request with one gets `400` with the code `unsupported_request`.

## Response

### Success

A successful request gets `200`, and the body is the signed file.

| Header | Value |
| --- | --- |
| `Content-Type` | The media type you sent. |
| `Content-Disposition` | `attachment; filename="<UTC date>_output.<ext>"`, for example `attachment; filename="2026-11-23_output.jpg"`. The name never comes from your request. |
| `Content-Length` | The size of the signed file in bytes. |
| `Cache-Control` | `no-store` |
| `X-Content-Type-Options` | `nosniff` |

The response sets no cookies. [Signed output](/docs/output) explains what the signed file contains.

### Errors

Any other status has a JSON body with a stable code and a sentence for people:

```json
{
  "error": {
    "code": "file_too_large",
    "message": "Photos can be up to 10 MB."
  }
}
```

Match on `error.code`, because the message can change. [Errors](/docs/errors) lists every code with its status.

## Order of checks

The API runs its checks in this order, and it answers with the first check that fails. It does not read the body until every check before the file has passed.

1. The `Origin` header. A request with one gets `403` with `origin_not_allowed`.
2. The method. Any method other than `POST` gets `405` with `method_not_allowed` and an `Allow: POST` header.
3. The query string, headers, and AI disclosure header values. Anything outside the accepted list gets `400` with `unsupported_request`, and unsupported AI disclosure header values (or `X-Lens-AI-Oversight` without `X-Lens-AI-Source`) get `400` with `invalid_ai_disclosure`.
4. The key and its AI disclosure policy. A key that is not valid gets `401` or `403`, as described in [Authentication](/docs/authentication). A request that conflicts with the key's AI disclosure policy gets `400` with `ai_disclosure_required` or `ai_disclosure_locked`.
5. Whether signing is available. When it is not, the answer is `503` with `service_unavailable`.
6. The `Content-Type`. A missing or unsupported type gets `415` with `unsupported_media_type`.
7. The server's capacity. A server that is already signing as many files as it can answers `503` with `server_busy`.
8. Your organization's status, allowance, and rate limits. A paused organization gets `403` with `customer_paused`, a starter workspace with no starter signatures left gets `402` with `insufficient_credits`, and an organization or trial pool at its limit gets `429`, as described in [Limits](/docs/limits).
9. The file. It must be at most 10 MB, or 30 MB for a video, and its bytes must be a supported file of the type that `Content-Type` names. Then Lens Proof Sign signs it.

On a host where the API is not enabled, every request gets `404` with `not_found`.

## Machine-readable description

[/openapi.yaml](/openapi.yaml) describes this endpoint in OpenAPI 3.1.

---

Source: https://sign.lensproof.app/docs/validate.md

# POST /v1/validate

Validates the Content Credentials in one file and returns the C2PA validation report as JSON.

## Request

```text
POST https://sign-api.lensproof.app/v1/validate
Authorization: Bearer lps_live_<keyId>_<secret>
Content-Type: image/jpeg

<the bytes of the file>
```

The request has the same shape as [`POST /v1/sign`](/docs/reference): one file as the raw body (at most 10 MB, or 32 MB for a video, so a signed 30 MB video fits), your API key, and a `Content-Type` that names one of the [supported media types](/docs/media-types). The file's bytes must be that type.

```bash title="curl"
curl https://sign-api.lensproof.app/v1/validate \
  --request POST \
  --header "Authorization: Bearer $LENS_PROOF_SIGN_API_KEY" \
  --header "Content-Type: image/jpeg" \
  --data-binary @signed.jpg \
  --fail-with-body
```

```js title="Node"
import { readFile } from "node:fs/promises";

const response = await fetch("https://sign-api.lensproof.app/v1/validate", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.LENS_PROOF_SIGN_API_KEY}`,
    "Content-Type": "image/jpeg",
  },
  body: await readFile("signed.jpg"),
});

const body = await response.json();
if (!response.ok) {
  throw new Error(`Validation failed with ${response.status} ${body.error.code}: ${body.error.message}`);
}

const active = body.manifests[0].validationResults;
console.log({ success: active.success, failure: active.failure });
```

```python title="Python"
import os
from pathlib import Path

import requests

response = requests.post(
    "https://sign-api.lensproof.app/v1/validate",
    headers={
        "Authorization": f"Bearer {os.environ['LENS_PROOF_SIGN_API_KEY']}",
        "Content-Type": "image/jpeg",
    },
    data=Path("signed.jpg").read_bytes(),
    timeout=60,
)

body = response.json()
if not response.ok:
    error = body["error"]
    raise RuntimeError(f"Validation failed with {response.status_code} {error['code']}: {error['message']}")

active = body["manifests"][0]["validationResults"]
print({"success": active["success"], "failure": active["failure"]})
```

To validate another file with the Node or Python sample, change `signed.jpg` and `image/jpeg` together.

### Headers

| Header | Required | Value |
| --- | --- | --- |
| `Authorization` | Yes | `Bearer` and your API key, as described in [Authentication](/docs/authentication). |
| `Content-Type` | Yes | The file's media type, one of the [supported media types](/docs/media-types). |
| `Content-Length` | No | Most clients set it. A `Content-Length` over the cap for the file's type (10 MB, or 32 MB for a video) gets `413` before the body is read. |

The API also accepts the headers that HTTP clients and proxies add on their own, the same list as for [`POST /v1/sign`](/docs/reference#headers). It does not accept `X-Lens-AI-Source` or `X-Lens-AI-Oversight`, because validation writes nothing into the file. A request with either header, any other header outside the list, or a query string gets `400` with `unsupported_request`. A request with an `Origin` header gets `403` with `origin_not_allowed`.

## Response

### Success

A `200` response body is the validation report in crJSON, the JSON form of Content Credentials that C2PA defines. The validator is c2pa-rs, the open-source C2PA library, and the API returns its report unchanged.

| Header | Value |
| --- | --- |
| `Content-Type` | `application/json; charset=utf-8` |
| `Content-Length` | The size of the validation report in bytes. |
| `Cache-Control` | `no-store` |
| `X-Content-Type-Options` | `nosniff` |

The response has no `Content-Disposition` and sets no cookies. This shortened report is for a file signed with a test certificate:

```json
{
  "@context": { "@vocab": "https://c2pa.org/crjson" },
  "manifests": [
    {
      "label": "urn:c2pa:3b3c42a6-a516-4749-b723-7082d651194c",
      "validationResults": {
        "success": [
          { "code": "claimSignature.validated", "explanation": "claim signature valid" },
          { "code": "assertion.dataHash.match", "explanation": "data hash valid" },
          { "code": "timeStamp.validated", "explanation": "timestamp message digest matched" },
          { "code": "timeStamp.trusted", "explanation": "timestamp cert trusted" }
        ],
        "informational": [
          { "code": "signingCredential.ocsp.skipped", "explanation": "OCSP fetching skipped" }
        ],
        "failure": [
          { "code": "signingCredential.untrusted", "explanation": "signing certificate untrusted" }
        ],
        "specVersion": "2.3.0",
        "validationTime": "2026-11-26T05:56:30.728330+00:00"
      }
    }
  ],
  "jsonGenerator": { "name": "c2pa-rs", "version": "0.92.2" }
}
```

### Reading the report

A `200` means the API read the file's Content Credentials and wrote a report. It does not mean the file passed. A file whose Content Credentials fail, such as an edited file or one signed with a certificate that is not on the trust list, also gets `200`, with the problems listed under `failure`.

- `manifests` lists every manifest in the file, and the active manifest comes first.
- `validationResults` on each manifest holds `success`, `informational`, and `failure` lists of C2PA status codes, the C2PA specification version the validator follows, and the time of validation.
- Signature integrity, signer certificate trust, and timestamp trust are separate codes. For example, `claimSignature.validated` and `assertion.dataHash.match` (or `assertion.bmffHash.match` for BMFF formats such as MP4, MOV, HEIC, and AVIF) are about integrity, `signingCredential.trusted` or `signingCredential.untrusted` is about the signer certificate, and `timeStamp.trusted` is about the timestamp. Report each one separately, and do not turn a `200` into a single pass or fail.
- The API adds no verdict of its own. Match on the `code` values, because the `explanation` text can change between versions of the validator.

Files signed by Lens Proof Sign with a test certificate, including starter workspace files, report `signingCredential.untrusted`, because the test certificate is not on the C2PA Trust List.

## What the API checks

- The validator checks signer certificates against the C2PA Trust List and timestamps against the C2PA TSA Trust List. Both lists are fixed in the service and change only with a new release.
- The validator fetches nothing over the network. It does not fetch a manifest that the file points to elsewhere, it does not check certificate revocation online, which the report shows as `signingCredential.ocsp.skipped`, and it does not download certificates.
- The time of validation is the time of the request.

Other validators can use other trust lists, so they can report trust differently for the same file.

## Errors

Errors have the same JSON body as every other error, described in [Errors](/docs/errors). These are specific to validation:

| Status | Code | Meaning |
| --- | --- | --- |
| 422 | `no_credentials` | The file has no Content Credentials. |
| 422 | `manifest_unreadable` | The file has Content Credentials that could not be read. |
| 422 | `remote_manifest_not_fetched` | The file points to Content Credentials stored elsewhere, and the API does not fetch them. |
| 422 | `report_too_large` | The report would be larger than 16 MB. |
| 502 | `validation_failed` | Validation failed, and no report was returned. |
| 504 | `validation_timeout` | Validation took longer than 30 seconds, and no report was returned. |

## Limits

Validation does not use a signature, does not use a starter signature, and does not count toward your organization's signing limits. It has its own limit of 60 requests per calendar minute for each organization, shared across every key in the organization. At the limit, the API answers `429` with `rate_limited_per_minute` and a `Retry-After` header.

Each API server validates a small number of files at a time. When a server is full, it answers `503` with `server_busy` and a `Retry-After` header before it counts the request, so the request does not count toward the validation limit. The validator behind the servers has its own small capacity. When it is busy, the answer is also `503` with `server_busy`, but the request has already counted.

## Order of checks

The API runs its checks in this order, and it answers with the first check that fails. It does not read the body until every check before the file has passed.

1. The `Origin` header.
2. The method. Any method other than `POST` gets `405` with an `Allow: POST` header.
3. The query string and the headers.
4. The key, as described in [Authentication](/docs/authentication).
5. Your organization's status. A paused organization gets `403` with `customer_paused`.
6. Whether validation is available. When it is not, the answer is `503` with `service_unavailable`.
7. The `Content-Type`.
8. The server's capacity.
9. Your organization's validation limit. A request that passes this check counts toward the limit.
10. The file. It must be at most 10 MB, or 32 MB for a video, and its bytes must be a supported file of the type that `Content-Type` names. Then the validator reads it.

## Data handling

Validation handles the file the way signing does, as described in [Data handling](/docs/data-handling). The file is held in memory while it is validated, and neither the file nor the report is stored. The request log holds the event name, the route, a request ID, the media type, a size range, the status, and the duration, and nothing from the file or the report.

## Machine-readable description

[/openapi.yaml](/openapi.yaml) describes this endpoint in OpenAPI 3.1.

---

Source: https://sign.lensproof.app/docs/media-types.md

# Media types

The API signs and validates the image, video, and document types below, and the `Content-Type` header must name one of them exactly.

## Images

- JPEG, `image/jpeg`
- PNG, `image/png`
- WebP, `image/webp`
- GIF, `image/gif`
- TIFF, `image/tiff`
- HEIC and HEIF, `image/heic`
- AVIF, `image/avif`

## Video

- MP4, `video/mp4`
- MOV (QuickTime), `video/quicktime`

## Documents

- PDF, `application/pdf`

## How the type is checked

Set `Content-Type` to the type of the file you send. The API also reads the start of the file to find its real type, and it accepts the file only when the two agree. A file whose bytes are another supported type gets `415` with the code `type_mismatch`, and a file that the API can't identify gets `400` with the code `unrecognized_file`. Nothing is signed or validated in either case.

The API accepts no other names for these types, such as `image/heif`, `image/x-tiff`, or `video/x-m4v`. Send the type listed here, even for a file with another extension such as `.heif` or `.m4v`. A missing or unlisted `Content-Type` gets `415` with the code `unsupported_media_type`.

The size cap is 10 MB for an image or a PDF and 30 MB for a video, as described in [Limits](/docs/limits).

---

Source: https://sign.lensproof.app/docs/limits.md

# 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).

---

Source: https://sign.lensproof.app/docs/errors.md

# Errors

Every error response has a JSON body with a stable `code` and a `message` for people, and the status tells you whether a retry can help.

## Error body

```json
{
  "error": {
    "code": "rate_limited_per_minute",
    "message": "This organization has reached its per-minute limit."
  }
}
```

Branch on `error.code`. The `message` is a plain sentence that can change, so show it to people or log it, but don't parse it.

Some errors also carry a header. A `401` has `WWW-Authenticate: Bearer`, a `405` has `Allow: POST`, and a `429`, a `402` with `credit_limit_reached`, or a `503` with `server_busy` has `Retry-After` in whole seconds.

Every response from `POST /v1/sign` and `POST /v1/validate`, success or error, carries `X-Request-Id`. It is the id of that request in Lens Proof's own record, so quote it when you ask about a request. The record holds no file data. A `402` or `429` from signing also carries the `X-Lens-*` headers that show where your organization stands against its limits, described in [Limits](/docs/limits#response-headers).

## Error codes

| Status | Code | Meaning | What to do |
| --- | --- | --- | --- |
| 400 | `unsupported_request` | The request has a query string or a header outside the accepted list. | Send only the file and the accepted headers, as listed in [Headers](/docs/reference#headers). |
| 400 | `invalid_ai_disclosure` | `X-Lens-AI-Source` or `X-Lens-AI-Oversight` has an unsupported value, or `X-Lens-AI-Oversight` was sent without `X-Lens-AI-Source`. | Use the supported AI disclosure header values in [Headers](/docs/reference#headers), or omit both headers. |
| 400 | `ai_disclosure_required` | The API key requires an AI disclosure policy, and `X-Lens-AI-Source` was omitted. | Send `X-Lens-AI-Source`, or use a key whose policy does not require AI disclosure. |
| 400 | `ai_disclosure_locked` | The API key locks AI disclosure to configured values, and the request sent a conflicting AI disclosure header. | Omit the AI disclosure headers to apply the key's locked values, or send headers that match the key's policy. |
| 400 | `unrecognized_file` | The body is not a file of any supported media type. | Send the raw bytes of the file, not a form upload, base64 text, JSON, or the file's path. With curl, put `@` before the path, as in `--data-binary @photo.jpg`. |
| 401 | `unauthorized` | The key is missing, malformed, unknown, or wrong. | Check the `Authorization` header and the key. A retry with the same key gets the same answer. |
| 402 | `insufficient_credits` | Your trial organization has used all of its starter signatures. | [Contact sales](https://lensproof.app/contact-sales) for more API access. |
| 402 | `credit_limit_reached` | Your organization reached its monthly credit limit. Signing resumes at 00:00 UTC on the first day of the next month. | Do not retry before then. `Retry-After` is the number of seconds until the count starts again. An admin can ask for a higher limit in the developer console, or [contact sales](https://lensproof.app/contact-sales). The refused request does not count. |
| 402 | `billing_hold` | Signing is on hold for your organization. The `message` says whether Lens Proof put the hold on, or an invoice is past due, and when an invoice holds signing it names the invoice number. Your keys are kept. | Pay the invoice the message names, quoting its number as the payment reference, or [contact sales](https://lensproof.app/contact-sales). An organization admin can find the invoice in the developer console, under Billing. Signing resumes on the same keys when the hold ends. Validation is not held. |
| 403 | `origin_not_allowed` | The request has an `Origin` header, which browsers send. | Call the API from your server, not from a web page. |
| 403 | `key_revoked` | The key was revoked. | Use another key, or ask an organization admin to create one in the developer console. |
| 403 | `key_expired` | The key has expired. | Use another key, or ask an organization admin to rotate it or create one in the developer console. |
| 403 | `customer_paused` | API access is not open for your organization: it is paused, or not approved yet. | [Contact sales](https://lensproof.app/contact-sales). |
| 404 | `not_found` | The API is not enabled on this host. | Check that the URL is `https://sign-api.lensproof.app/v1/sign` or `https://sign-api.lensproof.app/v1/validate`. |
| 405 | `method_not_allowed` | The method is not `POST`. | Send a `POST` request. |
| 413 | `file_too_large` | The file is larger than the cap for its type: 10 MB, or 30 MB for a video (32 MB when you validate one). | Send a file within that cap. See [Limits](/docs/limits). |
| 415 | `unsupported_media_type` | The `Content-Type` is missing or is not a supported media type. | Set `Content-Type` to one of the [supported media types](/docs/media-types). |
| 415 | `type_mismatch` | The bytes of the file are not the type that `Content-Type` names. | The message names the type the bytes turned out to be. Send the file again with `Content-Type` set to that type. The file's name plays no part. |
| 422 | `unreadable_file` | The file sent to `POST /v1/sign` is the type it declares, but it could not be read for signing. It may be damaged or incomplete, for example a video cut off partway, or built in a way that is not supported. | A retry gets the same answer. Check that the file opens, or export it again, then send the new file. |
| 422 | `no_credentials` | The file sent to [`POST /v1/validate`](/docs/validate) has no Content Credentials. | Nothing to validate. Send a file that carries Content Credentials. |
| 422 | `manifest_unreadable` | The file sent to `POST /v1/validate` has Content Credentials that could not be read. | The Content Credentials are damaged or not in a form the validator reads. A retry gets the same answer. |
| 422 | `remote_manifest_not_fetched` | The file sent to `POST /v1/validate` points to Content Credentials stored elsewhere. | The API does not fetch them. Validate a file with Content Credentials embedded in it. |
| 422 | `report_too_large` | The validation report would be larger than 16 MB. | A retry gets the same answer. Contact Lens Proof if you need this file validated. |
| 429 | `rate_limited_per_minute` | Your organization reached its limit for this minute. | Wait the number of seconds in `Retry-After`, then retry. |
| 429 | `rate_limited_per_day` | Your organization reached its limit for this UTC day. | Wait the number of seconds in `Retry-After`, then retry. |
| 429 | `trial_daily_cap` | Starter signing reached its daily capacity across all trial accounts. | Wait the number of seconds in `Retry-After`, or [contact sales](https://lensproof.app/contact-sales) for more API access. |
| 500 | `internal_error` | The API hit an error it did not expect. | Retry with backoff, and contact Lens Proof if it keeps happening. |
| 502 | `signing_failed` | Signing failed, and no file was returned. | Retry with backoff, and contact Lens Proof if it keeps happening. |
| 502 | `validation_failed` | Validation failed, and no report was returned. | Retry with backoff, and contact Lens Proof if it keeps happening. |
| 503 | `service_unavailable` | Signing or validation is not available right now. | Retry with backoff. |
| 503 | `server_busy` | The server is already signing or validating as many files as it can. | Wait the number of seconds in `Retry-After`, then retry. |
| 504 | `validation_timeout` | Validation took longer than 30 seconds, and no report was returned. | Retry once. A file that times out again is likely to keep timing out. |

[Limits](/docs/limits#retries) explains which errors count toward your rate limits and how to retry. Requests to `POST /v1/validate` have their own limit, described in [Limits](/docs/limits#validation).

---

Source: https://sign.lensproof.app/docs/output.md

# Signed output

A successful response is your file with a Content Credentials manifest added, in the same format as the file you sent.

## Certificate environment

Starter workspaces and the browser playground use a test certificate that is not publicly trusted. The API key's prefix does not establish production trust. Approved API access uses the signer configured for that environment; inspect the returned file with a validator before making a trust claim.

## What the signed file contains

The response body is the file you sent with a C2PA manifest embedded in it. Lens Proof Sign writes the manifest and signs it with the Lens Proof Sign certificate. Your request carries only the file and optional closed-enum AI disclosure headers, so no freeform title, filename, author, or other metadata from you can appear in the manifest.

The manifest describes the signing operation that Lens Proof Sign performed on the file you supplied. When AI disclosure is provided by headers or a key policy, the manifest records `c2pa.ai-disclosure` and, on unsigned inputs, `c2pa.ingredient.v3.digitalSourceType`. The manifest does not show who made the file, when or where the file was made, or that its contents are true.

The signed file keeps the media type you sent, and it is larger than the file you sent because it carries the manifest. Before it answers, the API checks that the signed file is still a file of that type, and it reads the file back to check that the manifest is embedded, that the claim signature and the file's hash match, and that the timestamp is valid. A signed file that fails these checks is not returned, and the request gets `502` with `signing_failed`. To get the full validation report for the signed file, send it to [`POST /v1/validate`](/docs/validate), or check it with a validator such as Lens Proof Check.

## Response headers

- `Content-Type` is the media type you sent.
- `Content-Disposition` is `attachment; filename="<UTC date>_output.<ext>"`. The name never comes from your request, so choose your own name when you save the file.
- `Cache-Control: no-store` and `X-Content-Type-Options: nosniff` are on every response.

## Check the file in Lens Proof Check

[Lens Proof Check](https://check.lensproof.app) reads Content Credentials in your browser. Open it and select the signed file. Check reports these results separately:

- Signature integrity, which says whether the manifest's signature is intact and the file still matches the manifest.
- Signer certificate trust, which says whether Check trusts the certificate that signed the manifest, under Check's trust list.
- Timestamp trust, which says whether the signature has a timestamp that Check trusts.

Other validators can use other trust lists, so they can report trust differently for the same file. Editing or exporting the signed file again can break the signature or remove the manifest, so sign the final version of a file.

---

Source: https://sign.lensproof.app/docs/data-handling.md

# Data handling

Lens Proof Sign signs and validates each file in memory, and it does not store the file you send, the signed file, or the validation report.

## What is not stored

- The file you send. It stays in memory only while Lens Proof Sign signs it.
- The signed file. It goes back to your server in the response, and Lens Proof Sign does not keep a copy.
- Filenames. The API accepts no filename, and the download name in the response is generic.
- Files you send to `POST /v1/validate`, and their validation reports. The file stays in memory only while it is validated, and the report goes back to your server in the response.
- Bank or card details. An approved organization pays its monthly invoice by bank transfer to Lens Proof's Wise Business account, and Lens Proof Sign does not connect to Wise.

Lens Proof Sign does not log filenames, file hashes, or file contents.

## What is stored

- Workspace access, organization status, shared rate limits, the starter-signature balance, and shared usage counts for the current minute, UTC day, and UTC month, so access and quotas can be enforced.
- For each approved organization and UTC month, the number of successful signatures, with the organization id and the time the count last changed. The month's estimate and its invoice are worked out from it. These monthly counts are kept 6 years.
- For an organization that Lens Proof bills, its billing terms (currency, the amount for one successful signature, payment days, and monthly credit limit), whether signing is on hold, and an admin's pending request for a higher limit, with the value, the time, and the admin's user id.
- For each invoice: the organization id and name, the invoice number, the billing month, the number of successful signatures, the amount for one signature, the total before tax, the currency, the payment days, the status, the times it was made, issued, due, held, paid, or voided, a Lens Proof note about the payment or the reason for a void, and the user id of the Lens Proof operator who made it. Invoices are kept 6 years.
- Your API keys. Lens Proof Sign stores a keyed hash of each key's secret, never the secret itself. Each key record also holds the key id, the label, your organization id (or a customer id that Lens Proof sets for a key it issues), the dates the key was created, expires, and was revoked, the last time it was used (updated at most once an hour), its optional AI disclosure policy, and its admitted request count for the current UTC day.
- A log line for each signing or validation request, with the event name, the route, a request id, the declared media type, a size range rather than the exact size, the response status, and how long the request took.
- An audit line for each key event, such as a key that was created, rotated, or revoked, a failed key check, or a reached limit. It holds the event, the key id, the outcome, and the time.
- An audit line for each action in the developer console, with the action, your organization id, the id of the user who acted, the key id, and the outcome.
- A log line for each billing notice to Lens Proof: when an organization nears its monthly limit, when an unpaid invoice is about to be due, and when a hold first refuses a request. It holds the organization id and either the month's request count and limit, or the invoice number with its due and hold dates. It holds no amount.

## More about privacy

The [privacy policy](/privacy) covers the rest of Lens Proof Sign. For a data processing agreement or other contract terms, [contact sales](https://lensproof.app/contact-sales).

---

Source: https://sign.lensproof.app/docs/agents.md

# Rules for AI agents

An AI coding agent that writes or runs code against the Lens Proof Sign API for a person must follow these rules.

## When to use Lens Proof Sign

Use Lens Proof Sign when a backend server or local shell script needs to attach C2PA Content Credentials to a customer-supplied PDF, photo, or video in one synchronous `POST /v1/sign` request without storing files or polling jobs, or when a server needs a crJSON validation report from `POST /v1/validate`.

Do not call the API from browser JavaScript or mobile clients, do not send freeform metadata fields, and do not describe a signed file as proof that its contents are real, true, or captured by Lens.

## Start here

For a new developer, open the [developer console](/developers), let the person sign in and create a starter workspace, and have them set `LENS_PROOF_SIGN_API_KEY` in their local environment. A starter workspace includes 10 test-certificate signatures. Never ask for the key in chat. Follow the [quickstart](/docs/quickstart) with its synthetic sample and report whether a file was returned and what validation actually established. The browser playground has separate anonymous test signing; do not send API keys to it.

## Rules

1. Keep the API key on a server. Read it from an environment variable such as `LENS_PROOF_SIGN_API_KEY` or a secret store. Never ask the person to paste the key in chat, and never put it in browser code, a client bundle, a mobile app, a log, or the repository.
2. Call the API only from server code. A browser request carries an `Origin` header and gets `403` with `origin_not_allowed`. If people upload files in a web app, send the files to the app's own server first, and call the API from there.
3. Send one file per request, as the raw request body, with `Content-Type` set to the file's media type. Never send `multipart/form-data`, base64 text, or JSON.
4. Send no query string. Use `Authorization`, `Content-Type`, and the headers the HTTP client adds on its own. On `POST /v1/sign`, you may also send the optional AI disclosure headers documented in [Headers](/docs/reference#headers); `POST /v1/validate` refuses those headers. Never send a title, a filename, an author, or other metadata, because the API refuses it with `400` and `unsupported_request`.
5. Check the file size before you send the file. A file over its cap gets `413` with `file_too_large`. The cap is 10 MB (10,000,000 bytes) for an image or a PDF and 30 MB (30,000,000 bytes) for a video.
6. Use only the types on the [media types page](/docs/media-types), and set `Content-Type` from the file's real type, not from its extension alone.
7. On a `200` from `POST /v1/sign`, save the response body as the signed file, and don't change it afterward, because a change can break the signature. On a `200` from `POST /v1/validate`, parse the crJSON report and inspect `validationResults` codes separately for signature integrity, signer certificate trust, and timestamp trust; a `200` does not mean the file passed.
8. On an error, read `error.code` from the JSON body and branch on it. Never parse `error.message`.
9. Retry a `429`, or a `503` with `server_busy`, only after the number of seconds in `Retry-After`. Retry a `500`, a `502`, or a `503` with `service_unavailable` with exponential backoff and a cap on attempts. Retry a `504` (`validation_timeout`) at most once. Don't retry any other `4xx` status without changing the request.
10. Never log the API key or the contents of a file. Log the status, the error code, and how long the request took.
11. Don't describe a signed file as proof that its contents are real or true. Content Credentials let a validator show who signed the file and whether the file changed after signing.

## Use these rules in a project

Save this page's Markdown, [/docs/agents.md](/docs/agents.md), in the project's rules file for its coding agent, such as `AGENTS.md`, `CLAUDE.md`, or a file in `.cursor/rules`.

## Read the whole contract

- [/llms-full.txt](/llms-full.txt) holds every docs page and the OpenAPI description in one file.
- [/openapi.yaml](/openapi.yaml) is the OpenAPI 3.1 description of `POST /v1/sign` and `POST /v1/validate`.
- [/llms.txt](/llms.txt) opens with setup steps for an agent and lists every page, each with its Markdown address.

---

Source: https://sign.lensproof.app/openapi.yaml

# OpenAPI description

````yaml
openapi: 3.1.0
info:
  title: Lens Proof Sign API
  version: 1.0.0
  summary: Send one file from your server and get the signed file back.
  description: |
    Lens Proof Sign adds a C2PA Content Credentials manifest to a file and returns the
    signed file in the same response.

    **You send the file (and optional closed-enum AI disclosure headers) and nothing else.**
    Lens Proof Sign writes every assertion, the claim, and the signature itself. The API accepts
    no freeform title, filename, author, description, or other metadata, in the body, the query
    string, or the headers. A request that carries any is refused with `400`.

    **Keys are for servers.** Call this API from your backend. A request that carries an
    `Origin` header, which is what a browser sends, is refused with `403`, so a key cannot
    be used from a web page. The API sets no cookies and allows no cross-origin requests.

    ## Authentication

    Send your API key as a bearer token:

    ```
    Authorization: Bearer lps_live_<keyId>_<secret>
    ```

    A key belongs to one organization and expires on a date set when it is created. Sign in to
    the Lens Proof Sign developer console to start a starter workspace (10 test-certificate
    signatures and an automatically created API key, with no manual approval required) or manage
    keys as an admin of a starter or approved organization. Starter signatures use a test
    certificate that is not publicly trusted. A console key lasts 1 to 365 days, and an
    organization can hold 10 keys that are not revoked. Lens Proof can also issue a key to you
    directly. A key is shown once, when it is created, and cannot be shown again, so keep it in
    a secret store on your server.

    To change keys without a gap, rotate the key. Rotation creates a replacement with the same
    label and AI disclosure policy, and the old key keeps working until it is revoked. A revoked
    key stops working on the next request. A request that is already running when its key is
    revoked still finishes.

    ## Limits

    - **File size:** Signing takes 30 MB (30,000,000 bytes) for MP4 and MOV, and 10 MB
      (10,000,000 bytes) for every other supported type. Validation takes MP4 and MOV up to 32 MB
      (32,000,000 bytes), because a signed 30 MB video comes back a little larger than 30 MB, and
      every other type up to 10 MB. The limit that applies is the one for the `Content-Type` you
      declare.
    - **Starter workspaces** receive 10 test-certificate signatures shared across every key in
      the workspace, with no per-minute trial limit. A daily capacity shared across all trial
      workspaces still applies (`429` with `trial_daily_cap` and `Retry-After`). Once a
      workspace's starter signatures are used up, the API answers `402` with
      `insufficient_credits`.
    - **Rate limits are set per approved organization** when Lens Proof approves it: a number of
      requests per minute (counted per calendar minute) and per day (counted per UTC day),
      shared across all of the organization's keys. Unless Lens Proof chose others, those are
      30 requests per minute and 1,500 per day, or the starting values Lens Proof saved. If Lens Proof changes your organization's
      limits later, the new limits apply to the next request on every key you hold. If your
      organization is paused, the next request on any of its keys is refused with `403` and
      `customer_paused`. A request counts (or consumes a starter signature) when the key is
      valid, the organization is in good standing, the `Content-Type` is supported, and the
      request is admitted, even if it later ends in `400` (`unrecognized_file`), `413`, `415`
      (a file that is not its declared type), or `502`. Refused requests that never reach that
      point (`400` for a query string, an extra header, or an AI disclosure error, `401`, `402`,
      `403`, `404`, `405`, `415` for an unsupported `Content-Type`, `429`, `503`) do not count.
      When a limit is reached, the API answers `429` with a `Retry-After` header in whole
      seconds.
    - **A monthly credit limit and holds** can apply to an approved organization that Lens Proof
      bills. The credit limit is the number of requests the organization may have admitted in one
      UTC month, counted the way the daily limit is counted. When the count reaches it, the API
      answers `402` with `credit_limit_reached` and a `Retry-After` header in whole seconds until
      the count starts again at 00:00 UTC on the first day of the next month. A hold stops signing
      for the organization. Lens Proof can set one by hand, and one starts on its own when an
      invoice is past due. A held organization gets `402` with `billing_hold`, keeps all of its
      API keys, and signs again the moment the hold ends. The hold is checked before the
      per-minute and per-day limits, and neither a held nor a capped request counts. Validation is
      not held.
    - Each API instance signs a small number of files at once. When it is full, the API
      answers `503` with `Retry-After` and does not count the request.

    ## What a request may contain

    The body is the file. The `Content-Type` header names its type, and it must be one of
    the supported types below. The file's own bytes must be that type. A file whose bytes are
    another type is refused with `415` and `type_mismatch`, and nothing is signed. The error
    message names the type the bytes turned out to be, so a file whose name says `.png` but
    whose bytes are a JPEG gets told to send `image/jpeg`. The file's name plays no part.

    The signed file is always the same type as the file you send. The API does not convert
    between types. To get another type, convert the file first and then sign it, because
    converting a signed file breaks its credentials.

    No query parameters are accepted. Only these request headers are accepted:
    `Authorization`, `Content-Type`, `Content-Length`, `Transfer-Encoding`, `Expect`,
    `Host`, `Connection`, `Keep-Alive`, `TE`, `Accept`, `Accept-Encoding`,
    `Accept-Language`, `User-Agent`, `Cache-Control`, `Pragma`, `Forwarded`, `Via`,
    `Traceparent`, `Tracestate`, `X-Real-IP`, `X-Lens-AI-Source`, `X-Lens-AI-Oversight`,
    and headers that start with `X-Forwarded-`, `X-Cloud-`, `X-Goog-`, or `Sec-Fetch-`.
    Cookies, `Content-Disposition`, `Content-Encoding`, and any other header are refused
    with `400`.

    ### Optional downstream AI disclosure headers and per-key policies

    Deployers publishing AI-generated or AI-edited media can attach closed-enum C2PA 2.4
    AI provenance assertions using two optional headers:

    - `X-Lens-AI-Source`: `trained_algorithmic_media` (fully AI-generated) or
      `composite_with_trained_algorithmic_media` (edited or composited with AI). When the
      uploaded file carries no existing C2PA manifest, Lens Proof Sign records the matching
      IPTC `digitalSourceType` URI on `c2pa.ingredient.v3` (C2PA 2.4 §18.16.12.3). On both
      unsigned and already-signed inputs, it emits a `c2pa.ai-disclosure` assertion
      (C2PA 2.4 §18.28.1.1) with `modelType: "c2pa.types.model"`.
    - `X-Lens-AI-Oversight` *(optional; requires `X-Lens-AI-Source`)*: `fully_autonomous`,
      `prompt_guided`, or `human_validated`. Recorded under
      `c2pa.ai-disclosure.contentProfile.humanOversightLevel` (C2PA 2.4 §18.29).

    Organization admins can attach a per-key AI disclosure policy in the developer console:
    `optional` (default), `required` (refuses requests without `X-Lens-AI-Source` with `400`
    `ai_disclosure_required`), `default` (applies configured values when headers are omitted,
    overridable per request), or `locked` (always applies configured values and refuses
    conflicting headers with `400` `ai_disclosure_locked`).

    ## What the response contains

    On success the body is the signed file, with the file's own `Content-Type` and a
    generic download name, `Content-Disposition: attachment; filename="<UTC date>_output.<ext>"`.
    Responses are marked `Cache-Control: no-store` and `X-Content-Type-Options: nosniff`.

    Lens Proof Sign processes each file in memory. It does not store the file or the signed
    output, and it does not log filenames, file hashes, or file contents.

    ## Response headers

    Every answer from `POST /v1/sign` and `POST /v1/validate`, success or error, carries
    `X-Request-Id`. It is the id on Lens Proof's own record of that request, a 32-digit trace id
    or a UUID, so quote it when you ask about a request. The record holds no file data.

    A `200`, `402`, or `429` from `POST /v1/sign` for an approved organization also says where the
    organization stands against each limit it has, so your code can raise an alert before a
    refusal. Each `Used` value is the number of requests admitted so far in that window, counted
    the way the limit is counted. 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.

    - `X-Lens-Limit-Minute` and `X-Lens-Used-Minute`: the per-minute limit and the count in the
      current calendar minute.
    - `X-Lens-Limit-Day` and `X-Lens-Used-Day`: the daily limit and the count in the current UTC day.
    - `X-Lens-Limit-Month` and `X-Lens-Used-Month`: the monthly credit limit and the count in the
      current UTC month. They are sent only when Lens Proof set a monthly credit limit for your
      organization.
    - `X-Lens-Warnings`: warning words separated by commas, and absent when there are none.
      `limit_near` means the month's count has reached 80% of the monthly credit limit and has
      not yet reached the limit.

    A starter workspace gets `X-Lens-Starter-Remaining`, the number of starter signatures it has
    left, on a `200`, a `402`, or a `429`, and none of the headers above.

    ## Validating a file

    `POST /v1/validate` takes one file the same way and returns its C2PA validation report as
    crJSON, written by c2pa-rs. It checks the manifest's integrity and checks the signing
    credential and time-stamp against the C2PA Trust List and C2PA TSA Trust List. It fetches
    nothing over the network: no remote manifest, no OCSP, and no certificate.

    Validation does not use a signature and does not count toward your organization's signing
    limits. It has its own limit of 60 requests per calendar minute per organization, and each
    API instance validates a small number of files at once. It accepts only the transport
    headers listed above. It takes no AI disclosure headers, because it writes nothing.

    A `200` means the API read the file's Content Credentials and wrote a report. It does not
    mean the file is trusted. Read `validationResults` on each manifest: a tampered file or an
    untrusted signer still gets `200`, with the failure codes in the report. A file with no
    Content Credentials gets `422` and `no_credentials`.
  contact:
    name: Lens Proof
    url: https://lensproof.app
servers:
  - url: https://{host}
    description: The API host. Use the default unless Lens Proof gives you another host.
    variables:
      host:
        default: sign-api.lensproof.app
security:
  - bearerAuth: []
paths:
  /v1/sign:
    post:
      operationId: signFile
      summary: Sign one file
      description: |
        Adds a Content Credentials manifest to the file in the request body and returns the
        signed file. See the notes on this page for authentication, limits, and what a
        request may contain.

        Checks run in this order, and the body is not read until the last of them passes:
        the `Origin` header, the method, the query string and headers (including AI disclosure
        header values), the key and its AI disclosure policy, whether signing is available, the
        `Content-Type`, this instance's capacity, and your organization's status, allowance,
        and rate limits. Then the API reads the file. It stops with `413` once the file passes the
        limit for its declared `Content-Type` (30 MB for MP4 and MOV, 10 MB for every other type),
        and it checks that the bytes are a supported file of the declared `Content-Type`.
        On a host where the API is not enabled, every request gets `404`.
      tags:
        - Signing
      parameters:
        - name: X-Lens-AI-Source
          in: header
          required: false
          description: |
            Optional closed-enum downstream AI source declaration. Recorded on `c2pa.ingredient.v3`
            when the input has no existing manifest (C2PA 2.4 §18.16.12.3) and triggers a
            `c2pa.ai-disclosure` assertion (C2PA 2.4 §18.28.1.1).
          schema:
            type: string
            enum:
              - trained_algorithmic_media
              - composite_with_trained_algorithmic_media
        - name: X-Lens-AI-Oversight
          in: header
          required: false
          description: |
            Optional human oversight level recorded in `c2pa.ai-disclosure.contentProfile.humanOversightLevel`
            (C2PA 2.4 §18.29). Accepted only when `X-Lens-AI-Source` is also set.
          schema:
            type: string
            enum:
              - fully_autonomous
              - prompt_guided
              - human_validated
      requestBody:
        required: true
        description: The file, as raw bytes. Set `Content-Type` to the file's type.
        content:
          application/pdf:
            schema:
              $ref: "#/components/schemas/FileBytes"
          image/jpeg:
            schema:
              $ref: "#/components/schemas/FileBytes"
          image/png:
            schema:
              $ref: "#/components/schemas/FileBytes"
          image/webp:
            schema:
              $ref: "#/components/schemas/FileBytes"
          image/gif:
            schema:
              $ref: "#/components/schemas/FileBytes"
          image/tiff:
            schema:
              $ref: "#/components/schemas/FileBytes"
          image/heic:
            schema:
              $ref: "#/components/schemas/FileBytes"
          image/avif:
            schema:
              $ref: "#/components/schemas/FileBytes"
          video/mp4:
            schema:
              $ref: "#/components/schemas/FileBytes"
          video/quicktime:
            schema:
              $ref: "#/components/schemas/FileBytes"
      responses:
        "200":
          description: The signed file.
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
            X-Lens-Limit-Minute:
              $ref: "#/components/headers/LimitMinute"
            X-Lens-Used-Minute:
              $ref: "#/components/headers/UsedMinute"
            X-Lens-Limit-Day:
              $ref: "#/components/headers/LimitDay"
            X-Lens-Used-Day:
              $ref: "#/components/headers/UsedDay"
            X-Lens-Limit-Month:
              $ref: "#/components/headers/LimitMonth"
            X-Lens-Used-Month:
              $ref: "#/components/headers/UsedMonth"
            X-Lens-Warnings:
              $ref: "#/components/headers/Warnings"
            X-Lens-Starter-Remaining:
              $ref: "#/components/headers/StarterRemaining"
            Content-Disposition:
              description: A generic download name, `attachment; filename="<UTC date>_output.<ext>"`.
              schema:
                type: string
            Cache-Control:
              schema:
                type: string
                const: no-store
            X-Content-Type-Options:
              schema:
                type: string
                const: nosniff
          content:
            application/pdf:
              schema:
                $ref: "#/components/schemas/FileBytes"
            image/jpeg:
              schema:
                $ref: "#/components/schemas/FileBytes"
            image/png:
              schema:
                $ref: "#/components/schemas/FileBytes"
            image/webp:
              schema:
                $ref: "#/components/schemas/FileBytes"
            image/gif:
              schema:
                $ref: "#/components/schemas/FileBytes"
            image/tiff:
              schema:
                $ref: "#/components/schemas/FileBytes"
            image/heic:
              schema:
                $ref: "#/components/schemas/FileBytes"
            image/avif:
              schema:
                $ref: "#/components/schemas/FileBytes"
            video/mp4:
              schema:
                $ref: "#/components/schemas/FileBytes"
            video/quicktime:
              schema:
                $ref: "#/components/schemas/FileBytes"
        "400":
          description: |
            The request carries something the API does not accept (`unsupported_request`: a
            query string, or a header outside the accepted list), invalid AI disclosure headers
            (`invalid_ai_disclosure`), a missing AI disclosure header required by the API key's
            policy (`ai_disclosure_required`), AI disclosure headers conflicting with a locked API
            key policy (`ai_disclosure_locked`), or bytes that are not a supported file
            (`unrecognized_file`).
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: |
            The key is missing, malformed, unknown, or wrong (`unauthorized`). The answer is
            the same for all four, so it does not reveal which keys exist.
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
            WWW-Authenticate:
              schema:
                type: string
                const: Bearer
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: |
            The key is valid but cannot be used: it was revoked (`key_revoked`), it has
            expired (`key_expired`), or its organization is paused (`customer_paused`). Or
            the request carried an `Origin` header (`origin_not_allowed`).
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "404":
          description: The API is not enabled on this host (`not_found`).
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "405":
          description: Only `POST` is accepted (`method_not_allowed`).
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
            Allow:
              schema:
                type: string
                const: POST
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "402":
          description: |
            Signing stopped for a billing reason, and contacting sales is the way forward in each
            case. Your trial organization has used all of its starter signatures
            (`insufficient_credits`). Or your organization's signing is on hold (`billing_hold`):
            the message says whether an operator put it on hold or an invoice is past due. A hold
            keeps your API keys, and signing resumes when it ends. Or your organization reached its
            monthly credit limit (`credit_limit_reached`). Its count starts again at 00:00 UTC on the
            first day of the next month, and `Retry-After` says how many seconds that is. A request
            refused this way does not count toward your limits. An organization admin can find a
            past-due invoice, or ask for a higher monthly limit, in the developer console under
            Billing.
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
            X-Lens-Limit-Minute:
              $ref: "#/components/headers/LimitMinute"
            X-Lens-Used-Minute:
              $ref: "#/components/headers/UsedMinute"
            X-Lens-Limit-Day:
              $ref: "#/components/headers/LimitDay"
            X-Lens-Used-Day:
              $ref: "#/components/headers/UsedDay"
            X-Lens-Limit-Month:
              $ref: "#/components/headers/LimitMonth"
            X-Lens-Used-Month:
              $ref: "#/components/headers/UsedMonth"
            X-Lens-Warnings:
              $ref: "#/components/headers/Warnings"
            X-Lens-Starter-Remaining:
              $ref: "#/components/headers/StarterRemaining"
            Retry-After:
              description: Present for `credit_limit_reached`. Whole seconds until the monthly count starts again.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "413":
          description: |
            The file is larger than the limit for its declared `Content-Type` (`file_too_large`):
            30 MB for MP4 and MOV, 10 MB for every other type. The message names that limit, for
            example `Videos can be up to 30 MB.` Nothing is signed. The request counted toward
            your limits, because the size is checked after the key is admitted.
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "415":
          description: |
            The `Content-Type` is missing or is not one of the supported file types
            (`unsupported_media_type`), or the file is not the type the `Content-Type` declares
            (`type_mismatch`). Nothing is signed. A mismatch counts toward your limits, because it is
            found after the key is admitted.
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "422":
          description: |
            The file is the type it declares, but it could not be read for signing
            (`unreadable_file`). It may be damaged or incomplete, for example a video cut off
            partway, or built in a way that is not supported. Nothing was returned. Sending the
            same file again gives the same answer. The request counted toward your limits.
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "429":
          description: |
            Your organization reached its per-minute limit (`rate_limited_per_minute`) or its
            daily limit (`rate_limited_per_day`), or starter signing reached its daily capacity
            across all trial accounts (`trial_daily_cap`). Wait for `Retry-After` seconds.
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
            X-Lens-Limit-Minute:
              $ref: "#/components/headers/LimitMinute"
            X-Lens-Used-Minute:
              $ref: "#/components/headers/UsedMinute"
            X-Lens-Limit-Day:
              $ref: "#/components/headers/LimitDay"
            X-Lens-Used-Day:
              $ref: "#/components/headers/UsedDay"
            X-Lens-Limit-Month:
              $ref: "#/components/headers/LimitMonth"
            X-Lens-Used-Month:
              $ref: "#/components/headers/UsedMonth"
            X-Lens-Warnings:
              $ref: "#/components/headers/Warnings"
            X-Lens-Starter-Remaining:
              $ref: "#/components/headers/StarterRemaining"
            Retry-After:
              description: Whole seconds until the limit that was reached resets.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: |
            An error the API did not expect (`internal_error`). Retry later, and contact Lens
            Proof if it keeps happening.
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "502":
          description: |
            Signing failed (`signing_failed`). Nothing was returned. The request counted
            toward your limits. Retry later, and contact Lens Proof if it keeps failing.
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "503":
          description: |
            Signing is unavailable (`service_unavailable`), or this instance is at capacity
            (`server_busy`, with `Retry-After`). The request did not count.
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
            Retry-After:
              description: Present for `server_busy`. Whole seconds to wait.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
  /v1/validate:
    post:
      operationId: validateFile
      summary: Validate one file
      description: |
        Reads the Content Credentials in the file in the request body and returns the C2PA
        validation report as crJSON. It never signs, never changes the file, and does not
        return the file.

        Checks run in this order, and the body is not read until the last of them passes:
        the `Origin` header, the method, the query string and headers, the key, your
        organization's status, whether validation is available, the `Content-Type`, this
        instance's capacity, and your organization's validation limit. Then the API reads the
        file. It stops with `413` once the file passes the validation limit for its declared
        `Content-Type` (32 MB for MP4 and MOV, 10 MB for every other type), and it checks that the
        bytes are a supported file of the declared `Content-Type`. The video limit is above the
        30 MB signing limit so that a file you signed can be validated. On a host where the API is
        not enabled, every request gets `404`.

        A request counts toward the validation limit once it passes the capacity check, even if
        it later ends in `400`, `413`, `415` (`type_mismatch`), `422`, `502`, `503`, or `504`.
        Validation never counts toward your signing limits and never uses a signature.
      tags:
        - Validation
      requestBody:
        required: true
        description: The file, as raw bytes. Set `Content-Type` to the file's type.
        content:
          application/pdf:
            schema:
              $ref: "#/components/schemas/FileBytes"
          image/jpeg:
            schema:
              $ref: "#/components/schemas/FileBytes"
          image/png:
            schema:
              $ref: "#/components/schemas/FileBytes"
          image/webp:
            schema:
              $ref: "#/components/schemas/FileBytes"
          image/gif:
            schema:
              $ref: "#/components/schemas/FileBytes"
          image/tiff:
            schema:
              $ref: "#/components/schemas/FileBytes"
          image/heic:
            schema:
              $ref: "#/components/schemas/FileBytes"
          image/avif:
            schema:
              $ref: "#/components/schemas/FileBytes"
          video/mp4:
            schema:
              $ref: "#/components/schemas/FileBytes"
          video/quicktime:
            schema:
              $ref: "#/components/schemas/FileBytes"
      responses:
        "200":
          description: |
            The validation report, exactly as c2pa-rs writes it (crJSON). It is returned for a
            valid file and for a file that fails validation, such as a tampered file or one
            whose signer is not on the C2PA Trust List. Read `validationResults` on each manifest.
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
            Cache-Control:
              schema:
                type: string
                const: no-store
            X-Content-Type-Options:
              schema:
                type: string
                const: nosniff
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ValidationReport"
        "400":
          description: |
            The request carries something the API does not accept (`unsupported_request`: a
            query string, or a header outside the transport headers, including the AI
            disclosure headers), or bytes that are not a supported file (`unrecognized_file`).
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "401":
          description: |
            The key is missing, malformed, unknown, or wrong (`unauthorized`). The answer is
            the same for all four, so it does not reveal which keys exist.
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
            WWW-Authenticate:
              schema:
                type: string
                const: Bearer
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "403":
          description: |
            The key is valid but cannot be used: it was revoked (`key_revoked`), it has
            expired (`key_expired`), or its organization is paused (`customer_paused`). Or
            the request carried an `Origin` header (`origin_not_allowed`).
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "404":
          description: The API is not enabled on this host (`not_found`).
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "405":
          description: Only `POST` is accepted (`method_not_allowed`).
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
            Allow:
              schema:
                type: string
                const: POST
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "413":
          description: |
            The file is larger than the validation limit for its declared `Content-Type`
            (`file_too_large`): 32 MB for MP4 and MOV, 10 MB for every other type.
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "415":
          description: |
            The `Content-Type` is missing or is not one of the supported file types
            (`unsupported_media_type`), or the file is not the type the `Content-Type` declares
            (`type_mismatch`).
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "422":
          description: |
            The file was read but no report could be returned: it has no Content Credentials
            (`no_credentials`), its Content Credentials could not be read
            (`manifest_unreadable`), it points to a manifest stored elsewhere, which is not
            fetched (`remote_manifest_not_fetched`), or the report would be larger than
            16 MB (`report_too_large`).
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "429":
          description: |
            Your organization reached its validation limit of 60 requests per calendar minute
            (`rate_limited_per_minute`). Wait for `Retry-After` seconds.
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
            Retry-After:
              description: Whole seconds until the current minute ends.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "500":
          description: |
            An error the API did not expect (`internal_error`). Retry later, and contact Lens
            Proof if it keeps happening.
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "502":
          description: |
            Validation failed (`validation_failed`). Nothing was returned. Retry later, and
            contact Lens Proof if it keeps failing.
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "503":
          description: |
            Validation is unavailable (`service_unavailable`), or it is at capacity
            (`server_busy`, with `Retry-After`).
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
            Retry-After:
              description: Present for `server_busy`. Whole seconds to wait.
              schema:
                type: integer
                minimum: 1
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
        "504":
          description: |
            Validation took longer than 30 seconds (`validation_timeout`). Nothing was
            returned.
          headers:
            X-Request-Id:
              $ref: "#/components/headers/RequestId"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Error"
components:
  headers:
    RequestId:
      description: The id of this request in Lens Proof's own record of it. Quote it when you ask about a request. A 32-digit trace id or a UUID.
      schema:
        type: string
    LimitMinute:
      description: The organization's per-minute limit. Approved organizations only.
      schema: { type: integer, minimum: 1 }
    UsedMinute:
      description: Requests admitted in the current calendar minute.
      schema: { type: integer, minimum: 0 }
    LimitDay:
      description: The organization's daily limit. Approved organizations only.
      schema: { type: integer, minimum: 1 }
    UsedDay:
      description: Requests admitted in the current UTC day.
      schema: { type: integer, minimum: 0 }
    LimitMonth:
      description: The organization's monthly credit limit. Sent only when one is set.
      schema: { type: integer, minimum: 1 }
    UsedMonth:
      description: Requests admitted in the current UTC month. Sent only when a monthly credit limit is set.
      schema: { type: integer, minimum: 0 }
    Warnings:
      description: Warning words separated by commas. Absent when there are none. `limit_near` means the month's count has reached 80% of the monthly credit limit and has not yet reached it.
      schema: { type: string, example: limit_near }
    StarterRemaining:
      description: Starter signatures a starter workspace has left. Starter workspaces only.
      schema: { type: integer, minimum: 0 }
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: A Lens Proof Sign API key, `lps_live_<keyId>_<secret>`.
  schemas:
    FileBytes:
      type: string
      format: binary
      description: |
        The raw bytes of one file. To sign, at most 30,000,000 bytes for MP4 and MOV and at most
        10,000,000 bytes for every other supported type. To validate, at most 32,000,000 bytes for
        MP4 and MOV and at most 10,000,000 bytes for every other supported type.
    ErrorCode:
      type: string
      enum:
        - unauthorized
        - key_revoked
        - key_expired
        - customer_paused
        - insufficient_credits
        - billing_hold
        - credit_limit_reached
        - origin_not_allowed
        - unsupported_request
        - invalid_ai_disclosure
        - ai_disclosure_required
        - ai_disclosure_locked
        - unrecognized_file
        - type_mismatch
        - unreadable_file
        - method_not_allowed
        - file_too_large
        - unsupported_media_type
        - rate_limited_per_minute
        - rate_limited_per_day
        - trial_daily_cap
        - signing_failed
        - no_credentials
        - manifest_unreadable
        - remote_manifest_not_fetched
        - report_too_large
        - validation_failed
        - validation_timeout
        - service_unavailable
        - server_busy
        - not_found
        - internal_error
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              $ref: "#/components/schemas/ErrorCode"
            message:
              type: string
              description: A plain sentence for people. Match on `code`, not on this text.
    ValidationReport:
      type: object
      description: |
        A crJSON document as c2pa-rs writes it. The API returns it unchanged and adds no
        verdict of its own. The active manifest comes first in `manifests`, and each manifest
        carries its own `validationResults` (`success`, `failure`, and `informational` status
        codes, the spec version, and the time of validation).
      required:
        - manifests
      properties:
        "@context":
          type: object
        manifests:
          type: array
          minItems: 1
          items:
            type: object
            properties:
              label:
                type: string
              validationResults:
                type: object
        jsonGenerator:
          type: object
          properties:
            name:
              type: string
            version:
              type: string
      additionalProperties: true
````
