Docs
Developers

Retry writes safely

Send an Idempotency-Key with every POST so retries never make a change twice.

Every POST request needs an Idempotency-Key header. If a request times out or the connection drops, send it again with the same key: the API makes the change at most once.

curl https://app.enlytning.com/api/v1/assignments \
  -H "Authorization: Bearer $ENLYTNING_API_KEY" \
  -H "Idempotency-Key: 8e0f7c1a-hr-sync-2026-10-05" \
  -H "Content-Type: application/json" \
  -d '{"material_id": "…", "user_ids": ["…"]}'

Choose keys

Use a new key, up to 255 characters, for each change you mean to make. A UUID works, or an id from your own system that names the change.

What a retry returns

For 24 hours after the first request, a request with the same key and API key gets:

SituationResponse
The first request finishedThe first response again, with Idempotent-Replayed: true
The first request was invalid (400)The same error again
The first request was refused with a 404, 409 or 422 error, or failed with a 5xx errorThe request runs again, as if new
The first request is still running409 with the code idempotency_key_in_flight
The body or path differs from the first request422 with the code idempotency_key_reused

An invalid request fails the same way every time, so fix it and send it with a new key. A refusal that depends on your data, such as a material that isn’t published yet, doesn’t hold the key: once the cause is fixed, retry with the same key.

Partial success

Assigning a material assigns everyone it can and lists the rest in skipped, with a reason. If it can assign nobody, the response is still 201, with an empty data. Assigning a learning path is all or nothing: if anyone is ineligible, nobody is assigned and the 422 response lists them in details.

Inviting people invites everyone it can and lists the rest in failed, with a code. Anyone invited whose email couldn’t be sent is also listed in not_emailed, and their invite can be resent from the app. A missing seat or an unknown group refuses the whole request with a 422, and nobody is invited. Adding people to a group adds everyone not already in it and lists the rest in already_members.

On this page