Webhooks are delivered once with no automatic retries. This page covers how to build a reliable receiver that handles failures gracefully.Documentation Index
Fetch the complete documentation index at: https://docs.omnifence.ai/llms.txt
Use this file to discover all available pages before exploring further.
Delivery guarantees
- Webhooks are delivered once with a 10-second timeout.
- If your server does not respond within 10 seconds or returns a non-
2xxstatus, the delivery is not retried. - The result is always available via the job status endpoint, regardless of webhook delivery outcome.
Handling delivery failures
Because webhooks are not retried, build a recovery mechanism into your integration:- Persist job IDs on submission. Store the
job_idreturned from any of the modality endpoints (POST /moderate/prompt,POST /moderate/image,POST /moderate/video). - Poll on startup or recover from failures. On application restart or after a webhook outage, query
GET /job/{id}for any job IDs in a non-terminal state (queuedorprocessing). - Set a polling timeout. If a job has not completed after a reasonable period (for example, 5 minutes for prompt or image moderation, 15 minutes for video moderation), treat it as failed and investigate.
Idempotency
Your webhook handler may occasionally receive a duplicate delivery (for example, if your server responded slowly). Make your handler idempotent by checking whether you have already processed a givenjob_id before acting on it.
Responding quickly
Webhook payloads are small, but any processing you do synchronously (database writes, downstream API calls) can push your response time past the 10-second timeout. Acknowledge receipt immediately and process asynchronously.Security considerations
The webhook request does not include a signature. To prevent spoofed payloads:- Use HTTPS for your webhook URL.
- Validate the
job_idagainst your records before trusting the payload. - Optionally, verify the result by calling
GET /job/{id}before acting on a webhook.
Hybrid approach
For maximum reliability, use webhooks for speed and polling as a fallback:- Register a webhook to receive results immediately when a job completes.
- Store all submitted
job_idvalues with apendingstate in your database. - Run a background job every few minutes to poll the job status endpoint for any IDs that remain
pendinglonger than expected.
