# DGFT Notification Watch: India Export Rules, Bans, MEP — API reference

The detail an integrator needs and a buyer does not, linked from the README's Integrations section.

## Tested combinations

Every row is an input the test suite and the review runs start — the combinations that are supported.

| Call | What runs | Input |
|---|---|---|
| Daily test / first agent call | the free demo on the 5 sample notices, nothing charged | `{}` |
| Demo, as the form opens | the same free demo | `storage-example/INPUT.json` |
| Live read, capped | DGFT notifications, last 30 days, AI off | `{"sourceMode": "live", "sources": ["dgft_notification"], "lookbackDays": 30, "enableAi": false, "maxQualified": 5}` |
| A ready watch | the preset's HS codes / publishers / types | `{"preset": "rice-exporter"}` |
| Importer watch | Schedule-I import notices (flag `import_rule`) | `{"preset": "importer-restrictions"}` |
| AI text in Hindi | summary, next step and digest in Hindi | `{"enableAi": true, "outputLanguage": "hi"}` + your input |
| AI on | the 5 notices 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 input |
| Your own list | your rows, nothing fetched | `{"sourceMode": "list", "itemsList": [{"title": "…", "date": "2026-11-20"}]}` |
| A dataset you have | a dataset's items, nothing fetched | `{"sourceMode": "dataset", "datasetId": "<id>"}` |

## One dataset item

A real row of the sugar watch's live read, 2026-11-21 (`pdfText` shortened; this PDF is a scan, so the HS match came
from the goods word in the subject — `hs_from_goods`):

```json
{
 "itemId": "8586e65e494a",
 "name": "Opening of one-time window for submission of applications for allocation of available quantity under TRQ Scheme for import of raw sugar - reg.",
 "url": "https://content.dgft.gov.in/Website/dgftprod/c8ccf867-ae1e-41ab-8f93-3d671115a128/PN-41_0001.pdf",
 "number": "41/2026-27", "year": "2026-27", "date": "2026-11-18", "type": "restriction",
 "hsCodes": [], "products": ["sugar"], "productsFromHs": [], "effectiveFrom": null, "pdfText": null,
 "textHash": "490d82a7908c93fa", "category": null,
 "flags": ["restriction", "no_text_layer", "hs_from_goods"], "targetFlagsMatched": [],
 "ruleScore": 80, "score": 80, "label": "hot", "fitScore": null, "scoreReasons": [], "summary": "",
 "generatedText": "Restriction notice 41/2026-27 of 2026-11-18 · sugar.",
 "recommendedNextStep": "Read https://content.dgft.gov.in/Website/dgftprod/c8ccf867-ae1e-41ab-8f93-3d671115a128/PN-41_0001.pdf and check which of your open shipments it covers before the next booking.",
 "aiModel": null, "assessedBy": "rules",
 "chargedEvent": "qualified-regulation-notice-basic", "billedAs": "qualified-regulation-notice-basic",
 "dedupeKey": "id:35d5103112a5dd8a", "source": "dgft_public_notice",
 "sourceUrl": "https://www.dgft.gov.in/CP/?opt=public-notice", "rowId": "35d5103112a5dd8a",
 "fetchedAt": "2026-11-21T13:36:30+00:00",
 "sourceRun": {"mode": "actor", "actorId": "own-source", "reader": "built-in reader of the official publishers (DGFT, APEDA, MPEDA, FSSAI)"},
 "scrapedAt": "2026-11-21T13:36:30+00:00"
}
```

`chargedEvent` values: `qualified-regulation-notice-basic`, `qualified-regulation-notice-ai`, `free-tier`, `demo`,
`already-charged` (paid under another task of the same memory), `unconfirmed` (a ban / MEP / restriction / duty whose
HS codes could not be read, kept for your HS filter and never charged — flag `hs_unknown_check_pdf`).

## `OUTPUT` record keys

- `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. `9`
- `sources` — object: `{"dgft_notification": {"ok": true, "seen": 233, "items": 233, "new": 3, "newest": "2026-11-19",
  "newestDate": "2026-11-19", "checkedAt": "2026-11-21"}, …}` — every publisher read; `newestDate` is the newest date
  the list holds
- `staleSources` — str | null: the publishers whose newest listed item is > 60 days old, as the status says them
  ("FSSAI notifications and orders: newest listed 2026-07-27, checked today")
- `rowsWithoutDate` — array | null: list mode, the 1-based rows without a `date` (kept, named in the status)
- `refused` — array: `[{"source": "cbic", "reason": "not_supported", "detail": "…"}]` — `reason` is `not_supported`
  (this version does not read it — the same on every run) or `failed` (it should answer and did not — alert on this)
- `stats` — object: the funnel, `discovered`, `skipped_<reason>` counts, `revised`, `ai_assessed`,
  `capped_by_max_qualified`
- `skips` — object | null: `{"<reason>": ["<name>", …]}`
- `chargedEvents` — object: `{"<event>": <count>}`; `chargeSplit` — object: `demo`, `free`, `basic`, `ai`,
  `alreadyCharged`, `unconfirmed`, `freeKeptForAi`
- `sourceStatus` — object | null: `reader`, `since`, `sources`, `refused`, `pdfsRead`, `pdfsWithoutText`, `partial`
- `sourceError` — str | null · `sourceRefused` — `"plan"` | null · `sampleFallback` — bool | null
- `aiCoverage` — object | null: `aiAssessed`, `ruleScored`, `fallbackReasons`, `sampleVerdicts`; `aiError` — str | null
- `aiTokens` — object | null: `model`, `assessed`, `inputPerUnit`, `outputPerUnit` (2026-11-21, gemini-3.5-flash-lite:
  1,219 in / 180 out per notice ≈ $0.0021 at Claude Haiku 4.5 rates)
- `webhook` — object | null: `sent`, `failed`, `failedKeys`, `redelivered`, `pendingNextRun`, `signed`
- `trend` — object | null (second run on): `qualified: {from, to}`, `hot: {from, to}`
- `history` — array | null: one `{at, qualified, hot}` per run of this search, oldest first
- `scheduledSizing`, `firstRunBackfill`, `scanCapHit` — object | null: what a scheduled run resized
- `digestEmailed` — bool | null; `scheduleTaskUrl` — str | null; `reportUrl` — str | null
- `timing` — object: `sourceSecs`, `aiSecs`, `aiSecsPerUnit`, `aiBackoffSecs`, `aiPaceSecs`, `totalSecs`
- `nextSteps` — array | null: the status steps that did not fit the 200-character status
- `hsCodesFromGoal` — array | null: the HS codes the goods in `goalDescription` gave while `hsCodes` was empty
  (`["1006", "0703"]` for "we export basmati rice and onion") — copy them into `hsCodes` to keep them

## Which call runs what

| Input shape | `OUTPUT.mode` | Can it charge? |
|---|---|---|
| `{}` or the untouched form (the sample notices) | `demo` | no — sample rows are `chargedEvent: demo` |
| the sample + your `hsCodes` / `sources` / `types` (or goods in `goalDescription`) typed on the Console form | `live` | yes — per qualified notice; the reader itself costs nothing |
| the same over the API (or with `autoSwitchToLive: false`) | `demo` | no — the mode you send is the mode that runs |
| `sourceMode: "live"` + your HS codes (or none) | `live` | yes — per qualified notice |
| `sourceMode: "list"` + your own `itemsList` rows | `list` | yes — per qualified notice, nothing fetched |
| `sourceMode: "dataset"` + `datasetId` | `dataset` | yes — per qualified notice, nothing fetched |

## Which delivery field wins

Every URL is posted once per run: **Send alerts to** (`sendAlertsTo`) fills each service you did not set yourself (an
explicit `slackWebhookUrl` … over the API wins for that service), `webhookUrl` gets the notices as JSON, Slack /
Discord / Teams / Google Chat / Telegram get the digest, `notifyEmail` gets it by e-mail. The per-service fields are
API-only — the form asks once.

## Webhook

`webhookBatchSize: 1` sends `{"event": "regulation_notice.qualified", "regulation_notice": {…}, "runId": "…"}` per
notice; a larger size sends `{"event": "regulation_notices.qualified", "regulation_notices": [{…}, …], "runId": "…"}`
per batch. A 429 / 5xx / network error is retried once after 2 s; a POST that still fails is counted in
`OUTPUT.webhook.failed` and re-POSTed first on the next run (`"redelivery": true`, never charged again) — a webhook
failure never fails the run. `webhookSecret` adds `X-Signature: sha256=<HMAC of the raw body>`.

## Rule types (`types`)

`prohibition` · `minimum_export_price` · `restriction` (licence, quota / TRQ, policy condition) · `export_duty` ·
`incentive_rate` (RoDTEP, RoSCTL, drawback, schemes) · `procedure` · `administrative` (left out unless asked for) ·
`other`.

## Coming next

Dated in the repository's `docs/ROADMAP.md`:

- 2026-12-05 — the AI sample re-cut on Apify's model access (`anthropic/claude-haiku-4.5`) and its measured pace.
- 2026-12-05 — OCR for scanned DGFT PDFs (cost and run time measured first).
- 2026-12-19 — a per-run watch fee and a 14-day free trial (14 days' notice to existing users).
- 2026-12-26 — a one-off HS policy check: the current ITC-HS status of one code plus 12 months of its notices.
- 2026-12-12 — structured rule values: MEP in US$ per tonne, quota, export duty %, valid until.
- 2026-12-12 — the Spices Board's circular list; then CBIC customs notifications, Tea / Coffee Boards.
- 2026-12-19 — WhatsApp alerts (your own Meta Cloud API / Twilio number).
- 2026-12-19 — a `clients` array: one run, one digest and memory per client, for CHAs and consultants.
