For background on how webhooks work and when to use them, see Webhooks. For complete API details, see the Webhooks API Reference.
Prerequisites
- An API token with Webhooks
readandwritepermissions - An HTTPS endpoint ready to receive POST requests
- Familiarity with job types and job states
What you’ll learn
- How to create a job webhook subscription with filters
- How to receive and verify webhook events
- How to list, inspect, and archive subscriptions
Creating a job webhook subscription
Use thePOST /webhooks endpoint to create a subscription. Set the type to webhook_subscription_jobs and provide your endpoint URL.
Receiving events
When a job matches your subscription’s filters, Narrative sends an HTTP POST to your URL with a JSON payload. The request carriesContent-Type: application/json and an X-Narrative-Secret header.
Verify the request
Compare theX-Narrative-Secret header against the secret you stored when you created the subscription. Reject anything that does not match — that request did not come from Narrative.
Example event payload
Every delivery has the same four-field envelope.type tells you what data contains.
2xx status code to acknowledge receipt. Anything else — including a connection failure — is treated as a failed attempt and retried with exponential backoff until the event’s attempt budget runs out.
For the full delivery payload schema and the list of type values, see Webhook Event Reference.
Handling idempotency
Each delivery envelope carries anid field. Retries of the same event reuse this id, so use it to make your handler idempotent.
- When you receive an event, check if you’ve already processed that envelope
id. - If yes, return
200 OKwithout processing again. - If no, process the event and store the
id.
Managing subscriptions
List all subscriptions
active and archived subscriptions.
Get a specific subscription
Archive a subscription
Archiving stops event delivery but retains the subscription record.Best practices
Related content
Webhooks
How webhooks work and when to use them
Webhook Event Reference
Complete field reference for subscription requests and responses
Tracking Job Status
Poll-based alternative for monitoring job progress
API Keys
Create and manage API tokens for webhook access

