Yousign webhooks in production: duplicates, ordering, retries and timeouts

Published · Updated

This guide covers what goes wrong with Yousign webhooks once they carry real contracts, and how to handle it. Yousign's docs now live at developers.youtrust.com under the Youtrust brand, but deliveries still use x-yousign- headers.

For the basics, see the Yousign webhooks overview, the event list and how to verify the signature.

At a glance

ProblemWhat to doWith Event Gateway
TimeoutsAnswer within 1 second; process in a background jobAccepts the delivery at once, then queues it for your service
DuplicatesRecord each event_id; make handlers idempotentDrops repeats before they reach your handler
OrderingTolerate late events; fetch current state when it mattersLogs every event and attempt, so you can see arrival order when debugging
RetriesSet auto_retry to true; monitor X-Yousign-Retry; reconcile after an outageAccepts deliveries while your service is down and replays them
Choosing eventsName the events you handle; separate sandbox from productionFilters and routes events by type
TestingTrigger sandbox events and forward them to localhostForwards to localhost and replays past events
Other limitsDeduplicate instead of checking age; plan for quotas and endpoint rulesGives Yousign one public HTTPS endpoint and fans out from there

Yousign's 1-second webhook timeout

Answer the first attempt within 1 second, then do the work in a background job. A response that arrives later counts as a failure, even if it's a 2xx.

Why it happens: Yousign applies what it calls a fail-fast timeout: 1 second for the first attempt and 10 seconds for each retry, and its docs tell you not to rely on the longer limit. Cold starts, a slow database write or a call to download the signed document are enough to miss it. Your endpoint can be healthy and returning 200 while Yousign records failures.

Fix it in your handler:

  1. Verify the signature, store the raw event and respond, with nothing else on the request path.
  2. Download documents and update records from a background job. See why to process webhooks asynchronously.
  3. Keep the endpoint warm if it runs on serverless infrastructure.

With Event Gateway: Hookdeck acknowledges Yousign as soon as a request arrives, then delivers to your service with its own timeout and retry policy, so the 1-second limit no longer applies to your code.

Duplicate Yousign webhooks

Yousign can deliver the same webhook more than once. Store each event_id and skip any you've already handled.

Why it happens: Yousign's docs name retries and network issues as the causes. The 1-second limit makes this more likely: a handler that finishes its work in 2 seconds has done the work, and Yousign still treats the delivery as failed and retries it.

Fix it in your handler:

  1. Record event_id, which Yousign says is globally unique, in a table with a unique constraint.
  2. Make every handler idempotent: the same result however many times it runs.
  3. Wrap the side effect and the event_id record in one transaction.

With Event Gateway: Hookdeck deduplicates events before they reach your endpoint, and can match on event_id.

Out-of-order Yousign webhooks

Yousign's webhook docs don't mention delivery order, so don't assume arrival order matches the order things happened.

Why it happens: Retries wait between 2 minutes and 2 days. A signer.done that fails its first attempt can arrive after the signature_request.done for the same request. For more on the general problem, see Webhook Ordering: Why It's Hard and How to Handle It.

Fix it in your handler:

  1. Write state transitions that tolerate late events, so a late signer.notified can't move a completed request backwards.
  2. Compare event_time when you need to tell which event is older. It records when the event occurred and stays the same through retries, but Yousign's example is in whole seconds, so events can tie.
  3. When order matters, fetch the Signature Request's current state from Yousign's API.

With Event Gateway: Hookdeck logs every event and delivery attempt, so when state looks wrong you can see the order events actually arrived in and replay them.

Yousign webhook retries and suspended endpoints

Set auto_retry to true on every subscription. It's what gives you up to 8 retries, over about 4 days.

Why it happens: A delivery fails on a status other than 2xx or 3xx, a timeout, or more than two redirects. With auto_retry on, Yousign retries after 2 minutes, 6 minutes, 30 minutes, 1 hour, 5 hours, 18 hours, 1 day and 2 days. With it off, the only retry Yousign describes is a single one after a first-attempt timeout. If too many retries keep failing, Yousign may temporarily suspend deliveries to the endpoint and queue them until it's stable, without publishing a threshold. Its docs don't say what happens to an event after the last retry.

Fix it in your handler:

  1. Send auto_retry: true when you create a subscription through the API, where the field is required. The app's creation steps don't mention it, so read app-created subscriptions back from the API to check.
  2. Monitor X-Yousign-Retry, which is 0 on the first attempt, and alert on higher values before suspension becomes a risk.
  3. Reconcile important signature requests through the API after an outage, and expect a backlog when deliveries resume.

Deleting a subscription stops all deliveries immediately and cancels retries in progress. An update only applies to events triggered after it.

With Event Gateway: Hookdeck keeps accepting Yousign's deliveries while your service is down, so your outages don't build up a failure history at Yousign. Failed events can be retried automatically, manually or in bulk once you recover.

Choosing which Yousign events to listen to

Subscribe to the events your integration handles by name, and keep sandbox and production apart.

Why it matters: Yousign's 58 event types cover signature requests, signers, approvers, seals, verifications, workflows and monitoring. The * wildcard covers every event that exists when you create or update the subscription, so a type Yousign adds later isn't included until you update it. Yousign's overview page also lists fewer events than its API reference, so check both when you build your list.

Fix it in your handler:

  1. Start with signature_request.done, signer.done, signer.declined and signature_request.expired, then add what your workflow needs.
  2. Narrow a subscription with its scope and workspace filters: scopes picks the channel that created the resource, such as app or public_api, and workspaces limits it to specific workspace IDs.
  3. Use a separate subscription for each environment. If they share an endpoint, check sandbox before acting, so a test signature never updates a production record.
  4. Keep handling verification.bank_account_connection.done if you already receive it. It can no longer be subscribed to, but older subscriptions still get it.

With Event Gateway: Hookdeck filters and routes events by type or any other property, so one Yousign subscription can feed several services.

Testing Yousign webhooks

Create a sandbox subscription, trigger a test Signature Request and forward the deliveries to your local server.

Why it matters: Yousign needs a public HTTPS endpoint and refuses self-signed certificates and private networks, so it can't reach a development machine directly. Trial API accounts can only create sandbox subscriptions, and only in the app.

Fix it in your setup:

  1. Run npx hookdeck-cli listen 3000 yousign --path /webhooks/yousign and use its URL as the sandbox subscription's endpoint.
  2. Trigger a test Signature Request in sandbox and watch the events arrive.
  3. Delete temporary subscriptions when you finish. Yousign warns that expired test URLs cause unnecessary failed calls.

With Event Gateway: The Hookdeck CLI forwards events to localhost, and you can replay a past event instead of creating another Signature Request.

Other Yousign limits

Four smaller limits to plan for.

No signed timestamp. Only the body is signed. X-Yousign-Issued-At sits outside the signature, and event_time stays the same through retries, so neither can bound a replay. Deduplicate on event_id instead.

Subscription quotas. You can have up to 10 subscriptions on the PLUS plan, 20 on PRO and 50 on SCALE.

Endpoint rules. The endpoint must be public HTTPS with a certificate that isn't self-signed.

Firewalls. If you restrict inbound traffic, Yousign lists the addresses to allow: 57.130.41.144/28, 51.38.96.112/28, 5.39.7.128/28, 52.143.162.31 and 51.103.81.166.

With Event Gateway: Hookdeck gives Yousign one public HTTPS endpoint and sends its events to as many destinations as you need, which can reduce how many subscriptions you use.

Stop missing Yousign's 1-second window.

A slow Yousign handler counts as a failed delivery even when it succeeds. Hookdeck Event Gateway answers Yousign as soon as a delivery arrives, verifies its signature, queues it and delivers to your service with its own timeouts and retries.

Not affiliated with Yousign. Facts are compiled from public sources and linked inline.