Idempotency

Idempotency guarantees that repeating the same write request (POST, PUT, PATCH) within a short window returns the original response instead of creating a duplicate object. Bead will add this feature soon; the details below describe the planned contract so you can design for it now.

Status

Idempotency is not yet enforced in Sandbox or Production. Expect network retries to create duplicate records until enforcement is announced in the changelog.

Header format

Header
Example value
Notes

Idempotency-Key

550e8400-e29b-41d4-a716-446655440000

Case-insensitive UUID v4 string.

Evaluation rules (planned)

Condition
Server behaviour

Same Idempotency-Key and identical request body within 24 h

Return the cached 2xx response (status and body).

Same Idempotency-Key but different body

Return 409 Conflict with an error explaining the mismatch.

Key older than 24 h

Treat as a brand-new request.

Keys are stored per endpoint path; using the same key for different paths does not collide.

Example

curl -X POST "$BEAD_API/Locations" \
     -H "Authorization: Bearer $TOKEN" \
     -H "Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000" \
     -H "Content-Type: application/json" \
     -d '{ "merchantId": "mer_123", "address": {...} }'

If the client times out and sends the identical call again with the same key, the API responds with the original 201 body.

Best practices

  • Generate a fresh UUID v4 for each logical operation (one per new location, one per new terminal, etc.).

  • Store the key client-side until the operation succeeds or fails definitively.

  • Do not reuse keys across resource types or different merchants.

  • If you receive 409 Conflict, inspect the error; it means the same key was used with a modified body.

  • Maintain client-side retries with exponential back-off even after idempotency is live; the feature only prevents duplication, it does not guarantee success.

Go-live checklist for integrators

  1. Implement the header now in sandbox calls; it will be ignored until launch.

  2. Log any 409 Conflict responses so you can catch accidental key reuse.

  3. Watch the global changelog for the announcement that enforcement is active.

Last updated