The Playto API supports idempotency for safely retrying requests without accidentally performing the same operation twice. This is useful when an API call fails due to a network connection error, and you want to retry the request without worrying about creating duplicate invoices, products, or customers. To perform an idempotent request, attach an Idempotency-Key header to your request.

How it works

When you send a POST request with an Idempotency-Key header, we will save the resulting status code and body of the first request made for any given key. Subsequent requests with the same key will return the exact same result, including HTTP status code and response body.
  • Duration: Idempotency keys are cached for 24 hours.
  • Conflicts: If you reuse an Idempotency-Key with a different request body, the API will return a 409 Conflict error (idempotency_conflict).
  • Concurrent requests: If a request is still processing, concurrent requests with the same key are rejected with the same 409 Conflict error (idempotency_conflict) to prevent race conditions.
  • Errors: If the original request fails (any 4xx or 5xx response), the key is not stored, so you can retry with the same key. Only successful (2xx) responses are replayed.

How to generate a key

The API accepts any string up to 255 characters, but we strongly recommend using a V4 UUID (Universally Unique Identifier). You should generate the key on your backend immediately before making the API call. If the request fails due to a network error, you must reuse that exact same key on the retry.

Supported Endpoints

Idempotency is supported on all POST (create) endpoints:
  • POST /v1/products/
  • POST /v1/invoices/
  • POST /v1/customers/