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