← Docs

SDKs and examples

A TypeScript SDK, and raw HTTP examples in four languages, because the API is small enough not to need much else.

The API is a handful of endpoints returning one document shape. You do not need a client library, and we would rather you did not wait for one.

TypeScript

npm install @c2pa-design/sdk
import { C2pa } from '@c2pa-design/sdk'

const c2pa = new C2pa({ apiKey: process.env.C2PA_API_KEY })
const { result } = await c2pa.verifications.create({ url: 'https://cdn.example.com/hero.jpg' })

if (result.credential.status !== 'valid_trusted') {
  throw new Error(`provenance: ${result.credential.status}`)
}

Generated from the same OpenAPI description the server implements, so the types cannot drift from the responses.

Everything else

Go, Python, Ruby, PHP: use HTTP. Working examples for curl, Node, Python and Go live in the open-source repository, each about twenty lines and each doing the same thing — check a URL, print the status, exit non-zero when it is not trusted.

We generate a Go or Python SDK when a customer asks for one. Nobody has yet, because a POST with a JSON body is not a hard problem.

Browser

The free tools on this site run the C2PA WebAssembly reader locally and produce the same result schema. The analyzer is published as @c2pa-design/core if you want the same behaviour in your own front end — including the trust-list settings, without which a browser tool cannot honestly report valid_trusted.