Get started

Idempotency

How the Idempotency-Key header makes a retried TimeSubmit API write safe: the key's format, how long an answer is kept and the conflict answer.

Safe retries

Send an Idempotency-Key header with any write, so you can retry it without making the change twice. A new UUID for each change is enough.

curl -X POST "https://www.timesubmit.com/api/v1/clients" \
  -H "Authorization: Bearer $TIMESUBMIT_API_KEY" \
  -H "Idempotency-Key: 7f1c2b0e-3d4a-4e8f-9b6c-5a2d1e0f3c47" \
  -H "Content-Type: application/json" \
  -d '{"name": "Northwind Traders"}'

The rules

  • A key is 1 to 255 printable ASCII characters with no spaces. Anything else is refused with invalid_request.
  • Once a write succeeds, the same key with the same request within 24 hours gets that answer back and changes nothing.
  • A refused request is not remembered, so its retry runs again.
  • The same key with a different method, path or body is refused with idempotency_conflict.