> For the complete documentation index, see [llms.txt](https://giremobility.gitbook.io/api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://giremobility.gitbook.io/api/v3/puds/idempotent-requests.md).

# Idempotent requests

This API has support for idempotency, ensuring safe retries of requests and preventing accidental duplication of operations.

**Header**

| Name              | Value         |
| ----------------- | ------------- |
| `Idempotency-Key` | `somekeyhere` |

By providing an idempotency key header with any `POST` request, you can be certain that the operation is executed only once. We don't impose any restrictions on the key, but suggest using V4 UUIDS.

We store the status code and body of the resulting response, so any subsequent requests containing the same idempotency key header will return the same result. The exception is errors that result from incoming parameters failing validation, or the cases explained below.

{% hint style="info" %}
When a response is replayed, you'll see an `Idempotent-Replayed: true` header in the response.
{% endhint %}

{% hint style="warning" %}
Keys are removed after **24 hours**, after which those keys can be reused.
{% endhint %}

### 409 Conflict

If another request with the same key is still being processed concurrently and has not completed yet, you'll get a 409 Conflict error

```
{
    "message": "A request with the same Idempotency-Key is being processed"
}
```

### 422 Unprocessable Entity

If an existing idempotency-key is used, but the request payload is different, you'll get a 422 Unprocessable Entity error.

```
{
    "message": "This idempotency key has already been used with a 
                different request body"
}
```
