Skip to main content
A network timeout leaves you unsure whether Tilta received your request. Retrying a create request blindly can create the same buyer, order, invoice, or credit facility twice. An idempotency key lets Tilta recognise the retry: send the same key again and Tilta rejects the repeat instead of processing it a second time.

Supported endpoints

The following endpoints accept an idempotency key: The header is optional. Without it, Tilta processes every request it receives.

Sending a key

Generate a new random UUID for each operation and send it in the Idempotency-Key header. Keep the key with the operation so that a retry sends the same value.
The key must be a UUID in the 8-4-4-4-12 hexadecimal form. Any other value is rejected with a 400 and the code INVALID_IDEMPOTENCY_KEY. Use a version 4 UUID from your language’s standard library.

How Tilta handles a repeated key

Each key belongs to one operation. Reusing a key for the same operation returns a 409 with the code CONFLICT, and Tilta doesn’t process the request. Tilta keeps used keys indefinitely, so a key can’t be reused later either. The same key on a different operation – for example, create a buyer and then create an order – counts as a separate key. The 409 doesn’t repeat the response of the original request.

When a key counts as used

Tilta records a key once the request has passed authentication and validation, and before the request is processed:
  • Rejected with 401 or 400. The key isn’t used. Fix the request and retry with the same key.
  • Accepted for processing. The key is used, whatever the outcome. If processing then fails – for example with a 404, a 409 for a resource that already exists, or a 500 – a retry with the same key returns a 409.