Skip to main content

Provenance

Tamper-evident lifecycle event chains. Provenance records create an immutable history of asset transformations, enabling full transparency and accountability across supply chains.

Methods​

Method (TypeScript)Method (Python)DescriptionHTTP
record(assetId, event)record(asset_id, event)Record lifecycle eventPOST /provenance/{assetId}/record
get(eventId)get(event_id)Retrieve single eventGET /provenance/events/{id}
getChain(assetId)get_chain(asset_id)Get complete event chainGET /provenance/{assetId}/chain
list(assetId, options?)list(asset_id, options=None)List events with paginationGET /provenance/{assetId}/events
verifyChain(assetId)verify_chain(asset_id)Verify chain integrityGET /provenance/{assetId}/verify

Example​

import { OptropicClient } from 'optropic';

const client = new OptropicClient({ apiKey: 'optr_live_...' });

// Record a provenance event
const event = await client.provenance.record(
'asset-123',
{
type: 'manufacture',
actor: 'Factory-A',
timestamp: new Date().toISOString(),
data: {
location: 'Shanghai, CN',
batch: 'BATCH-2024-001'
}
}
);

// Retrieve the complete chain
const chain = await client.provenance.getChain('asset-123');
console.log(`Chain length: ${chain.events.length}`);