Idempotency and retries
Networks fail. This page says which requests you can safely send again, and how NuacemOne spots duplicates.
How to retry
Section titled “How to retry”- Retry only on network errors, timeouts,
429and5xxanswers. - Do not retry
400,401,403,404or422unchanged. 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.
Conversations API
Section titled “Conversations API”| 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. |
Workflows API
Section titled “Workflows API”Starting runs
Section titled “Starting runs”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 withdeduplicated: true, however much later it comes. This is the safest way to make starts retryable. - Duplicate window: a start with the same
correlationwithin the window returns the recent run withdeduplicated: true.
Without either setting, every successful start creates a new run. See Starting runs.
Business events
Section titled “Business events”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.
Other requests
Section titled “Other requests”| 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. |
Webhooks you receive
Section titled “Webhooks you receive”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-Idheader (the same as the payload’sid). See Workflow events. - Transcript webhooks: dedupe on the
X-VoiceCX-Deliveryheader (the same as the payload’sdeliveryId). See Transcript delivery.