# API Idempotency [View original](https://ittybit.com/api/idempotency) ### Idempotency-Key Header You can use the `Idempotency-Key` header to deduplicate `POST` requests. If you include this header in your request, we will ensure that the request is only processed once, even if it is made multiple times. ```js const response = await fetch(`https://api.ittybit.com/files`, { method: "POST", headers: { "Authorization": "Bearer ITTYBIT_API_KEY", "Idempotency-Key": "my-unique-idempotency-key", }, body: JSON.stringify({ url: "https://ittyb.it/sample.mp4", }), }); ``` ```shell curl -X POST https://api.ittybit.com/files \ -H "Authorization: Bearer ITTYBIT_API_KEY" \ -H "Idempotency-Key: my-unique-idempotency-key" \ -d '{"url": "https://ittyb.it/sample.mp4"}' ``` This is useful for requests that may be retried by your system, for example if your system crashes before it can process the response from the API. *** ## Valid Keys The `Idempotency-Key` header must be a unique string between 16 and 32 characters in length. A good option is to [generate a hash](https://en.wikipedia.org/wiki/Hash_function) from the values you are sending in the request. *** ## Expiry Idempotency keys are valid for \~24 hours from first creation. After this time, the key will expire and the request will no longer be deduplicated. *** ## Errors Sending different request bodies with the same `Idempotency-Key` will result in an error.