Webhooks
sync. labs webhooks deliver real-time HTTP POST notifications when your lip sync generation jobs complete or fail. Use webhooks instead of polling to build efficient, event-driven workflows that respond to generation status changes without repeated API calls.
How do I set up webhooks?
To utilize webhooks:
- Specify a
webhookUrlparameter when calling an API endpoint that supports it. - Ensure your webhook endpoint can receive and handle HTTP
POSTrequests and can consume the Webhook Payload for status updates.
For security purposes, your webhook URL must be configured to accept and
process HTTPS POST requests.
By leveraging webhooks, you can streamline your workflow with non-blocking calls, allowing you to focus on other tasks while receiving job completion notifications.
If you are not receiving events, confirm that the exact webhookUrl was included in the generation request, the endpoint is publicly reachable over HTTPS, and it returns a 2xx response to POST requests quickly. If delivery is missed because your endpoint is unavailable or rejects the request, poll the generation status endpoint as a fallback.
When are webhooks sent?
A generation webhook is sent once the generation reaches a terminal status: COMPLETED, NO_OP, FAILED or REJECTED. NO_OP means no frame was lip-synced; see Finished without lip sync. A batch webhook is sent when the batch is COMPLETED or FAILED.
Each request carries these headers:
Retries and duplicates
Sync retries a webhook your endpoint did not accept, for generations and batches alike:
- Up to 6 attempts over about 2 hours. Retries wait about 1, 3, 9, 27 and 60 minutes (±25% jitter).
- What is retried: timeouts, connection errors,
429and5xxresponses. ARetry-Afterheader on those responses replaces the computed delay (between 1 second and 60 minutes). - What is not retried: any other
4xxresponse, including408, an invalid URL, or a redirect other than307/308. Delivery stops at the first such response. - Timeout: each attempt waits up to 10 seconds for your response. Return
2xxright away and do slow work afterwards. - Destinations: the URL must resolve to a public address. Up to three
307/308redirects are followed.
Because a retry can arrive after your endpoint already processed the event, for example when your 2xx response timed out, handle duplicates. Deduplicate on the Sync-Delivery-Id header, or on the generation or batch id in the payload. Every attempt is signed again with a new timestamp, so the Sync-Signature value differs between attempts of the same delivery.
If every attempt fails, the event is not sent again. Poll Get Generation or Get Batch to recover missed results.
Error Handling in Webhooks
The generation webhook payload has the same fields as Get Generation for id, createdAt, status, model, input, webhookUrl, options and outputUrl, plus synthesizedAudioUrl for generations that used a text input. When a generation fails or is rejected, two fields describe why, and both are null otherwise:
error: A human-readable error message describing what went wrongerrorCode: A machine-readable error code for programmatic error handling (see the Error Handling guide andGET /v2/errorsfor the full list)
Branch on errorCode, not on the message text. See the payload reference for every field.
Verify webhook signatures
To ensure webhook requests are coming from sync. labs, we sign each webhook request with a signature. The signature is included in the Sync-Signature header.
To verify signatures, use your signing secret. You can also retrieve it programmatically with GET /v2/organizations/webhook/secret. Store the full whsec_... value securely; masked=true is display-only and must not be used for verification.
The header has the form t=<timestamp>,v1=<signature>:
t: the Unix time in seconds when this attempt was sentv1: the hex HMAC-SHA256 of<t>.<raw request body>, keyed with your signing secret
Compute the HMAC over the exact bytes you received, not over re-serialized JSON. To limit replays, you can also reject requests whose t is far from your current time; allow a few minutes for clock skew.
Related Resources
- Batch Processing: use webhooks with batch processing for high-volume workflows
- Rate Limits: understand API rate limiting and how it affects webhook delivery
Frequently Asked Questions
How do I test webhooks locally?
Use a tunneling tool like ngrok to expose your local server to the internet. Start your webhook endpoint locally, then run ngrok to get a public HTTPS URL. Pass that URL as the webhookUrl when creating a generation. sync. labs will send POST requests to your local server through the tunnel.
What if my endpoint is down?
Sync retries timeouts, connection errors, 429 and 5xx responses up to 5 times (6 attempts in total) over about 2 hours, honoring Retry-After. Other 4xx responses are not retried. If your endpoint stays down past the last attempt, the event is not sent again, so poll the generation or batch status endpoint to recover missed results. Retries can deliver the same event more than once; deduplicate on the Sync-Delivery-Id header or the generation or batch id.
How do I verify webhook signatures?
Each webhook request includes a Sync-Signature header containing a timestamp and HMAC-SHA256 hash. Use your signing secret from the webhooks settings page to compute the expected signature and compare it using a timing-safe comparison function to prevent timing attacks. See the code examples above.

