AI ready
Open in Claude (opens in a new tab)View as Markdown

Idempotency

Why every write carries an Idempotency-Key, what happens when you send one again, and how secrets are kept out of a replay.

Updated 5 November 20262 min read

On this page
  1. Send a key with every write
  2. What a retry gets
  3. Secrets are never replayed

A network can drop the answer to a request that did go through. If you simply send it again, a server restarts twice or an order is placed twice. An Idempotency-Key makes the retry safe: the API recognises the key, and the write happens once.

Send a key with every write

Every POST, PUT, PATCH and DELETE needs an Idempotency-Key header. The one exception is previewing an order, which writes nothing. The reference shows the header on each operation that takes it; a write without one answers 400 idempotency_key_required.

The key is 1 to 128 characters of letters, digits, _, ., : and -. Make a new UUID for each logical request, and send the same one when you retry that request.

POST/services/{serviceId}/powerReference

Run a power actionLanguage
curl -X POST https://api.clouduxe.com/v1/services/c3a1f6d2-8b4e-4a9c-b7d5-2e1f0a3c6b8d/power \
  -H "Authorization: Bearer $CLOUDUXE_API_KEY" \
  -H "Idempotency-Key: 6f1c2e9a-4b7d-4e3a-9c8f-1a2b3c4d5e6f" \
  -H "Content-Type: application/json" \
  -d '{"action":"restart"}'
202 example
{
  "object": "action",
  "id": "f5c8b2a1-6e3d-4c9f-b1a7-3d2e9c0f4b6a",
  "type": "restart",
  "status": "running",
  "serviceId": "c3a1f6d2-8b4e-4a9c-b7d5-2e1f0a3c6b8d",
  "orderId": null,
  "invoiceId": null,
  "failure": null,
  "secretAvailable": false,
  "secretExpiresAt": null,
  "createdAt": "2026-12-04T09:20:11Z",
  "startedAt": "2026-12-04T09:20:11Z",
  "completedAt": null,
  "livemode": true
}

Other responses

400Bad requestversion_invalid, idempotency_key_required, idempotency_key_invalid, invalid_json, parameter_missing, parameter_invalid, parameter_unknown
{
  "error": {
    "type": "invalid_request_error",
    "code": "version_invalid",
    "message": "Clouduxe-Version does not name an API version.",
    "param": null,
    "requestId": "8f14e45f-ceea-467a-9f2b-1c3d5e7a9b0c",
    "docUrl": "https://docs.clouduxe.com/api/errors#version_invalid"
  }
}

Also answered with this status: idempotency_key_required, idempotency_key_invalid, invalid_json, parameter_missing, parameter_invalid, parameter_unknown.

401Unauthorizedtoken_missing, token_invalid, token_expired, token_revoked
{
  "error": {
    "type": "authentication_error",
    "code": "token_missing",
    "message": "No API token was sent. Send it as Authorization: Bearer <token>.",
    "param": null,
    "requestId": "8f14e45f-ceea-467a-9f2b-1c3d5e7a9b0c",
    "docUrl": "https://docs.clouduxe.com/api/errors#token_missing"
  }
}

Also answered with this status: token_invalid, token_expired, token_revoked.

403Forbiddenforbidden, ip_not_allowed, api_access_disabled, scope_missing
{
  "error": {
    "type": "permission_error",
    "code": "forbidden",
    "message": "Your role on this service does not allow this action.",
    "param": null,
    "requestId": "8f14e45f-ceea-467a-9f2b-1c3d5e7a9b0c",
    "docUrl": "https://docs.clouduxe.com/api/errors#forbidden"
  }
}

Also answered with this status: ip_not_allowed, api_access_disabled, scope_missing.

404Not foundnot_found
{
  "error": {
    "type": "not_found_error",
    "code": "not_found",
    "message": "No such object, or it is not visible to this token.",
    "param": null,
    "requestId": "8f14e45f-ceea-467a-9f2b-1c3d5e7a9b0c",
    "docUrl": "https://docs.clouduxe.com/api/errors#not_found"
  }
}
409Conflictservice_not_ready, service_building, idempotency_in_progress
{
  "error": {
    "type": "conflict_error",
    "code": "service_not_ready",
    "message": "This service is still being set up.",
    "param": null,
    "requestId": "8f14e45f-ceea-467a-9f2b-1c3d5e7a9b0c",
    "docUrl": "https://docs.clouduxe.com/api/errors#service_not_ready"
  }
}

Also answered with this status: service_building, idempotency_in_progress.

413Too largerequest_too_large
{
  "error": {
    "type": "invalid_request_error",
    "code": "request_too_large",
    "message": "The request body is larger than 1 MiB.",
    "param": null,
    "requestId": "8f14e45f-ceea-467a-9f2b-1c3d5e7a9b0c",
    "docUrl": "https://docs.clouduxe.com/api/errors#request_too_large"
  }
}
415Unsupported media typeunsupported_media_type
{
  "error": {
    "type": "invalid_request_error",
    "code": "unsupported_media_type",
    "message": "The request body must be application/json.",
    "param": null,
    "requestId": "8f14e45f-ceea-467a-9f2b-1c3d5e7a9b0c",
    "docUrl": "https://docs.clouduxe.com/api/errors#unsupported_media_type"
  }
}
422Unprocessableidempotency_mismatch
{
  "error": {
    "type": "idempotency_error",
    "code": "idempotency_mismatch",
    "message": "This Idempotency-Key was already used with a different request.",
    "param": null,
    "requestId": "8f14e45f-ceea-467a-9f2b-1c3d5e7a9b0c",
    "docUrl": "https://docs.clouduxe.com/api/errors#idempotency_mismatch"
  }
}
423Lockedservice_locked, service_unconfirmed
{
  "error": {
    "type": "conflict_error",
    "code": "service_locked",
    "message": "This service is suspended, cancelled or terminated.",
    "param": null,
    "requestId": "8f14e45f-ceea-467a-9f2b-1c3d5e7a9b0c",
    "docUrl": "https://docs.clouduxe.com/api/errors#service_locked"
  }
}

Also answered with this status: service_unconfirmed.

429Too many requestsaction_limit_reached, rate_limited
{
  "error": {
    "type": "rate_limit_error",
    "code": "action_limit_reached",
    "message": "This service has reached its limit for this action.",
    "param": null,
    "requestId": "8f14e45f-ceea-467a-9f2b-1c3d5e7a9b0c",
    "docUrl": "https://docs.clouduxe.com/api/errors#action_limit_reached"
  }
}

Also answered with this status: rate_limited.

500Server errorinternal_error
{
  "error": {
    "type": "api_error",
    "code": "internal_error",
    "message": "An unexpected error occurred. It has been logged with this request id.",
    "param": null,
    "requestId": "8f14e45f-ceea-467a-9f2b-1c3d5e7a9b0c",
    "docUrl": "https://docs.clouduxe.com/api/errors#internal_error"
  }
}
503Unavailableactions_unavailable, platform_unavailable, unavailable, outcome_unknown, limits_unavailable
{
  "error": {
    "type": "api_error",
    "code": "actions_unavailable",
    "message": "Server actions are paused for a moment.",
    "param": null,
    "requestId": "8f14e45f-ceea-467a-9f2b-1c3d5e7a9b0c",
    "docUrl": "https://docs.clouduxe.com/api/errors#actions_unavailable"
  }
}

Also answered with this status: platform_unavailable, unavailable, outcome_unknown, limits_unavailable.

The Node and PHP SDKs make a key for every write and reuse it on their own retries, so you never handle one there.

What a retry gets

What you sendWhat you get
The same key and the same request, after the first one finishedThe first answer again, with Idempotent-Replayed: true. The write happened once.
The same key while the first request is still runningAfter up to 4 seconds, 409 idempotency_in_progress with Retry-After: 1. Retry with the same key.
The same key with a different request422 idempotency_mismatch. Use a new key for a new request.
The same key after the first request failed (any 4xx or 5xx)The request runs again: a failure stores nothing.
The same key after 503 outcome_unknownThe retry settles it: it answers what happened, or does the write once.

A write commits its whole effect and its stored answer together, so you never get a 4xx for a write that took effect.

Keys belong to the token that sent them, so two tokens never collide, and they are kept for 48 hours.

Secrets are never replayed

A replay never repeats a secret:

  • Creating a webhook endpoint and rotating its secret answer the signing secret in the first response only. A replay answers secret: null. If you lost the secret, rotate it.
  • No write ever answers a server password. Provisioning, reinstalling and resetting a password answer an action, and the password, when there is one, is read from the action itself; see Long-running actions.

Need a server, or a hand with one?

Pick a plan to deploy a server, or open a ticket in the panel. Support runs 24/7/365.