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