Create Webhook

POST /workspaces/{slug}/schemas/{schemaKey}/webhooks

Create a webhook

Path Parameters

slug: string required
schemaKey: string required

Query Parameters

env: "production" | "staging" | "development"

Environment slug. Defaults to production.

Body Parameters

url: string required
events: "document.received" | "run.processing" | "run.completed" | "run.failed"[] required
isActive: boolean

            curl -X POST \
-H "x-api-key: dsk_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/webhook",
"events": [
  "run.completed"
],
"isActive": true
}' \
https://api.tracore.io/workspaces/my-workspace/schemas/invoice/webhooks?env=production
          

            import { TracoreClient } from '@tracore/sdk';

const client = new TracoreClient({ apiKey: 'dsk_your_api_key' });

const webhook = await client.webhooks.create('my-workspace', 'invoice', {
url: 'https://example.com/webhook',
events: ['run.completed', 'run.failed'],
});
console.log(webhook.secret);
          
201 Response
{
  "id": "ws_abc123",
  "environmentId": "env_abc123",
  "schemaFamilyId": "sf_abc123",
  "url": "https://example.com/webhook",
  "events": [
    "document.received"
  ],
  "isActive": true,
  "secret": "whsec_abc123...",
  "createdAt": "2024-03-15T10:30:00Z",
  "updatedAt": "2024-03-15T10:30:00Z"
}