LENS PROOF SIGN API
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, 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 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
- Keep the API key on a server. Read it from an environment variable such as
LENS_PROOF_SIGN_API_KEYor 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. - Call the API only from server code. A browser request carries an
Originheader and gets403withorigin_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. - Send one file per request, as the raw request body, with
Content-Typeset to the file's media type. Never sendmultipart/form-data, base64 text, or JSON. - Send no query string. Use
Authorization,Content-Type, and the headers the HTTP client adds on its own. OnPOST /v1/sign, you may also send the optional AI disclosure headers documented in Headers;POST /v1/validaterefuses those headers. Never send a title, a filename, an author, or other metadata, because the API refuses it with400andunsupported_request. - Check the file size before you send the file. A file over its cap gets
413withfile_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. - Use only the types on the media types page, and set
Content-Typefrom the file's real type, not from its extension alone. - On a
200fromPOST /v1/sign, save the response body as the signed file, and don't change it afterward, because a change can break the signature. On a200fromPOST /v1/validate, parse the crJSON report and inspectvalidationResultscodes separately for signature integrity, signer certificate trust, and timestamp trust; a200does not mean the file passed. - On an error, read
error.codefrom the JSON body and branch on it. Never parseerror.message. - Retry a
429, or a503withserver_busy, only after the number of seconds inRetry-After. Retry a500, a502, or a503withservice_unavailablewith exponential backoff and a cap on attempts. Retry a504(validation_timeout) at most once. Don't retry any other4xxstatus without changing the request. - Never log the API key or the contents of a file. Log the status, the error code, and how long the request took.
- 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, 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 holds every docs page and the OpenAPI description in one file.
- /openapi.yaml is the OpenAPI 3.1 description of
POST /v1/signandPOST /v1/validate. - /llms.txt opens with setup steps for an agent and lists every page, each with its Markdown address.