Create an API key
Create a key in the dashboard. Signing requires the key. Public verification does not.
Content provenance for production systems
Start with eleven core operations. Open the management, advanced, or program reference only when your integration needs it.
Start here
Create a key in the dashboard. Signing requires the key. Public verification does not.
Use POST /sign for text, POST /sign/media for one file or a composition with many ingredients, and POST /sign/rich for a mixed article.
Sign completed text over SSE, mark incremental segments, or call the OpenAI-compatible signing proxy.
Quickstart
Sign plain text, then pass the returned signed_text to the unauthenticated verifier. Every signing request carries an Idempotency-Key header.
Run these examples on your server: cURL 7.76 or later with jq, Python with requests installed, or Node.js 18 or later. Save the JavaScript example as an .mjs file. Never put an API key in browser code.
export ENCYPHER_API_KEY="<your-api-key>"
# One key per signing operation. Resend the same key only to retry this request.
IDEMPOTENCY_KEY="first-signed-document-$(date +%s)"
if SIGNED=$(curl -sS --fail-with-body https://api.encypher.com/api/v1/sign \
-H "Authorization: Bearer $ENCYPHER_API_KEY" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"This document carries portable provenance.","document_title":"First signed document"}'); then
printf '%s' "$SIGNED" | jq '{text: .data.document.signed_text}' |
curl -sS --fail-with-body https://api.encypher.com/api/v1/public/verify \
-H "Content-Type: application/json" \
--data-binary @- |
jq -e 'if .success == true and .valid == true and .tampered != true then . else error("Verification did not succeed") end'
else
printf 'Signing failed: %s\n' "$SIGNED" >&2
false
fi
import os
import uuid
import requests
base_url = "https://api.encypher.com/api/v1"
# One key per signing operation. Store it with the job and resend the same key
# only when you retry this request; never reuse it for different content.
idempotency_key = f"first-signed-document-{uuid.uuid4()}"
sign = requests.post(
f"{base_url}/sign",
headers={
"Authorization": f"Bearer {os.environ['ENCYPHER_API_KEY']}",
"Idempotency-Key": idempotency_key,
},
json={
"text": "This document carries portable provenance.",
"document_title": "First signed document",
},
timeout=30,
)
if not sign.ok:
raise RuntimeError(f"Signing failed with HTTP {sign.status_code}: {sign.text}")
signed_text = sign.json()["data"]["document"]["signed_text"]
verify = requests.post(
f"{base_url}/public/verify",
json={"text": signed_text},
timeout=30,
)
if not verify.ok:
raise RuntimeError(f"Verification failed with HTTP {verify.status_code}: {verify.text}")
verdict = verify.json()
if verdict.get("success") is not True or verdict.get("valid") is not True or verdict.get("tampered") is True:
raise RuntimeError("The returned document did not verify")
print(verdict["valid"], verdict["reason_code"])
import { randomUUID } from "node:crypto";
const baseUrl = "https://api.encypher.com/api/v1";
// One key per signing operation. Store it with the job and resend the same key
// only when you retry this request; never reuse it for different content.
const idempotencyKey = `first-signed-document-${randomUUID()}`;
const signResponse = await fetch(`${baseUrl}/sign`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ENCYPHER_API_KEY}`,
"Idempotency-Key": idempotencyKey,
"Content-Type": "application/json",
},
body: JSON.stringify({
text: "This document carries portable provenance.",
document_title: "First signed document",
}),
});
if (!signResponse.ok) {
throw new Error(`Signing failed with HTTP ${signResponse.status}: ${await signResponse.text()}`);
}
const signed = await signResponse.json();
const verifyResponse = await fetch(`${baseUrl}/public/verify`, {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({text: signed.data.document.signed_text}),
});
if (!verifyResponse.ok) {
throw new Error(`Verification failed with HTTP ${verifyResponse.status}: ${await verifyResponse.text()}`);
}
const verdict = await verifyResponse.json();
if (verdict.success !== true || verdict.valid !== true || verdict.tampered === true) {
throw new Error("The returned document did not verify");
}
console.log(verdict.valid, verdict.reason_code);
Store signed_text exactly as returned. Normalizing or retyping it can remove the invisible provenance payload.
Idempotency-Key is required on POST /sign, /sign/media, /sign/rich, /sign/stream, and /chat/completions; the reference marks every operation that needs it. Use 1 to 128 characters and create one key per logical signing operation. A network retry with the same key and the same body returns the original result instead of signing again. The same key with a different body returns 409 SIGNING_IDEMPOTENCY_CONFLICT. 409 SIGNING_IN_PROGRESS with Retry-After means the first attempt is still running: wait, then retry with the same key. 410 SIGNING_RESULT_PURGED means the stored result has expired: sign again with a new key.
Multi-ingredient media
Send the finished composition once as file. Repeat the multipart ingredients field for every source clip, image, or audio file. Each source becomes a separate c2pa.ingredient.v3 assertion in the final Content Credential.
Run these on your server with the listed local files and a signing-capable ENCYPHER_API_KEY. cURL shows three sources; Python and Node.js show twenty. The Node.js example needs Node 18 or later and an .mjs file. The multipart response uses top-level ingredient_count and signed_file_b64, not the text-signing envelope.
curl --fail-with-body -X POST https://api.encypher.com/api/v1/sign/media -H "Authorization: Bearer $ENCYPHER_API_KEY" -H "Idempotency-Key: campaign-cut-001" -F "[email protected];type=video/mp4" -F "title=Campaign cut" -F "[email protected];type=video/mp4" -F "[email protected];type=video/mp4" -F "[email protected];type=image/png"
import mimetypes
import os
from contextlib import ExitStack
from pathlib import Path
import requests
sources = [Path(f"clip-{n:02}.mp4") for n in range(1, 20)]
sources.append(Path("nanobanana-background.png"))
with ExitStack() as stack:
final = Path("final.mp4")
files = [
("file", (final.name, stack.enter_context(final.open("rb")), "video/mp4")),
]
for source in sources:
mime = mimetypes.guess_type(source.name)[0] or "application/octet-stream"
files.append(
("ingredients", (source.name, stack.enter_context(source.open("rb")), mime))
)
response = requests.post(
"https://api.encypher.com/api/v1/sign/media",
headers={
"Authorization": f"Bearer {os.environ['ENCYPHER_API_KEY']}",
"Idempotency-Key": "campaign-cut-001",
},
data={"title": "Campaign cut"},
files=files,
timeout=300,
)
response.raise_for_status()
result = response.json()
if result["ingredient_count"] != len(sources):
raise RuntimeError("Not every source was recorded")
print(result["ingredient_count"], result.get("verification_url"))
import { Blob } from "node:buffer";
import { readFile } from "node:fs/promises";
const sources = [
...Array.from({length: 19}, (_, i) => `clip-${String(i + 1).padStart(2, "0")}.mp4`),
"nanobanana-background.png",
];
const form = new FormData();
form.append("file", new Blob([await readFile("final.mp4")], {type: "video/mp4"}), "final.mp4");
form.append("title", "Campaign cut");
for (const source of sources) {
const mime = source.endsWith(".png") ? "image/png" : "video/mp4";
form.append("ingredients", new Blob([await readFile(source)], {type: mime}), source);
}
const response = await fetch("https://api.encypher.com/api/v1/sign/media", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ENCYPHER_API_KEY}`,
"Idempotency-Key": "campaign-cut-001",
},
body: form,
});
if (!response.ok) throw new Error(await response.text());
const result = await response.json();
if (result.ingredient_count !== sources.length) {
throw new Error("Not every source was recorded");
}
console.log(result.ingredient_count, result.verification_url);
ingredients means componentsRepeat this field. Order is preserved. Every file gets relationship componentOf, and its filename becomes the ingredient title. Do not send an array, comma-separated list, or ZIP archive.
ingredient means one parentThe singular field is only for one edited predecessor with relationship parentOf. It is not the way to send composition sources.
A signed source keeps its existing C2PA provenance chain. An unsigned source is still recorded, with unknown prior provenance rather than invented history.
The composition contract accepts up to 50 effective ingredients, and a parent counts toward the 50. The public limit is the whole multipart request body (target, every ingredient, text fields, and multipart framing together) at or below 100,000,000 bytes (100 MB). Cloudflare measures a 100 MiB edge ceiling in front of the API, and this application cap sits deliberately below it so an over-limit request earns a JSON 413 rather than an edge rejection. Check top-level ingredient_count in the response. A mismatch means the final credential does not describe the composition you intended.
For a supported asset or composition at or above 100 MB, call GET /sign/media/hash/capabilities first and use the POST /sign/media/prepare and POST /sign/media/finalize local-hash workflow only when the response reports enabled: true for your organization. The capabilities response, not a static size claim on this page, is authoritative. Prepared mode keeps media payload bytes local and accepts ordered parent and component ingredient descriptors, AI-output ancestry, preserve_source_rights, and use_rights_profile. Ingredient descriptors contain only bounded container structure, size, MIME type, relationship, title, and a SHA-256 digest.
A request rejected above Cloudflare's 100 MiB edge ceiling is answered by the edge, not this API: that response may be HTML and lack Encypher's error.code and correlation_id fields. Branch on the HTTP status and Content-Type before parsing JSON, and treat any 413 as a size failure even when the JSON envelope is absent.
Authentication
Send your Encypher API key on authenticated operations:
Authorization: Bearer <your-api-key>
POST /public/verify and POST /public/verify/media require no key. The OpenAI proxy also requires X-OpenAI-API-Key. Encypher forwards that key for the request and does not persist it.
Some account administration acts for a person, so it refuses API keys and needs a signed-in owner or admin in the dashboard: BYOK certificate and key changes, retention policy, legal hold and deletion approvals, and organization members, invitations, and identity providers. The Management reference documents these operations; the dashboard is the supported way to run them.
Sections labelled Enterprise are paid add-ons. The Programs reference is public so you can evaluate it, but a program operation works only for an organization whose program agreement enables it. Certificate status (OCSP and CRLs) and the certificate repository in that reference are open to anyone.
Errors and limits
{
"success": false,
"error": {
"code": "E_RATE_SIGN",
"message": "Signing rate limit exceeded"
},
"correlation_id": "req-abc123"
}
Branch on error.code. Log correlation_id and the X-Request-ID response header. On 429, and on 409 SIGNING_IN_PROGRESS, honor Retry-After and resend the same Idempotency-Key. A 413 answered by the edge may not be JSON, so check the status and Content-Type before parsing. Rich signing accepts up to 20 images, 10 audio files and 5 video files, each up to 100 MB; the whole base64 request must stay under Cloudflare's 100 MiB edge ceiling, so sign larger assets with prepared signing and pass the returned evidence_id as prepared_evidence_id.
State and retries
document_idrun_idsession_idstart, segment, finalize, and status calls.correlation_idAPI reference
Eleven operations for signing, verification, streaming, and OpenAI-compatible generation. Use the reference filter to search this surface.