Skip to main content

Webhooks

Real-time event subscriptions. Webhooks enable you to subscribe to system events and receive real-time notifications when assets are created, modified, or verified.

Methods​

Method (TypeScript)Method (Python)DescriptionHTTP
create(webhook)create(webhook)Create webhook subscriptionPOST /webhooks
get(webhookId)get(webhook_id)Retrieve webhookGET /webhooks/{id}
list(options?)list(options=None)List webhooksGET /webhooks
update(webhookId, webhook)update(webhook_id, webhook)Update webhookPATCH /webhooks/{id}
delete(webhookId)delete(webhook_id)Delete webhookDELETE /webhooks/{id}
getDeliveries(webhookId, options?)get_deliveries(webhook_id, options=None)List webhook deliveriesGET /webhooks/{id}/deliveries

Example​

import { OptropicClient } from 'optropic';

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

// Create a webhook for asset creation events
const webhook = await client.webhooks.create({
url: 'https://your-domain.com/webhook',
events: ['asset.created', 'asset.verified'],
active: true,
headers: {
'X-Custom-Header': 'your-value'
}
});

console.log(`Webhook created: ${webhook.id}`);
console.log(`Check deliveries at: /webhooks/${webhook.id}/deliveries`);