Skip to content

Idempotency and safe retries

A network timeout does not tell you whether a mutation failed or completed before the response was lost. For the operations listed below, send an Idempotency-Key so the same logical request can be retried safely.

Generate a new UUID for each new logical mutation and pass it in the request header:

Terminal window
curl -X POST "https://api.ltesocks.io/v2/ports/10000/reset" \
-H "Authorization: Bearer ${LTESOCKS_API_TOKEN}" \
-H "Idempotency-Key: 7c838e2d-7d52-42e7-aed1-528829cbd514"

Official SDKs create a key automatically for supported mutations. Pass a stored UUID explicitly when continuing the same logical request across application restarts:

const port = await client.ports.reset({
id: '10000',
idempotencyKey: '7c838e2d-7d52-42e7-aed1-528829cbd514',
});

Store the key with the method, path, and body until the result is known. Reuse it only for an exact retry of that request. A new business action, or a request with a changed path or body, needs a new UUID.

When the API returns a previously stored result, the response includes:

Idempotency-Replayed: true

The replay preserves the original response and its response headers, including Retry-At and Retry-After when they were present.

OutcomeAction
Connection closed or timed out before a responseRetry the exact request with the same key
The resource already shows the requested changeDo not send the mutation again
Validation or authentication errorFix the cause; a changed request uses a new key
Reset cooldown responseWait for Retry-After or Retry-At, then decide whether the same logical request is still needed
Intentionally starting another mutationGenerate a new key

Use bounded exponential backoff with jitter for transient failures. Idempotency prevents duplicate execution; it does not make unlimited retries or high concurrency safe.

The public contract accepts Idempotency-Key on these mutations:

AreaOperations
AccountPOST /user/preferences
OrderingPOST /ports/order
PlanPOST /ports/{id}/extend, POST /ports/{id}/plan
Port settingsPOST /ports/{id}/tags, POST /ports/{id}/autorenew, POST /ports/{id}/signature, POST /ports/{id}/credentials, POST /ports/{id}/autoreset
ConnectionPOST /ports/{id}/reset

Do not attach the header to every POST by default. For example, the port filter operation POST /ports and compatibility delete operations do not document idempotency support. Check the API reference for the header on the specific operation.

For reset-specific cooldown and completion behavior, see Port reset and readiness.