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

# Documents

> Find documents you are allowed to download and open the temporary link.

## What you can do

List documents linked to a Shipment, a Declaration, or an NCTS Transit Declaration, then download one document.

A download response is JSON with a short-lived URL. It is not a file stream and it is not an HTTP redirect.

## Before you start

You need the public ID of the Shipment, Declaration, or Transit Declaration, plus `X-Eaze-Client-Ref`. The credential needs the module that owns the resource: `import` or `export`, or `ncts`.

| List | Identifier |
| - | - |
| [List Shipment Documents](https://docs.eazecustoms.com/api-reference/documents/list-shipment-documents.md) | Shipment ID |
| [List Declaration Documents](https://docs.eazecustoms.com/api-reference/documents/list-declaration-documents.md) | Declaration ID |
| [List Transit Documents](https://docs.eazecustoms.com/api-reference/documents/list-transit-documents.md) | Transit Declaration ID |

Not every portal file is available here.

| What you can receive | What you do not receive |
| - | - |
| Newly generated private waybill and UTB PDFs for Import and Export, when they have been finalized | Invoices, packing lists, older historical files, and files that were only requested |
| The verified source file promoted from an NCTS upload | Customs XML and email messages |
| A generated Departure transit accompanying document PDF, once it is ready | Internal Customs message files |

`source` is `generated` for a file Eaze Customs produced, or `verified_upload` for a promoted NCTS source file. Shipment manifest source files are not listed as downloadable declaration documents.

## Steps

**1. List documents**

Call the list that matches the resource. An empty page means nothing is available yet. Poll again later. Customs release does not mean a final PDF exists.

**2. Download one document**

Call [Download Document](https://docs.eazecustoms.com/api-reference/documents/download-document.md) with the document `id`.

```json theme={null}
{
  "url": "https://example-download.invalid/documents/cccccccc-cccc-4ccc-8ccc-cccccccccccc",
  "expiresAt": "2026-11-17T10:31:00.000Z"
}
```

Send an HTTP GET to `url` before `expiresAt`. The default lifetime is 60 seconds. Download the bytes as a file. Do not send the Eaze Customs credential to that URL, and do not parse the file response as JSON.

If the private file is not confirmed in storage, the download returns HTTP 503. Retry later with the same document ID. Create a new download URL after the previous one expires. Do not cache the URL.

## Working example

```bash theme={null}
curl 'https://staging.api.eazecustoms.com/public/v1/declarations/33333333-3333-4333-8333-333333333333/documents' \
  --header 'Authorization: Bearer EZ_11111111-1111-4111-8111-111111111111_exampleSecretValueNotReal' \
  --header 'X-Eaze-Client-Ref: ACME-AMS'
```

```json theme={null}
{
  "data": [
    {
      "id": "cccccccc-cccc-4ccc-8ccc-cccccccccccc",
      "filename": "waybill.pdf",
      "contentType": "application/pdf",
      "documentType": "WAYBILL",
      "source": "generated",
      "createdAt": "2026-11-17T12:00:00.000Z"
    }
  ],
  "pagination": { "limit": 20, "hasMore": false, "nextCursor": null }
}
```

```javascript theme={null}
const listed = await api(`/public/v1/declarations/${declarationId}/documents`);
const document = listed.data[0];
if (!document) return;
const download = await api(`/public/v1/documents/${document.id}/download`);
const file = await fetch(download.url);
if (!file.ok) throw new Error(`Download failed: ${file.status}`);
await writeFile(document.filename, Buffer.from(await file.arrayBuffer()));
```

## Statuses and errors

| Situation | What to do |
| - | - |
| Empty list | The document is not generated or not authorized yet. Read the business status, then list again. |
| HTTP 404 | The document or parent resource is not visible for this client. |
| HTTP 403 | The credential is missing the module for this resource. |
| HTTP 503 | Storage is not ready. Retry the download request later. |
| URL expired | Call Download Document again. |

Next: [Operations](https://docs.eazecustoms.com/implementation/operations.md).


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