Documents
Substrate fingerprint enrollment and verification. Documents enable the capture and verification of unique physical substrate signatures, providing a biometric-like authentication mechanism for physical products.
Methods​
| Method (TypeScript) | Method (Python) | Description | HTTP |
|---|---|---|---|
enroll(assetId, fingerprint, metadata?) | enroll(asset_id, fingerprint, metadata=None) | Upload substrate fingerprint | POST /documents/{assetId}/enroll |
verify(assetId, fingerprint) | verify(asset_id, fingerprint) | Match fingerprint against enrolled | POST /documents/{assetId}/verify |
get(documentId) | get(document_id) | Retrieve document by ID | GET /documents/{id} |
list(assetId, options?) | list(asset_id, options=None) | List documents for asset | GET /documents?assetId={id} |
Example​
- TypeScript
- Python
import { OptropicClient } from 'optropic';
const client = new OptropicClient({ apiKey: 'optr_live_...' });
// Enroll a substrate fingerprint
const enrolled = await client.documents.enroll(
'asset-123',
'fingerprint_data_base64',
{
location: 'Front surface',
timestamp: new Date().toISOString()
}
);
// Verify the fingerprint
const result = await client.documents.verify(
'asset-123',
'fingerprint_data_base64'
);
console.log(`Match confidence: ${result.confidence}`);
from optropic import Optropic
client = Optropic(api_key="optr_live_...")
# Enroll a substrate fingerprint
enrolled = client.documents.enroll(
'asset-123',
'fingerprint_data_base64',
{
'location': 'Front surface',
'timestamp': '2024-03-29T10:00:00Z'
}
)
# Verify the fingerprint
result = client.documents.verify(
'asset-123',
'fingerprint_data_base64'
)
print(f"Match confidence: {result['confidence']}")