# India Export Data by HS Code and Country: Monthly TradeStat — API reference

The detail an integrator needs and a buyer does not: linked from the README's Integrations section. `/actor-deploy
--assets` hosts this file next to the images (any other repo file 404s on the Store).

## Tested combinations

Every row is an input the test suite and the review runs start — the combinations that are supported. An input
outside this table is accepted by the schema but not tested; keep the table in sync with `storage-example/` and
`tests/` (gate `check_tested_combinations`, 2026-10-23 company-contact-finder-ai V-27).

| Call | What runs | Input |
|---|---|---|
| Daily test / first agent call | the free demo on the 20 sample records, nothing charged | `{}` |
| Demo, as the form opens | the same free demo | `storage-example/INPUT.json` |
| Live read, capped | TradeStat's form read by the Actor itself, AI off, 5 rows | `storage-example/INPUT.live.json` |
| AI on | the same records with the AI verdict | `storage-example/INPUT.ai.json` |
| AI with your own key | the AI through your provider key | `{"enableAi": true, "llmProvider": "byok", "llmModel": "google:gemini-3.5-flash-lite", "llmApiKey": "…"}` + your records |
| Product words | TradeStat's own HS lookup finds the code, then the live read; the status names the code | `{"sourceMode": "live", "hsCodes": ["basmati rice"], "countries": ["SA", "AE"]}` |
| Your own list | your rows, no source run | `{"sourceMode": "list", "itemsList": [ … ]}` (fields: README → List-mode rows) |
| A dataset you have | a dataset's items, no source run | `{"sourceMode": "dataset", "datasetId": "<id>"}` |
| Calendar-year totals | TradeStat's own Jan–Dec totals, 3 complete years | `{"sourceMode": "live", "hsCodes": ["0904"], "frequency": "annual", "countries": ["ALL"]}` (preset `spices-annual`) |
| Several codes at once | 5 HS codes × 5 markets, 25 series in one run (180 submits) | `{"sourceMode": "live", "hsCodes": ["090411", "090422", "090831", "090931", "091030"], "countries": ["US", "CN", "AE", "BD", "GB"]}` (preset `spice-basket`) |

`sourceRun.mode` on a row: `live` = the built-in TradeStat reader (`reader` names it), `actor` = the fallback Store Actor
(`actorId`), `dataset` / `list` = your own rows.

## One dataset item

A real item from the live run of 2026-11-22 (HS 0904, calendar year 2023, Germany, AI off) — every field, `dedupeKey`
included. The same row is the mapping fixture `tests/data/tradestat-meidb-row.json`.

```json
{
  "itemId": "fed32bf4f1c3",
  "name": "0904 → Germany, 2023",
  "hsCode": "0904",
  "hsDescription": "PEPPER OF THE GENUS PIPER; DRIED OR CRUSHED OR GROUND FRUITS OF THE GENUS CAPSICUM OR OF THE GENUS PIMENTA PEP",
  "country": "DE",
  "countryName": "Germany",
  "countrySourceName": "GERMANY",
  "period": "2023",
  "status": "revised_final",
  "valueUsd": 7150000,
  "valueInr": 589500000,
  "valueUsdFromInr": 7137703,
  "fxRate": 82.5896,
  "fxSource": "ecb-monthly-average",
  "quantity": 1107343.0,
  "unit": "KGS",
  "quantityMt": 1107.343,
  "unitValueUsdPerMt": 6456.9,
  "yoyGrowthPct": 5.77,
  "ytdValueUsd": null,
  "ytdGrowthPct": null,
  "formUrl": "https://tradestat.commerce.gov.in/meidb/commodity_wise_all_countries_export",
  "url": "https://api.apify.com/v2/key-value-stores/<your india-export-stats-ai-evidence store>/records/ts-0904-DE-2023",
  "flags": [],
  "targetFlagsMatched": [],
  "ruleScore": 50,
  "score": 50,
  "label": "warm",
  "fitScore": null,
  "scoreReasons": [],
  "summary": null,
  "generatedText": "Germany, 0904 — 2023: US$ 7.15 m (+5.8 % on 2022); 1,107.3 t at US$ 6,457/t; revised final.",
  "recommendedNextStep": "Steady market: schedule this search monthly to catch the next Germany figure for HS 0904.",
  "aiModel": null,
  "assessedBy": "rules",
  "chargedEvent": "qualified-export-row-basic",
  "billedAs": "qualified-export-row-basic",
  "dedupeKey": "ts:0904:DE:2023:revised_final",
  "rowId": "0904:DE:2023:revised_final",
  "fetchedAt": "2026-11-22T18:24:37+00:00",
  "source": "tradestat-meidb",
  "sourceRun": {"mode": "live", "reader": "built-in reader of TradeStat's MEIDB export form", "query": "0904"},
  "sample": null,
  "scrapedAt": "2026-11-22T18:24:52+00:00"
}
```

An AI-assessed row adds `fitScore` (int), `scoreReasons` (list of str), `summary`, the AI's `generatedText` and
`recommendedNextStep`, `aiModel` (e.g. `anthropic/claude-haiku-4.5`) and `assessedBy: "ai"`; the demo's labelled
verdicts carry `assessedBy: "sample"`, `aiModel: "sample"`.

## Flags (free, rule-based)

| Flag | Meaning |
|---|---|
| `growing` | exports up 20 % or more on the same month a year earlier (TradeStat's own %Growth column) |
| `falling` | exports down 20 % or more on the same month a year earlier |
| `provisional` | the month is still provisional — TradeStat may revise it; it comes again as a new row when it turns final |
| `below_rounding` | US $ and ₹ views both print 0.00 while goods moved — below the published rounding |
| `mixed_units` | the 8-digit codes under the HS code use different units, so no tonnes or US $ per tonne (`refused[].reason: not_supported`) |
| `country_unmapped` | TradeStat's country name is not in the ISO table — `country` is null, `countryName` kept |
| `hs_reallocated` | TradeStat marks the code * (dropped or re-allocated from April 2026) |

## Row ids and links

`url` opens the row's own evidence page — a record of the named key-value store `india-export-stats-ai-evidence` on
your account, kept until you delete it (a named store is outside the plan's data retention, so a link saved in a CRM
or Sheet keeps working; a revised month overwrites its own page): the three TradeStat views as read and the four form
choices (HS code, month, value view, country line) that show the same figure on TradeStat — the MEIDB form is a POST
form, so a row has no address there; `formUrl` is the form itself. The run's own records (`DIGEST`, `REPORT` at `reportUrl`, the `EVIDENCE` overview) live
in the run's store and follow your plan's data retention. `dedupeKey` = per state (HS + country + period +
status, changes when a month turns final), `rowId` = the same key without `ts:`, `itemId` = its hash (same across
runs). `countryName` is the ISO-2 code's English name, `countrySourceName` TradeStat's own spelling.

## API-only inputs

Hidden on the form; an API / MCP call can set them. Defaults as in `input_schema.json`.

| Field | Default | Effect on cost and time |
|---|---|---|
| `aiCandidateMultiplier` | `2` | rule-ranked rows per qualified row that get the AI pass: × N AI calls, time and tokens |
| `maxToProcess` | 3 × `maxQualified` | rows scored per run — more = longer rule pass, never charged |
| `autoSwitchToLive` | `true` | Console only: typed terms next to the sample start the live read (free source, charged rows) |
| `failOnSourceError` | `false` | `true` = a run that loaded nothing ends FAILED (schedules alert) instead of SUCCEEDED, 0 rows |
| `maxDiscoveryChargeUsd` | `0.5` | cap on the fallback Store Actor's charge, only when TradeStat blocks the built-in reader |
| `discoveryActorId` / `discoveryInput` / `discoveryTimeoutSecs` | `apify/website-content-crawler` / — / `3600` | that fallback: its Actor, input and time limit (billed to you, off by default) |
| `allowList` | — | rows no free rule may drop — they are charged like any other |
| `dedupeStoreName` | `india-export-stats-ai-seen` | the memory: a new name = everything is new and charged again |
| `webhookHeaders` / `webhookBatchSize` / `webhookSecret` | — / `1` / — | webhook auth, rows per POST, signature — no cost |
| `slackWebhookUrl` … `telegramUrl` | — | digest channels (the form's **Send alerts to** fills them) — no cost |

## Webhook payloads

`webhookBatchSize: 1` sends `{"event": "export-row.qualified", "item": {…item…}, "export-row": {…item…}, "runId": "…"}`
per row; a larger size sends `{"event": "export-rows.qualified", "items": [{…}, …], "export-rows": [{…}, …], "runId":
"…"}` per batch (the last one may be shorter). Read the generic `item` / `items` keys — the same in every Actor of this
developer; `export-row` / `export-rows` are deprecated and removed on 2027-03-01. A 429 / 5xx / network error is retried once after 2 s (15 s timeout); a POST that still fails is counted in
`OUTPUT.webhook.failed` with its `dedupeKey`s in `OUTPUT.webhook.failedKeys`, never fails the run, and is re-POSTed first
on the next run with `"redelivery": true` for up to 7 days, never charged again. With `webhookSecret` every POST carries
`X-Signature: sha256=<HMAC-SHA256 of the raw body>`.

## `OUTPUT` record keys

One line per key: type, one example, and the sub-keys of every nested record. Generated from three runs merged — list
mode with AI on (2026-11-22), the capped live read of INPUT.live.json and a second run of the same search.

- `ok` — bool: `false` only when the source was refused / failed and nothing loaded
- `outcome` — str, one of `ok` · `empty` · `source_refused` · `source_failed` · `error`
- `mode` — str: `demo` · `live` · `list` · `dataset`
- `qualified` — int, e.g. `52`
- `rows` — int (= `qualified`), `refused` — list of `{source, reason, detail}` with `reason` one of `failed` · `skipped` ·
  `no_data` · `no_trade` · `not_supported` (alert on `failed` only), `queries` — list of `{hsCode, country, matched}`,
  `costUsd` — number (the source bill on your account: 0 on the built-in read) — the run contract a trade-data pipeline reads (FR-8)
- `dataAvailable` — str, e.g. `"Jan 2018 to Sep 2026"`; `lastUpdated` — str `"2026-11-18"`; `latestMonth` — `"2026-09"`;
  `finalUpto` / `revisedFinalUpto` — str | null; `submits` — int `36`; `cacheHits` — int; `perHs` — object:
  `{"090422": {"countries": 4, "months": 13}}`
- `stats` — object: the funnel, `discovered`, `skipped_<reason>` counts, `ai_assessed`, `ai_series_rows`, `capped_by_max_qualified`
- `skips` — object | null: `{"<reason>": ["<name>", …]}` — the names each free rule dropped
- `chargedEvents` — object: `{"<event>": <count>}`; `chargeSplit` — object: `demo`, `free`, `basic`, `ai`, `freeKeptForAi`
- `sourceStatus` — object | null: `status`, `partial`, `timeCapped`, `itemsRead`, `ownSourceFallback`
- `sourceError` — str | null · `sourceRefused` — `"plan"` | null · `sampleFallback` — bool | null
- `aiCoverage` — object | null: `aiAssessed`, `ruleScored`, `fallbackReasons` (`{"parse": 3}`), `sampleVerdicts`; `aiError` — str | null
- `aiTokens` — object | null: `inputPerUnit` (1638), `outputPerUnit` (225), `model`
- `webhook` — object | null: `sent`, `failed`, `failedKeys`, `redelivered`, `pendingNextRun`, `signed`
- `trend` — object | null (second run on): `qualified: {from, to}`, `hot: {from, to}`, `topMarketUsd: {from, to}`
- `history` — array | null: one `{at, qualified, hot, topMarketUsd}` per run of this search, oldest first
- `scheduledSizing`, `firstRunBackfill`, `seedsRolled`, `scanCapHit` — object | null: what a scheduled run resized
- `digestEmailed` — bool | null; `scheduleTaskUrl` — str | null; `reportUrl` — str | null; `dedupeStore` — object: `name`, `scope`, `newMemory`
- `timing` — object: `sourceSecs` (90.1 for 36 submits), `aiSecs`, `aiSecsPerUnit`, `aiBackoffSecs`, `aiPaceSecs`, `totalSecs`
- `nextSteps` — array | null: the status steps that did not fit the 200-character status
