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

# Operations

> How to check an import after Eaze Customs accepts it.

## What you can do

After an import request is accepted, Eaze Customs processes the file in the background. Use the returned Operation ID to check the result.

There is no list of Operations. Keep the `operationId` from the HTTP 202 response.

A Shipment manifest whose configured headers do not match the selected template returns HTTP 422 from Import Manifest. That response has no `operationId`. The upload can be submitted again. See [Manifest Import](https://docs.eazecustoms.com/implementation/manifest-import.md).

## Before you start

Import Manifest and Import Departure Details return:

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

Call [Get Operation](https://docs.eazecustoms.com/api-reference/operations/get-operation.md) with that ID and `X-Eaze-Client-Ref`.

> [!NOTE]
>
> Get Operation currently requires the `ncts` module on the credential, including for a Shipment manifest import.

The two operation types are `shipment.details.import` and `ncts.details.import`.

## Steps

**1. Store the Operation ID**

Save `operationId` with the Shipment or Transit Declaration you imported.

**2. Poll with a delay**

Wait a few seconds between reads. A short import often finishes within seconds. A large file can take longer. Do not poll in a tight loop.

**3. Stop on a terminal status**

Stop when the status is `succeeded`, `partially_succeeded`, `failed`, `requires_review`, or `canceled`.

`queued` and `running` are still active. Progress can move from 0 to 100 while the status is `running`. Progress 100 with a non-success status means processing finished without success.

**4. Read the business records**

On success, read Declarations or house consignments. The Operation result is a summary. The business GET endpoints are the current record.

```mermaid theme={null}
flowchart LR
  accepted["HTTP 202 queued"] --> running["running"]
  running --> succeeded["succeeded"]
  running --> review["requires_review"]
  running --> failed["failed"]
```

## Working example

```javascript theme={null}
async function waitForOperation(operationId) {
  const terminal = new Set(['succeeded', 'partially_succeeded', 'failed', 'requires_review', 'canceled']);
  for (;;) {
    const operation = await api(`/public/v1/operations/${operationId}`);
    if (terminal.has(operation.status)) return operation;
    await new Promise((resolve) => setTimeout(resolve, 3000));
  }
}
```

```json theme={null}
{
  "id": "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb",
  "type": "shipment.details.import",
  "status": "requires_review",
  "progress": 100,
  "resource": { "type": "shipment", "id": "22222222-2222-4222-8222-222222222222" },
  "result": null,
  "error": {
    "code": "manifest_invalid",
    "detail": "Manifest contains invalid rows",
    "retryable": false
  },
  "attemptCount": 1
}
```

## Statuses and errors

| Status | What it means | What happens next |
| - | - | - |
| `queued` | Accepted and waiting to run. | Poll again. This blocks another import of the same kind. |
| `running` | The file is being processed. | Poll again. Progress shows how far the worker has gone. |
| `succeeded` | Processing finished successfully. | Read `result`, then read the business resources. |
| `partially_succeeded` | The contract allows a partial result. | Read `result` and `error` before you continue. Current manifest and NCTS imports do not use this status for a normal file. |
| `failed` | Processing failed. | Read `error.retryable`. A retryable failure can be tried again under the idempotency rules. A non-retryable failure needs a correction and a new request. |
| `requires_review` | The accepted file needs a correction. For a Shipment manifest this is row validation. When some rows are readable, `error.detail` is `Manifest contains invalid rows`. | Finished. `retryable` is false. Correct the file, create a new upload, and submit a new import. The accepted upload cannot be reused. |
| `canceled` | The operation was canceled. | Do not expect a business result. Current imports do not cancel themselves after acceptance. |

`error.detail` is a sentence. Header mismatches are not delivered here. They return HTTP 422 before the Operation is created, and that message can name one alternative Manifest Template. Nothing is switched automatically.

HTTP 404 means the Operation is not visible for this credential and client. HTTP 403 means the `ncts` module is missing.

Next: [Statuses](https://docs.eazecustoms.com/implementation/statuses.md). Idempotency for the original request is explained in [Idempotency](https://docs.eazecustoms.com/implementation/idempotency.md).


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