Idempotency

Idempotency ensures that retrying requests won’t accidentally repeat operations. When creating or updating a resource, use an Idempotency-Key. This key lets you safely retry requests without worrying about duplicating an action.

How to Use Idempotency

All POST and PUT requests accept an Idempotency-Key header to make it idempotent. Since GET and DELETE requests are idempotent by definition, idempotency keys will be ignored for these operations.

Here’s how it works:

  1. First Request: When you send a request with an Idempotency-Key, Abound saves the status code and response body if it results in a 2xx or 5xx response. Requests that result in a 4xx response will not be saved even if an Idempotency-Key is supplied.
  2. Subsequent Requests: Any subsequent request with the same Idempotency-Key header, HTTP method, and request body will return the same result. You will also receive an Idempotency-Returned: true response header with your result.

Key Management

Clients generate idempotency keys, typically using UUIDs or other random strings to prevent collisions. These keys can be up to 191 characters long.

Idempotency keys are automatically removed after 24 hours. After a key is removed, it can be reused, and a new request is generated. The system checks the incoming request against the original request to prevent accidental misuse.

Idempotency results are saved after an endpoint execution is complete. If the request fails validation or there’s a conflict with another concurrent request, the result isn’t saved, and you can retry the request.