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

# Product passports

> Create, fill and publish Digital Product Passports, and resolve them from a GS1 Digital Link.

A passport is created for an item you already ingested, filled with materials, substances, events and documents, published as an immutable version, and then, as a separate decision, opened to the public at its Digital Link.

## Authentication

The authenticated routes live under `/v1/passports` and take the same API key as every other API, sent as a bearer token. The key's organization is the only source of tenancy: there is no organization parameter, and another organization's data cannot be addressed. Generate keys on the [API Keys](https://insightchain.ai/dashboard/api-keys) page.

```bash theme={null}
curl https://api.insightchain.ai/v1/passports \
  -H "Authorization: Bearer YOUR_API_KEY"
```

### Scopes map to roles

| Scope | Role | What it allows |
| - | - | - |
| `read` | viewer | Every `GET` route except the admin-only ones (access grants and supplier links). |
| `ingest` | editor | Create and update passports; replace materials, substances, plots and custody; add events and documents; read a document's origin evidence. |
| `execute` | decisions | Publish a version, confirm or reject origin evidence, and (together with `ingest`) change `public_enabled`. Made for the key's creator, who must still be a member. |

A read needs `read` (or `execute`, which includes it), a content write needs `ingest`, and a decision needs `execute`: a key that edits and publishes holds both. A route outside the key's scope returns 403 with code `scope_missing`.

### API keys never reach admin

Archiving a passport, minting, listing and revoking access grants, inviting and revoking suppliers, registry registration (currently a simulation; the EU registry is not accepting submissions) and loading sample data all need a Product Passport admin working in the app. No API key can call them, so a leaked key cannot create a credential or take a passport down.

## Passports

A passport is bound to one product (a model), one lot (a batch) or one tracked unit (an item). It references the item master you already ingested rather than duplicating it, so the item must exist first.

Every `:id` below takes the passport's id or `ext:<external_id>`, your own id for it, URL-encoded: `GET /v1/passports/ext:NW-OXF-000123`. An id we do not know is a 404.

| Method | Path | Scope | What it does |
| - | - | - | - |
| `GET` | `/v1/passports` | `read` | Passports, newest first |
| `POST` | `/v1/passports` | `ingest` | Create a passport for an item you ingested |
| `GET` | `/v1/passports/gaps` | `read` | The completeness gaps across all passports |
| `GET` | `/v1/passports/:id` | `read` | One passport with its internal view, completeness and Digital Link |
| `PATCH` | `/v1/passports/:id` | `ingest` | Update a passport's fields. Changing `public_enabled` also needs `execute` |
| `GET` | `/v1/passports/:id/completeness` | `read` | A passport's completeness |

### Create a passport

| Field | Type | Required | Description |
| - | - | - | - |
| `external_id` | string | yes | Your identifier for the passport. Unique per organization. |
| `granularity` | string | yes | `model`, `batch` or `item`. |
| `item_external_id` | string | yes | The product you already ingested. A passport references your item master rather than copying it. |
| `lot_external_id` | string | conditional | Required for `batch`. The product lot you already ingested. |
| `epc` | string | conditional | Required for `item`. The EPC of a registered tracked unit. |
| `variant_external_id` | string | no | An item variant (size, colour) you already ingested. |
| `title` | string or object | no | A string (read as English) or a language map such as `{ "en": "...", "de": "..." }`. |
| `brand` | string | no | Up to 200 characters. |
| `category` | string | no | Defaults to the item's category. |
| `gtin` | string | no | The check digit is validated; an unscannable GTIN is rejected with a 400 rather than stored. |
| `batch_lot` | string | no | GS1 batch/lot (AI 10): at most 20 characters from the GS1 set. |
| `serial` | string | no | GS1 serial (AI 21): at most 20 characters from the GS1 set. |

```bash cURL theme={null}
curl -X POST https://api.insightchain.ai/v1/passports \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "external_id": "NW-OXF-000123",
    "granularity": "batch",
    "item_external_id": "SKU-000123",
    "lot_external_id": "LOT-2026-0001",
    "gtin": "00000000000123",
    "batch_lot": "LOT-2026-0001",
    "title": { "en": "Oxford Shirt" },
    "brand": "Northwind"
  }'
```

```javascript JavaScript theme={null}
const response = await fetch("https://api.insightchain.ai/v1/passports", {
  method: "POST",
  headers: {
    "Authorization": "Bearer " + process.env.API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    external_id: "NW-OXF-000123",
    granularity: "batch",
    item_external_id: "SKU-000123",
    lot_external_id: "LOT-2026-0001",
    gtin: "00000000000123",
    batch_lot: "LOT-2026-0001",
    title: { en: "Oxford Shirt" },
    brand: "Northwind",
  }),
});
const { passport } = await response.json();
```

```python Python theme={null}
import os, requests

response = requests.post(
    "https://api.insightchain.ai/v1/passports",
    headers={"Authorization": f"Bearer {os.environ['API_KEY']}"},
    json={
        "external_id": "NW-OXF-000123",
        "granularity": "batch",
        "item_external_id": "SKU-000123",
        "lot_external_id": "LOT-2026-0001",
        "gtin": "00000000000123",
        "batch_lot": "LOT-2026-0001",
        "title": {"en": "Oxford Shirt"},
        "brand": "Northwind",
    },
)
passport = response.json()["passport"]
```

Returns 201 with `{ passport }`. A batch passport needs a lot and an item passport needs a tracked unit; an item, lot, variant or EPC that does not exist returns 404, and a duplicate `external_id` returns 409.

### List passports

| Parameter | Type | Required | Description |
| - | - | - | - |
| `status` | string | no | Filter by lifecycle status. |
| `granularity` | string | no | `model`, `batch` or `item`. |
| `compliance_state` | string | no | Filter by derived compliance state. |
| `q` | string | no | Substring match on `external_id`, brand or GTIN (100 characters at most). |
| `limit` | number | no | Page size. Default 50, maximum 200. |
| `cursor` | string | no | The `next_cursor` of the previous page. |

Returns the list object described under [Conventions](/docs/conventions.md#lists-and-cursors), most recently updated first: pass `next_cursor` back as `cursor` until `has_more` is false. The older `passports`, `total`, `limit` and `offset` fields and the `offset` parameter still work and are deprecated.

### Get and update

`GET /v1/passports/:id` returns `passport`, `view` (the internal projection, including the work queue of gaps), `completeness` and `digital_link`. `PATCH` accepts `title`, `brand`, `category`, `gtin`, `batch_lot`, `serial`, `public_enabled` and `draft_data` (merged into the existing draft), and returns the passport with its new completeness. An archived passport cannot be edited (409).

## Materials and events

The bill of materials and substance declarations are replaced as whole sets. Lifecycle events are added one at a time. Every write rescores the passport, and the response carries the new completeness.

| Method | Path | Scope | What it does |
| - | - | - | - |
| `GET` | `/v1/passports/:id/materials` | `read` | A passport's materials |
| `PUT` | `/v1/passports/:id/materials` | `ingest` | Replace the bill of materials |
| `GET` | `/v1/passports/:id/substances` | `read` | A passport's substances |
| `PUT` | `/v1/passports/:id/substances` | `ingest` | Replace substance declarations |
| `GET` | `/v1/passports/:id/events` | `read` | A passport's events |
| `POST` | `/v1/passports/:id/events` | `ingest` | Add a lifecycle event |
| `GET` | `/v1/passports/:id/custody` | `read` | A passport's chain of custody |
| `PUT` | `/v1/passports/:id/custody` | `ingest` | Replace chain-of-custody transfers |
| `GET` | `/v1/passports/:id/eudr_plots` | `read` | A passport's EUDR plots |
| `PUT` | `/v1/passports/:id/eudr_plots` | `ingest` | Replace EUDR plots |
| `GET` | `/v1/passports/:id/documents` | `read` | A passport's documents |
| `POST` | `/v1/passports/:id/documents` | `ingest` | Register a document and get a signed upload URL |
| `GET` | `/v1/passports/:id/origin_evidence` | `read` | A passport's origin evidence |
| `POST` | `/v1/passports/:id/origin_evidence` | `ingest` | Read a document's origin evidence (25 per passport) |
| `POST` | `/v1/passports/:id/origin_evidence/:evidence_id/review` | `execute` | Confirm or reject origin evidence |
| `GET` | `/v1/passports/:id/uflpa` | `read` | A passport's UFLPA status |
| `POST` | `/v1/passports/:id/uflpa/package` | `ingest` | Assemble a UFLPA evidence package |
| `GET` | `/v1/passports/:id/impact_estimate` | `read` | A passport's impact estimate |

### Replace the bill of materials

Send the whole tree in `{ "materials": [...] }` (up to 500 rows). Rows are replaced, not merged. Rows that suppliers submitted through their own links are kept and are not part of your set.

| Field | Type | Required | Description |
| - | - | - | - |
| `external_id` | string | yes | Unique within the request. Ids starting with `SUP:` are reserved for supplier submissions and are ignored. |
| `material_name` | string | yes | Up to 200 characters. |
| `parent_external_id` | string | no | Nests this row under another row in the same request. Unknown parents and cycles are rejected. |
| `component_name` | string | no | The component the material belongs to. |
| `material_class` | string | no | For example `natural_fibre` or `synthetic_fibre`. |
| `mass_share_pct` | number | no | 0 to 100. Top-level shares must total 100% (±0.5 points) before the passport can be published. |
| `mass_g` | number | no | Mass in grams. |
| `recycled_content_pct` | number | no | 0 to 100. |
| `renewable_content_pct` | number | no | 0 to 100. |
| `hazardous` | boolean | no | Defaults to false. |
| `origin_country` | string | no | ISO 3166-1 alpha-2. |
| `processing_stage` | string | no | For example `fibre`, `spinning` or `dyeing_finishing`. |
| `supplier_external_id` | string | no | A supplier you already ingested. |
| `certificate_document_external_id` | string | no | A document already attached to this passport. Provenance is derived from it on the server; a provenance field you send is dropped. |

```bash theme={null}
curl -X PUT https://api.insightchain.ai/v1/passports/ext:NW-OXF-000123/materials \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "materials": [
      { "external_id": "MAT-SHELL", "material_name": "Cotton",
        "material_class": "natural_fibre", "mass_share_pct": 97,
        "recycled_content_pct": 0, "origin_country": "IN" },
      { "external_id": "MAT-THREAD", "material_name": "Polyester",
        "material_class": "synthetic_fibre", "mass_share_pct": 3,
        "recycled_content_pct": 60, "origin_country": "VN" }
    ]
  }'
```

### Replace substance declarations

Send `{ "substances": [...] }` (up to 1000 rows): REACH SVHC, REACH Annex XVII, POP and CLP declarations.

| Field | Type | Required | Description |
| - | - | - | - |
| `external_id` | string | yes | Your identifier for the declaration. |
| `substance_name` | string | yes | Up to 300 characters. |
| `regulation` | string | no | `REACH_SVHC` (default), `REACH_ANNEX_XVII`, `POP` or `CLP`. |
| `material_external_id` | string | no | The material the substance is in. |
| `cas_number`, `ec_number` | string | no | Chemical identifiers. |
| `concentration_ppm` | number | no | Parts per million. |
| `above_threshold` | boolean | no | Defaults to false. |
| `scip_ref` | string | no | SCIP database reference. |
| `safe_use_instructions` | string | no | Up to 2000 characters. |

### Add a lifecycle event

| Field | Type | Required | Description |
| - | - | - | - |
| `external_id` | string | yes | Your identifier for the event. Sending it again updates that event instead of adding a duplicate. |
| `event_type` | string | yes | `manufactured`, `quality_checked`, `shipped`, `received`, `sold`, `repaired`, `refurbished`, `resold`, `returned`, `recycled`, `disposed`, `recalled` or `inspected`. |
| `occurred_at` | string | yes | ISO 8601 timestamp. |
| `min_audience` | string | no | Who sees the event: `consumer` (default), `recycler`, `authority` or `internal`. |
| `actor_kind`, `actor_name` | string | no | Who did it, for example `repairer` and the shop's name. |
| `country_code` | string | no | ISO 3166-1 alpha-2. |
| `location_external_id` | string | no | A location you already ingested. |
| `document_external_id` | string | no | A document attached to this passport. |
| `details` | object | no | Free-form JSON object. |

```bash theme={null}
curl -X POST https://api.insightchain.ai/v1/passports/ext:NW-OXF-000123/events \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "external_id": "EVT-REPAIR-8841",
    "event_type": "repaired",
    "occurred_at": "2026-06-14T10:00:00Z",
    "actor_kind": "repairer",
    "actor_name": "Repair counter - Milan",
    "country_code": "IT",
    "min_audience": "consumer"
  }'
```

Returns 201 with `{ event, completeness }`. Events are idempotent on `external_id`, so a retry is safe. To correct an event, send it again with the same id.

## Publishing

Publishing freezes an immutable version of the passport with a SHA-256 checksum. It is hard-gated: a passport with an unmet blocking requirement cannot be published.

| Method | Path | Scope | What it does |
| - | - | - | - |
| `POST` | `/v1/passports/:id/publish` | `execute` | Publish a version (422 while blocking gaps remain) |
| `GET` | `/v1/passports/:id/versions` | `read` | A passport's versions |

The body is optional; `change_note` (500 characters at most) is stored with the version.

Response: `200 OK`.

```json theme={null}
{
  "passport": { "id": "...", "status": "published", "public_enabled": false },
  "version": {
    "id": "...",
    "version": 3,
    "checksum": "9f2c...",
    "published_at": "2026-08-04T09:15:22.418Z"
  },
  "completeness": { "score": 100, "gaps": [] },
  "request_id": "..."
}
```

Response: `422 Unprocessable`.

```json theme={null}
{
  "error": {
    "type": "invalid_request_error",
    "code": "unprocessable",
    "message": "Cannot publish while blocking requirements are unmet",
    "param": null,
    "doc_url": "https://insightchain.ai/docs/errors#unprocessable"
  },
  "blocking_gaps": [ { "severity": "blocking", "...": "..." } ],
  "request_id": "..."
}
```

> [!NOTE]
>
> Publishing does **not** make the passport publicly resolvable. That is a separate `public_enabled` decision (set it with `PATCH`), so a version of record can exist before you expose it to consumers.

Archiving a passport (admin only) switches public access off again, and an archived passport cannot be published (409).

## Public resolution

A published passport can be read with no credential in two forms: a web page for people and JSON for systems. Both show the consumer view, and both resolve only a published passport with `public_enabled` set.

### The web page: `digital_link`

`GET /v1/passports/:id` returns the passport's `digital_link`: its GS1 Digital Link, built from the GTIN and, when the passport has them, the lot and the serial. A passport without a valid GTIN has no link, and `digital_link` is `null`.

```text theme={null}
https://id.example.com/p/01/00000000000123/10/LOT-2026-0001/21/NW-26-0000001
```

This is the address to print as a QR code: a person who scans it gets the passport as a page. The page says which level it shows ("batch-level information shown"), so it never implies the data is unit-specific.

### The JSON: passport views

The same passport as JSON, for a system that reads it: a retailer's product page, a repair or resale service, a customs or recycling workflow.

| Method | Path | Credential | View |
| - | - | - | - |
| `GET` | `/v1/passport_views/01/:gtin[/10/:lot][/21/:serial]` | none | Consumer |
| `GET` | `/v1/passport_views/grants/:token` | the grant token in the path | Recycler or authority |

```bash theme={null}
curl "https://api.insightchain.ai/v1/passport_views/01/00000000000123/10/LOT-2026-0001/21/NW-26-0000001?lang=de"
```

The path takes the GS1 identifiers in the order of the Digital Link: `01` and the GTIN (8, 12, 13 or 14 digits with a valid check digit), then optionally `10` and the lot, then optionally `21` and the serial. A lot or a serial is 1 to 20 characters, URL-encoded.

Response: `200 OK`, with `request_id`, `duration_ms` and the `passport` in the consumer view.

* **Most specific match.** A serial that has its own passport answers with it; otherwise the lot's passport answers, and otherwise the model's. `passport.resolvedGranularity` says which one answered (`item`, `batch` or `model`), and `passport.broadened` is `true` when the answer is less specific than the address asked for. Use the two to say "batch-level information shown" and never imply the data is unit-specific.
* **Language.** `?lang=de` returns the texts in that language where the passport has them, and in English where it does not. The default is `en`.
* **Caching.** The answer carries `Cache-Control: public, max-age=300`: it can be cached for five minutes.
* **Limit.** 120 requests a minute for each calling address. Past it the answer is a 429 with `Retry-After`, `X-RateLimit-Limit` and `X-RateLimit-Remaining`.
* **A miss is a 404.** An identifier that is not valid, a GTIN with no passport, a passport that is not published or has public access switched off: each answers the same 404, so the address cannot be used to find out what exists. The body of this 404 and of the 429 is `error` as a plain string with `request_id`, not the error object of the keyed routes.
* **`GET` only.** Any other method answers 405 with `Allow`.

The audience is set by the address and by the grant, never by the request: a `view` parameter added to the address changes nothing.

### Recycler and authority views

A Product Passport admin issues a grant link for the `recycler` or `authority` audience in the app, with an optional expiry. The link is shown once. It ends in the grant token (48 hexadecimal characters), and the same token reads the view as JSON:

```bash theme={null}
curl "https://api.insightchain.ai/v1/passport_views/grants/GRANT_TOKEN"
```

The audience comes from the grant. The passport must be published; `public_enabled` is not needed, because the token is the permission. A token that was revoked or has expired answers the same 404 as any miss. The answer carries `Cache-Control: private, no-store` and must not be cached by a shared cache. Links to documents in it expire after 15 minutes: read the view again for fresh ones. `?lang=` and the limit work as on the consumer view.

> [!WARNING]
>
> Never print a grant token or a grant link on packaging. A printed token cannot be recalled. Share it with the named recipient and revoke it when the need ends.

## Errors and limits

Errors are JSON with an `error` object (type, code, message, param) and a `request_id`. The same id is in the `X-Request-ID` header. Quote it when reporting a problem. The shape is described under [Conventions](/docs/conventions.md#errors), and every code is in the [error reference](/docs/errors.md).

| Status | Meaning | Notes |
| - | - | - |
| 400 | Validation failed | The `details` array names each offending field. |
| 401 | Unauthorized | Missing or invalid credential. |
| 403 | Forbidden | Authenticated, but the key's scope or the role is insufficient. Admin-only routes are never open to API keys. |
| 404 | Not found | Not found in your organization, or a referenced item, lot or document does not exist. |
| 409 | Conflict | A duplicate `external_id`, or an edit to an archived passport. |
| 413 | Too large | A document exceeds the 10 MB upload limit. |
| 422 | Publish blocked | `blocking_gaps` lists the unmet requirements. |
| 429 | Rate limited | Honour the `Retry-After` header. |

### Limits and retries

* **API keys:** 120 requests per minute per key, then the key's daily limit; every answer carries the RateLimit headers.
* **Retries:** events and documents upsert on their external id, and materials and substances replace whole sets, so a retried request cannot double-write.


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