@provenancekit/sdk — the primary way to interact with the ProvenanceKit API from JavaScript and TypeScript.
Installation
Constructor
ProvenanceKitOptions
| Option | Type | Default | Description |
|---|---|---|---|
apiKey | string | — | Your pk_live_... API key from the dashboard |
baseUrl | string | https://api.provenancekit.com | Override for self-hosted API instances |
projectId | string | — | Explicit project ID (not needed with dashboard-issued keys) |
signingKey | string | — | 64-char hex Ed25519 private key for auto-signing actions |
signingEntityId | string | — | Entity ID bound to signingKey (required when signingKey is set) |
chain | IChainAdapter | — | On-chain adapter — see Chain Adapters |
pk.file()
The primary method — upload a file to IPFS, record EAA provenance, and optionally anchor on-chain.FileOpts
FileResult
Examples
pk.entity()
Register or update an entity (human, AI, or organization).pk.graph()
Get the full provenance graph for a resource — walks backwards through all inputs, actions, and entities.| Param | Default | Description |
|---|---|---|
cid | required | Resource CID to start from |
depth | 10 | How many hops back to traverse |
pk.bundle() / pk.provenance()
Get the full provenance bundle for a resource.ProvenanceBundle containing entities, actions, resources, and attributions.
pk.sessionProvenance()
Get all provenance records linked to an app-managed session.sessionId to pk.file(). Use them to group related actions (e.g. all turns in a conversation).
pk.search() / pk.searchText()
Semantic similarity search across provenance records.pk.similar()
Find resources similar to an existing CID using vector embeddings.pk.getEntity() / pk.listEntities() / pk.getAIAgent()
Query entity records.pk.ownership()
Ownership tracking for resources.pk.health()
Health check.Signing Utilities
signingKey in ProvenanceKitOptions for auto-signing on every pk.file() call.
Error Handling
Duplicate detection
When a near-duplicate resource is uploaded,pk.file() returns (not throws) with duplicate populated: