Developers
Using the API

Idempotency

Optional Idempotency-Key on POST, replay, and the 409 and 422 cases.

Network retries can send the same create twice. For POST requests you may send an Idempotency-Key header. A UUID is a fine value. The key identifies one logical operation.

  • Optional. Requests without the header behave as they do today.
  • POST only. PUT, PATCH, and DELETE are not handled by this header.
  • Same key, same request. If a previous POST with that key completed with HTTP 2xx, the API returns the stored response and does not create another resource. The response includes Idempotent-Replayed: true.
  • Same key, different body. The API rejects it with 422 Unprocessable Content and does not create a resource. Generate a new key for a different operation.
  • Failed requests. Non-2xx responses are not stored. You may retry with the same key after fixing the error.
  • In progress. If the same key is used while the first request is still processing, the API responds with 409 Conflict.
  • Retention. Successful responses are remembered for 24 hours. After that, the same key may create a new resource.

The API description uses this illustration. The body is not a complete sales invoice. The required fields are on Sales Invoice - Create.

POST /v1/invoicing/{business_slug}/invoice/
Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000
Authorization: Token <your_token_here>
Content-Type: application/json

{"contact": 1, "lines": []}

That body is not a valid sales invoice. The required fields are on Sales Invoice - Create. Keep the header rules above.