> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eazecustoms.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Idempotency

> Learn how to safely retry write requests without creating duplicate records.

## What you can do

The Create Shipment, Create Transit Declaration, Create Upload, Complete Upload, and both import requests require an `Idempotency-Key` header.

This key allows you to safely retry a request if the network fails after it is sent. It prevents duplicate records but does not make a failed business operation succeed.

## Before you start

Generate a unique key for each new request. A UUID is recommended. The key must contain 1 to 200 visible ASCII characters.

The generated API description specifies 8 to 255 characters, but the API accepts 1 to 200 characters. Always follow the API's accepted range: 1 to 200 characters.

Eaze Customs stores the key for 30 days.

## Steps

**1. Use a new key for a new action**

A new Shipment, a new upload, and a new import each need their own key.

**2. Reuse the key only for the same request**

If you do not receive a response, send the same method, path, headers, and JSON body with the same key. Eaze Customs returns the original result instead of creating a second record.

**3. Change the key when the request changes**

A corrected file, a different template, or any changed field is a new request. Use a new key. After Import Manifest accepts the file, also create a new upload. A header mismatch returned before acceptance does not consume the upload. See [Manifest Import](https://docs.eazecustoms.com/implementation/manifest-import.md).

## Working example

```http theme={null}
Idempotency-Key: 6f1c0b3e-8a21-4c5d-9e10-1a2b3c4d5e6f
```

Same key and same body after a timeout: you receive the stored response again.

Same key and a different body:

```json theme={null}
{
  "errorCode": "E0006",
  "message": "Idempotency-Key was already used with a different request",
  "errors": [
    {
      "code": "idempotency_key_reused",
      "message": "Idempotency-Key was already used with a different request"
    }
  ],
  "requestId": "550e8400-e29b-41d4-a716-446655440000"
}
```

If the same request is still being processed, you can receive `idempotency_in_progress`. Wait briefly and send the same request again.

## Idempotency is not upload reuse

An idempotency replay returns the original import acceptance. It does not start a second import.

A consumed `uploadId` cannot be used on a new import, even when the accepted import failed or needs review. Create a new upload, then submit a new import with a new key. HTTP 422 for missing headers is returned before the upload is reserved, so that `uploadId` can be sent again.

See [Operations](https://docs.eazecustoms.com/implementation/operations.md) for polling, and [File Uploads](https://docs.eazecustoms.com/implementation/file-uploads.md) for the upload reservation.

Next: [Shipments](https://docs.eazecustoms.com/implementation/shipments.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.