Skip to content

Idempotency and retries

Networks fail. This page says which requests you can safely send again, and how NuacemOne spots duplicates.

  • Retry only on network errors, timeouts, 429 and 5xx answers.
  • Do not retry 400, 401, 403, 404 or 422 unchanged. Fix the cause first.
  • Use exponential backoff with jitter: for example 1 s, 2 s, 4 s, 8 s, up to about 30 s, and give up after a few attempts.
  • Set a client timeout on every call. Reply streams can take a while, so allow up to a few minutes for POST .../messages.
Request Safe to retry? Notes
Start a chat or call With care Each successful call creates a new chat or call. If a start timed out, the first one may exist. Send the same visitorId so the retries count against the same visitor, and end chats you do not use.
Send a message Only if the stream never started If you got a 409 turn_in_progress, wait and send again. If the connection broke after events began, the message was received and may have been answered; do not resend it automatically. After an error event such as turn_failed or llm_unavailable, the visitor can send it again.
Upload a file With care Each upload counts toward the chat’s file limit. Retry only on a network error before an answer, or on 503.
Voice note Yes Nothing is stored; a retry just transcribes again.
Feedback Yes Only the first rating counts; a repeat answers 409 feedback_given. Treat that as success.
End a chat Yes DELETE answers 204 even when the chat has already ended.
Live agent events Yes Send the last cursor you processed as after; you get each event once.

POST /public/v1/workflows/{workflowId}/runs has no idempotency header. Duplicates are caught by the trigger’s own settings, which you set in the workflow:

  • Duplicate key: the trigger names one input field (for example appointmentId) as its duplicate key. A second start with the same value returns the existing run with deduplicated: true, however much later it comes. This is the safest way to make starts retryable.
  • Duplicate window: a start with the same correlation within the window returns the recent run with deduplicated: true.

Without either setting, every successful start creates a new run. See Starting runs.

POST /public/v1/events is idempotent by eventId. Send your own unique id for each real-world event (for example the id from your database or message queue). A repeat with the same eventId does nothing and answers 202 with duplicate: true. Event ids are remembered across your whole organisation.

If the call failed with 503 studio_unavailable, the event id is not used up, so retrying with the same id is correct.

Request Safe to retry? Notes
Read a run, list tasks Yes Read only.
Cancel a run Yes Once the run has finished, a repeat answers 409 run_finished. Treat that as success.
Decide a task Yes A repeat after success answers 409 task_closed (or already_approved for a multi-approver approval). If you got 503 engine_unavailable, the decision is already saved; retrying is safe.
Signed hook Sign again The same signed request is accepted once; a repeat answers 409 replayed. Build a new timestamp and signature for each attempt. To avoid duplicate runs, give the trigger a duplicate key.

NuacemOne retries webhooks it sends you, so you may receive the same one more than once. Make your handler idempotent:

  • Workflow webhooks: dedupe on the X-VoiceCX-Event-Id header (the same as the payload’s id). See Workflow events.
  • Transcript webhooks: dedupe on the X-VoiceCX-Delivery header (the same as the payload’s deliveryId). See Transcript delivery.