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

# Inventory and risk

> Inventory reads, forecast accuracy and checks, ESG footprint, disruptions, recalls, product compliance, alerts and connections.

Reads over your own data, and the risks that touch it. Unless a section says otherwise, a route takes an API key with the `read` scope, and lists page as described under [Conventions](/docs/conventions.md#lists-and-cursors).

## Inventory

Reads over your ingested data: your positions, demand history and active signals. All routes are `GET` under `/v1/inventory` and take an API key with the `read` scope.

| Path | What it returns |
| - | - |
| `/v1/inventory/forecasts` | Demand forecast per item and location, with calendar demand drivers |
| `/v1/inventory/new_product_forecasts` | Demand estimates for new products |
| `/v1/inventory/forecast_accuracy` | Forecast accuracy against naive and seasonal naive forecasts |
| `/v1/inventory/demand_stats` | Demand classification and statistics per item and location |
| `/v1/inventory/replenishment_params` | Safety stock, reorder point and on-hand per item and location |
| `/v1/inventory/stockout_projections` | Days to stockout per item and location, with inbound |
| `/v1/inventory/purchase_proposals` | Network-level purchase proposals with a suggested supplier |
| `/v1/inventory/purchase_order_risks` | Risk score and action per open purchase order |
| `/v1/inventory/rebalance_recommendations` | Ranked transfer proposals |
| `/v1/inventory/expiry_risks` | Lots projected to expire unsold |
| `/v1/inventory/expiry_actions` | Transfers and markdowns for stock about to expire |
| `/v1/inventory/markdown_candidates` | Markdown suggestions for overhanging stock |
| `/v1/inventory/size_allocations` | Size-run split per store |
| `/v1/inventory/merchandise_plan` | Category sales, margin, GMROI, weeks of supply and open-to-buy |
| `/v1/inventory/esg_footprint` | Emissions footprint (see below) |

```bash theme={null}
curl "https://api.insightchain.ai/v1/inventory/purchase_proposals?limit=20" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Forecast accuracy

`GET /v1/inventory/forecast_accuracy` returns a weekly backtest on your own sales history: at each of the last 26 weeks our forecast, a naive forecast (last week) and a seasonal naive forecast (the same week a year earlier) are made from the history before that week and compared with what sold over the next 4 weeks.

Each row carries error (`mae`, `wape_pct`), bias (`bias_pct`, above 0 is over-forecast), scaled error (`rmsse`, `mase`), the value added over naive, and its sample size. A series with too little history has `status: insufficient_history` and no number. `run` says when the backtest ran and how much history it rests on.

Parameters: `level` (`item_location`, `item`, `category`, `location`, `location_type`, `org`), `period` (`summary`, or `weekly` for `category`, `location_type` and `org`), `from` and `to` (weekly), `item`, `location`, `status` (`ok`, `insufficient_history`, `no_actuals`), `sort` (`worst`, `value_add`, `bias`, `volume`, `name`, `period`), `evaluation_id`, `limit` (max 200) and `cursor`.

Request: worst items first.

```bash theme={null}
curl "https://api.insightchain.ai/v1/inventory/forecast_accuracy?level=item&sort=worst&limit=20" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

Response: `200 OK` (abridged).

```json theme={null}
{
  "object": "list",
  "status": "ok",
  "evaluation": { "computed_at": "…", "age_hours": 7.3, "stale": false,
           "history": { "from": "2025-06-02", "to": "2026-11-15", "weeks": 76 },
           "origins": { "count": 26 }, "horizon_weeks": 4,
           "pairs": { "total": 1840, "scored": 1512, "insufficient_history": 328 } },
  "overall": { "level": "org", "ours": { "wape_pct": …, "bias_pct": …, "rmsse": … },
               "naive": { … }, "seasonal_naive": { … },
               "value_add": { "rmsse_ratio": …, "wape_points": …, "beats_naive": … },
               "sample": { "origins": 26, "points": 104, "actual_total": … } },
  "data": [ { "level": "item", "label": "SKU-100", "status": "ok", … } ],
  "has_more": true,
  "next_cursor": "…"
}
```

## Forecast check

`POST /v1/forecast_checks` takes your own forecast rows mid-process (a replenishment run, a demand review) and returns, per row, our baseline for exactly that period, whether your number agrees with it, and the signals we hold for that item, location and window: rising or fading trends, calendar events, demand-driver events and supply exposure.

Up to 500 rows per call. A row whose item or location is not yours, or whose period is in the past or more than 90 days out, comes back with `status: "error"` and a code while the other rows are answered.

```bash theme={null}
curl -X POST "https://api.insightchain.ai/v1/forecast_checks" \
  -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" \
  -d '{ "rows": [ { "item": "SKU-100", "location": "STORE-12", "period_start": "2026-11-23",
                    "period_days": 7, "quantity": 140, "ref": "row-1" } ],
        "options": { "window_days": 90, "tolerance_pct": 15 } }'

# rows[]: status, baseline { quantity, method, … }, difference { percent, band, verdict: agree | above | below },
#         signals { trend, demand_drivers, calendar, supply }, flags
```

## ESG footprint

`GET /v1/inventory/esg_footprint` returns an estimated emissions footprint of your purchases and transport, by lane, supplier, item and category, with the factors used and what the estimate does not cover (`coverage`). The same data powers the Sustainability dashboard of the app.

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

## Disruptions

Disruption events matched to your network: your suppliers, open purchase orders and inventory. These are the figures the Disruptions page of the app shows. All routes are `GET` under `/v1/disruptions`.

| Path | What it returns |
| - | - |
| `/v1/disruptions` | Active disruption events crossed with your suppliers, open POs and inventory, each with a 0 to 100 exposure score |
| `/v1/disruptions/event_exposure` | Exposed events, ranked |
| `/v1/disruptions/exposure_by_product` | Exposure per item |
| `/v1/disruptions/exposure_totals` | Events affecting you, suppliers, countries, open POs and value at risk |

`/v1/disruptions/exposure_totals` defaults to the headline figure of the app's home page (supply risk only, severity 3 or more, starting within 14 days); pass `supply_risk_only=false&min_severity=1&horizon_days=any` for the totals of the Disruptions page.

```bash theme={null}
curl "https://api.insightchain.ai/v1/disruptions/exposure_totals?supply_risk_only=false&min_severity=1&horizon_days=any" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Product recalls

Official product recall notices matched to your items, and where a recalled item is. Each match names the notice's issuing authority and links the official notice; a person confirms or dismisses it in the app, and a confirmed match raises a `recall` alert (webhook event `insightchain.recall`). The Product Compliance module is enabled per organization; without it every route answers `403`. Notice text is quoted as the publisher wrote it.

| Path | What it returns |
| - | - |
| `GET /v1/recalls/matches` | Recall notices matched to your items, newest first, each with the basis of the match, a score, and whether a person confirmed or dismissed it |
| `GET /v1/recalls/matches/:id` | One match with its notice, why it matched, and where the item is: stock on hand and in transit by location and lot, open purchase orders and inbound shipments |
| `GET /v1/recalls/notices` | Recent official recall notices, newest first, with the issuing authority and a link to each notice |

Lists take `limit` (1 to 100, default 25) and return the list object: pass `next_cursor` back as `cursor` until `has_more` is false. The older `matches` and `notices` fields and the `offset` parameter still work and are deprecated.

```bash theme={null}
curl "https://api.insightchain.ai/v1/recalls/matches?status=candidate&limit=20" \
  -H "Authorization: Bearer YOUR_API_KEY"
# → { "object": "list",
#     "data": [ { "id": "…", "basis": "gtin", "score": 1, "confirm_ready": true, "status": "candidate",
#       "item": { "external_id": "SKU-1", … }, "notice": { "authority": "…", "url": "https://…", … } } ],
#     "has_more": false, "next_cursor": null }
```

## Product compliance

Whether a product may enter a country: `blocked`, `conditional` (allowed with a named document or approval), `clear` or `unknown`, with the rules and official measures behind it and their source URLs. Reads and checks take an API key with the `read` scope, and the Product Compliance module.

| Path | What it returns |
| - | - |
| `GET /v1/compliance/verdicts` | Your stored verdicts, by country then item, with scope and reasons |
| `GET /v1/compliance/check` | The stored verdict for one of your items in a country, or a not-computed state saying why there is none |
| `POST /v1/compliance/check` | A verdict for a commodity code from up to 5 origin countries into a destination, with no item on file. Stores nothing |

How to read a verdict:

* Every verdict carries `scope`, what it is complete for (`import_measures`, `conformity`, `technical_fit`). A `clear` is only as wide as its scope, so a `clear` with `["import_measures"]` says nothing about product safety or conformity.
* An `unknown` lists its `unknown_codes`, each with the fix in `reasons`.
* Every response carries a `disclaimer`: this is not legal advice.
* Verdicts are stored for your items and the countries of your locations and customers. A verdict computed more than 48 hours ago, or for a commodity code the item no longer has, comes with `stale: true`.
* An unknown item is a `404` with `code: "item_not_found"`. An item with no stored verdict for the country answers `computed: false`, `verdict: null` and `not_computed` (`not_a_destination`, `destination_capped` or `not_yet_computed`) with the fix; it is never `clear`.
* `POST /v1/compliance/check` has a per-address limit of 30 a minute before authentication and 30 a minute per key. A lookup that cannot be completed answers `unknown` with `lookup_failed`.

### Attributes and certificates

An item's product attributes and certificates are kept in the app, and an attribute counts for verdicts only once a person has confirmed it. A rule that depends on an attribute the item does not have confirmed answers `unknown` with `rule_needs_attributes` and the attribute named.

Technical fit compares plug type, rated voltage and frequency with the destination: a mismatch is `conditional`; when it cannot be compared, `technical_fit` stays out of `scope` and a `not_checked` reason says why.

A conformity or licence reason carries `certificate.status`: `satisfied`, `not_satisfied`, `expired` or `not_specified`; the verdict stays `conditional`.

```bash theme={null}
curl -X POST "https://api.insightchain.ai/v1/compliance/check" \
  -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" \
  -d '{ "commodity_code": "6109.10.00.10", "origin_countries": ["CN"], "destination": "GB" }'
```

```json theme={null}
{ "request_id": "…", "check": { "commodity_code": "6109100010", "origins": ["CN"], "destination": "GB", "as_of": "2026-11-18", "attributes": {} },
  "verdict": "clear", "scope": ["import_measures"], "unknown_codes": [],
  "reasons": [ { "kind": "checked", "authority": "…", "origin": "CN", "resolved_code": "…", "source_url": "https://…", "as_of": "2026-11-18" } ],
  "rule_ids": [], "rule_set_version": "…", "computed_at": "…", "disclaimer": "Not legal advice. …" }
```

## Alerts

The alerts the Alerts page of the app shows: disruptions, connector failures, recommendations, tariff briefs, write-back differences, breaking changes in a connected system and the other agents' alerts. Reading takes the `read` scope; acknowledging or resolving one takes `execute`. The Alerts module is enabled per organization. To receive alerts as they are raised, register a [webhook](/docs/webhooks.md).

| Path | What it does |
| - | - |
| `GET /v1/alerts` | Alerts, newest first. Filters: `status`, `kind`, `severity` |
| `GET /v1/alerts/:id` | One alert |
| `POST /v1/alerts/:id/acknowledge` | Acknowledge an open alert. Takes no body |
| `POST /v1/alerts/:id/resolve` | Resolve an open or acknowledged alert. Takes no body |

```bash theme={null}
curl "https://api.insightchain.ai/v1/alerts?status=open&severity=high&limit=20" \
  -H "Authorization: Bearer YOUR_API_KEY"
# → { "object": "list",
#     "data": [ { "id": "…", "kind": "disruption", "severity": "high", "status": "open", "title": "…", … } ],
#     "has_more": false, "next_cursor": null }

curl -X POST "https://api.insightchain.ai/v1/alerts/ALERT_ID/acknowledge" \
  -H "Authorization: Bearer YOUR_API_KEY"
# no body. /resolve works the same way; POST /v1/alerts/ALERT_ID/status with { "status": "acknowledged" } still works.
```

## Connections and sync

The state of your data connections and their sync runs, and starting a sync. Reads take the `read` scope. Starting a sync takes `execute` and a key whose creator is an organization admin; at most 4 per connection per hour, and a sync already running answers `409`. Responses never carry connection settings, credentials or base URLs, and error text has secrets redacted. Configuring a connection stays in the app.

| Path | What it does |
| - | - |
| `GET /v1/connections` | Connections with last sync, entity state and any running sync |
| `GET /v1/connections/:id` | One connection |
| `POST /v1/connections/:id/sync` | Start a sync now |
| `GET /v1/sync_runs` | Sync runs with counts and errors |

```bash theme={null}
curl -X POST "https://api.insightchain.ai/v1/connections/CONNECTION_ID/sync" \
  -H "Authorization: Bearer YOUR_EXECUTE_KEY"
# → { "connection_id": "…", "sync": { "status": "success", "run_id": "…", "fetched": 1200, "upserted": 1187 } }
#   202 when it is still running after 60 seconds; then:
curl "https://api.insightchain.ai/v1/sync_runs?connection_id=CONNECTION_ID" -H "Authorization: Bearer YOUR_API_KEY"
```


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