Need to comply with the EU AI Act by 2 December 2026? New users can start with Trufo's AI Labeling Service or C2PA Certificates with your first month free.

New users: AI Labeling Service or C2PA Certificates, first month free.

Learn C2PA

C2PA in Python

Two ways to add Content Credentials from Python: build the manifest yourself, or call a managed signing service.

Published November 28, 2026

Most generative AI pipelines run in Python, so Python is where C2PA signing most often lands. There are two routes: self-building with c2pa-python, or calling a managed signing service like trufo. Both emit standard C2PA files; they differ in who holds the certificate and who maintains the conformance and signing stack.

The Two Routes

Open-Source SDK (c2pa-python)Managed Signing (trufo)
Who builds the manifestYour codeTrufo (in Cloud or Local mode)
CertificateYours — you procure, store, and renew itTrufo’s, issued under the C2PA Trust List
Trusted by validatorsAfter passing C2PA conformance and buying a certificateFrom the first production call
Timestamping & OCSPYou configure a trusted TSA and OCSP staplingIncluded automatically
Watermark soft bindingSeparate integration and registryOne action in the same call
Best forTeams where C2PA is a core product capabilityTeams that need compliant output quickly

Managed Signing with trufo

trufo is Trufo’s open-source Python SDK. Install it, save a test key from the Trufo Dashboard, and sign:

pip install trufo
trufo set-api-key c2pa-sign-test <your-api-key>
from pathlib import Path

from trufo import sign_c2pa_cloud_test
from trufo.util.credentials import TrufoAPIKey, load_api_key

api_key = load_api_key(TrufoAPIKey.C2PA_SIGN_TEST)

signed_bytes = sign_c2pa_cloud_test(api_key, Path("input.jpg").read_bytes())
Path("signed.jpg").write_bytes(signed_bytes)

Switch to sign_c2pa_cloud() with a c2pa-sign-prod key for production output trusted by validators. See Setup and Cloud Signing.

Label AI Output

Register your AI system once, then reference its ai_system_id when signing. The output is signed with digitalSourceType = trainedAlgorithmicMedia in the format expected by validators and regulators. The AI Labeling topic guide has the full call.

To embed an invisible PawPrint watermark so the credential survives metadata stripping, add a single action:

signed_bytes = sign_c2pa_cloud_test(
    api_key,
    media_bytes,
    actions=[["watermark", {}]],
)

Keep Media on Your Machine

In Local mode, media hashing, watermarking, and manifest assembly run on your own host and Trufo only signs the claim digest — your media files are never uploaded:

pip install "trufo[local-sign-only]"

Call sign_c2pa_local() in place of sign_c2pa_cloud() (or sign_c2pa_local_test() on the test host). For non-Python services, the same local engine ships as a Docker container (ghcr.io/trufo-ai/trufo-local:2.4). See Local Signing with Python and Local Signing with Docker.

Read a Manifest

To inspect a signed file from Python, use the open-source c2pa reader:

from c2pa import Reader

with Reader("signed.jpg") as reader:
    print(reader.json())

Check the library’s documentation for the exact API in your installed version. For browser and CLI inspection, see How to Verify C2PA Content Credentials.

How to Choose

Build your own Generator Product if C2PA is part of what you sell, you must sign fully offline, or you want complete ownership of the signing software. Plan for C2PA conformance review (typically 6–16 weeks of engineering) plus HSM/KMS key management and certificate renewal; Trufo supplies the certificates and timestamping for that route.

Use managed signing if you need trusted, compliant output quickly without maintaining a conformance filing or signing stack. Pricing starts at $120/mo.

Get Started Now

If you are ready, head over to app.trufo.ai to get started. If you have questions, feel free to contact support@trufo.ai or schedule a consultation with one of our experts.