> ## 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.

# Manifest Import

> Upload a manifest, import it into a Shipment, and read the Declarations that were created.

## What you can do

Import a CSV or Excel manifest into a clearance Shipment. Eaze Customs checks the file headers immediately, then creates Declarations and goods items in the background.

Missing configured headers return HTTP 422. No Operation is created, and the upload stays available. Extra columns do not fail this check. HTTP 202 means the headers were accepted. It does not mean the rows imported successfully.

## Before you start

* Credential with the `import` or `export` module that matches the Shipment, and the `ncts` module. Upload and Operation routes currently require `ncts` even for a Shipment manifest.
* `clientRef` and the public Shipment ID.
* A Manifest Template ID. A Declaration Template ID only if you do not want the mapped defaults. See [Templates](https://docs.eazecustoms.com/implementation/templates.md).
* A file prepared as described in [File Uploads](https://docs.eazecustoms.com/implementation/file-uploads.md).

The Shipment must be in clearance status `created`, clearance must be enabled, and it must not already contain declarations. `mode` is always `INITIAL`. This request does not replace existing declarations.

## Steps

```mermaid theme={null}
flowchart TD
  auth["Authenticate and select the client"] --> shipment["Create or get the Shipment"]
  shipment --> template["Select the Manifest Template"]
  template --> upload["Upload and complete the file"]
  upload --> importReq["Import Manifest"]
  importReq --> gate{"Headers"}
  gate -->|HTTP 422 missing headers| reuse["Reuse the same upload with a corrected template or file"]
  gate -->|HTTP 202| operation["Poll the Operation"]
  operation --> result{"Final status"}
  result -->|succeeded| read["Read Declarations, goods items, and documents"]
  result -->|requires_review or failed| fix["Correct the rows and create a new upload"]
```

**1. Select the client and Shipment**

Use `X-Eaze-Client-Ref`. Create the Shipment or read an existing empty clearance Shipment.

**2. Select the Manifest Template**

List templates for the Shipment direction and copy `manifestTemplateId`. The file is checked against that template. Eaze Customs does not switch templates for you.

**3. Upload the file**

Create an upload with `purpose: shipment_manifest`, PUT the exact bytes, and complete the upload. Continue only when the status is `available`.

**4. Start the import**

Call [Import Manifest](https://docs.eazecustoms.com/api-reference/shipments/import-manifest.md) with a new `Idempotency-Key`.

```json theme={null}
{
  "uploadId": "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa",
  "manifestTemplateId": "77777777-7777-4777-8777-777777777777",
  "mode": "INITIAL"
}
```

Missing configured headers return HTTP 422 before an Operation exists. The upload is not reserved. Extra columns are allowed and the request continues.

A successful acceptance is HTTP 202:

```json theme={null}
{
  "operationId": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb",
  "status": "queued"
}
```

**5. Read the result**

Poll [Get Operation](https://docs.eazecustoms.com/api-reference/operations/get-operation.md). Progress `100` only means processing finished. Read `status`.

On `succeeded`, call [List Declarations](https://docs.eazecustoms.com/api-reference/declarations/list-declarations.md), [List Goods Items](https://docs.eazecustoms.com/api-reference/declarations/list-goods-items.md), and [List Shipment Documents](https://docs.eazecustoms.com/api-reference/documents/list-shipment-documents.md).

## Working example

A successful Operation:

```json theme={null}
{
  "id": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb",
  "type": "shipment.details.import",
  "status": "succeeded",
  "progress": 100,
  "resource": { "type": "shipment", "id": "22222222-2222-4222-8222-222222222222" },
  "result": { "mode": "initial", "declarationsCreated": 1, "goodsItemsCreated": 2 },
  "error": null,
  "attemptCount": 1
}
```

A header mismatch is returned immediately. The suggestion is inside `message` and `errors[].message`. There is no separate suggestion object, and there is no `operationId`.

```json theme={null}
{
  "errorCode": "E9999",
  "message": "Selected Manifest Template \"Amsterdam air manifest\" (77777777-7777-4777-8777-777777777777) does not match the uploaded file headers. The file exactly matches authorized Manifest Template \"Rotterdam sea manifest\" (12121212-1212-4212-8212-121212121299). Submit a new import with that template; the template was not switched automatically.",
  "errors": [
    {
      "code": "manifest_invalid",
      "message": "Selected Manifest Template \"Amsterdam air manifest\" (77777777-7777-4777-8777-777777777777) does not match the uploaded file headers. The file exactly matches authorized Manifest Template \"Rotterdam sea manifest\" (12121212-1212-4212-8212-121212121299). Submit a new import with that template; the template was not switched automatically."
    }
  ],
  "requestId": "550e8400-e29b-41d4-a716-446655440000"
}
```

An alternative template is named only when exactly one other authorized, eligible Manifest Template matches the headers. When several match, or none match, the message lists missing and unexpected headers and does not name a template to use. The text is limited to 500 characters.

After HTTP 202, row checks run in the background. When the file has readable rows and some of those rows are invalid, the Operation finishes like this. The upload is reserved.

```json theme={null}
{
  "status": "requires_review",
  "progress": 100,
  "error": {
    "code": "manifest_invalid",
    "detail": "Manifest contains invalid rows",
    "retryable": false
  }
}
```

## Statuses and errors

| Result | What it means | What to do |
| - | - | - |
| HTTP 422 `manifest_invalid` | Configured headers are missing for the selected Manifest Template. | No Operation was created. Read `errors[].message`. Submit the same `uploadId` again with the named template, or with a corrected file. Use a new `Idempotency-Key` when the body changes. |
| HTTP 202 and Operation `queued` or `running` | The headers were accepted and row validation is still running. | Keep polling. Do not start another import for this Shipment. |
| `succeeded` | Declarations were created. | Read Declarations and goods items. |
| `requires_review` with `manifest_invalid` | The accepted file failed row validation. When some rows are readable, `error.detail` is `Manifest contains invalid rows`. | This is finished and not retryable. The upload is reserved. Correct the file, create a new upload, and start a new import. |
| `failed` with `retryable: false` | Processing rejected the import after acceptance. | Read `error.detail`. Correct the source and start a new upload. |
| `failed` with `retryable: true` | A temporary processing failure after acceptance. | Follow the idempotency rules for that failure. Do not assume the same upload can be reused. |

How to retry after HTTP 422:

1. Read the message. When it names one other Manifest Template, use that ID. Eaze Customs does not switch the template for you.
2. Send the same `uploadId`. The failed header check does not reserve it.
3. Send a new `Idempotency-Key` when the template or any other field changes.
4. Create a new upload only when the file itself must change. The same bytes fail the same header check.

How to retry a failed or reviewed import after HTTP 202:

1. Correct the file.
2. Create and complete a fresh upload.
3. Use the new `uploadId`.
4. Send a new `Idempotency-Key`.

Sending the original key with the original body returns the original HTTP 202 response. That is a replay, not a new import. It does not apply to HTTP 422, because that response is not stored. Reusing an `uploadId` that was already accepted returns HTTP 409: "This upload has already been used for a Shipment manifest import. Create and complete a fresh upload before retrying." The upload stays reserved after `requires_review` and after failure.

Only `queued` and `running` block another import on the same Shipment. `requires_review` does not keep that lock. A completed initial import still requires an empty Shipment, so you cannot import a second file over declarations that already exist.

| HTTP error | Meaning |
| - | - |
| 409 upload already used | Create a new upload. |
| 409 import already active | Wait until the current Operation leaves `queued` and `running`. |
| 409 Shipment is not empty or not editable | Initial import cannot replace existing declarations. |
| 400 template selection | The Declaration Templates are not eligible for this client and Manifest Template. |

Next: [NCTS Overview](https://docs.eazecustoms.com/implementation/ncts-overview.md). The copyable end-to-end script is in [Examples](https://docs.eazecustoms.com/implementation/examples.md).


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