# Spice Association Members: Buyers, Importers & Exporters List — 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 sample records, nothing charged | `{}` |
| Demo, as the form opens | the same free demo | `storage-example/INPUT.json` |
| Live search, capped | the built-in reader of the SSA list (UK), AI off, 5 rows | `storage-example/INPUT.live.json` |
| AI on | the same records with the AI verdict (home pages read first) | `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 |
| 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>"}` |
| A ready niche search | one preset, live | `{"preset": "europe-buyers"}` |
| A brief alone (Console) | the brief's country words become `countries`, live | `{"goalDescription": "Buyers of turmeric in Germany and the UK"}` on the Console form (over the API: send `"sourceMode": "live"` too) |
| Membership check | only the members answering a typed name, live | `{"checkCompanies": ["Synthite", "AVT McCormick"]}` (preset `verify-indian-supplier`) |
| Website read | every delivered member's home page, the `enriched-member-company` event | `{"countries": ["GB"], "readWebsites": true}` |
| Everything on the three lists | every member type, live | `{"memberTypes": ["full", "associate", "supporting", "association"]}` |
| ASTA asked for | reported in `refused[]` (`not_supported`), never read | `{"associations": ["asta", "ssa"]}` |

## API-only fields (hidden on the form)

Read by every call, listed nowhere else: `webhookUrl` (the rows as JSON; on the form any https URL in **Send alerts
to** becomes it), `webhookHeaders`, `webhookSecret` (HMAC-SHA256 `X-Signature`), `webhookBatchSize`,
`slackWebhookUrl` / `discordWebhookUrl` / `teamsWebhookUrl` / `googleChatWebhookUrl` / `telegramUrl` (aliases of
`sendAlertsTo` — new integrations put every URL in `sendAlertsTo`; which wins: an explicit alias over the same
service's URL there; every URL is posted once),
`dedupeStoreName` (one memory per client), `historyDatasetName`, `failOnSourceError` (true = a run in which no member
list answered ends FAILED — set it on every schedule), `allowList` (names no free rule may drop), `maxToProcess` (the
scan cap, default 3 × `maxQualified`), `autoSwitchToLive` (Console only: typed terms next to the sample start the live
read; over the API the mode you send is the mode that runs), `aiCandidateMultiplier`, `discoveryTimeoutSecs`,
`enrichWebsite` (ESA rows take a co-member row's website; default on), and the deprecated crawler-fallback trio
`discoveryActorId`, `discoveryInput`, `maxDiscoveryChargeUsd` (ignored by the built-in read; only `ownSource: false`
runs the Website Content Crawler on your account, capped at $0.50). **0.2.0 (2026-12-07) removes the deprecated trio**;
until then a call that sets one is accepted with one warning in the log.

## The free tier and the AI reserve

Your first 10 qualified member companies per Apify account are free, whatever the tier. With the AI on, up to 5 of
those 10 are **kept for the AI**: rule-scored rows (a plan without model access, a rate-limited free key) use the free
units down to that reserve, so the first AI-assessed members of the account are still free — `OUTPUT.chargeSplit`
shows `free`, `basic`, `ai`, `sameUnit`, `enriched` and `freeKeptForAi`. The status says only "N free member
companies left". A free Gemini key answered 5 of 5 members on 2026-11-22 (≈ 2.8 s each); on a big backfill it hits its
per-minute limit after ≈ 1–3 members and the rest keep their rule score — a paid key assesses every member.

## Every output field

| Fields | Meaning |
|---|---|
| `itemId`, `dedupeKey`, `rowId`, `companyKey` | ids: upsert on `dedupeKey`, join companies on `companyKey` |
| `name`, `url`, `memberUrl` (same value), `source`, `sourceUrl` | the member and its page — SSA prints one; ESA and AISEF rows open the list page at the member (a text fragment) |
| `association`, `associationName`, `memberType`, `associationScope`, `alsoMemberOf` | which list and type; the list's product scope (a per-list constant); the other lists it is on |
| `country`, `countryName`, `city`, `address`, `postcode` | where it is (address and postcode: SSA only) |
| `website`, `domain`, `websiteSource`, `companyEmail`, `contactRoute` | how to reach it: role e-mail → contact page → website → member page |
| `websiteTitle`, `websiteDescription`, `categories`, `contactPageUrl`, `linkedinUrl`, `websiteFetched`, `websiteFetchedAt` | the member's own home page as read in this run (`websiteFetchedAt` = when this run read it; null when not read) |
| `matchedCheckName`, `contactWithheld`, `listCheckedAt` | the checked name this row answers; a personal contact was dropped (null when the list shows none); `listCheckedAt` = when this run downloaded the list page (the associations publish no list date) |
| `flags`, `targetFlagsMatched`, `score`, `ruleScore`, `fitScore`, `label`, `assessedBy`, `aiModel` | the scores and who scored |
| `buyerRole`, `fitNote`, `summary`, `scoreReasons`, `generatedText`, `generatedTextBy`, `recommendedNextStep` | the verdict and the first line |
| `chargedEvent`, `billedAs`, `fetchedAt`, `sourceRun` | what it was billed as; when this run wrote the row; provenance (`mode: live` + reader for the built-in read) |

`scrapedAt` (a copy of `fetchedAt`) was dropped in 0.1.4 — read `fetchedAt`.

## Webhook and delivery

`webhookUrl` POSTs each row as `member_company.qualified` (batch body: `member_companies.qualified`) with `runId`;
retried once on 429 / 5xx, a failure never fails the run, the rows are re-sent next run; `webhookSecret` signs it
(HMAC-SHA256 `X-Signature`). Every URL is posted once: `webhookUrl` gets the rows as JSON, every other field the digest;
an explicit per-service field (`slackWebhookUrl` …) wins over the same service's URL in **Send alerts to**;
`notifyEmail` is the e-mail copy (it runs Apify's send-mail Actor, so it needs a plan that runs Store Actors — chat
alerts work on every plan).

## Measured run times

| Mode | Measured time | `timeoutSecs` to pass |
|---|---|---|
| Free demo | 0.2 s | 120 |
| Live read, one list | SSA: 2.8 s (local) | 120 |
| Live read, all three lists | 391 members: 13.6 s (local) | 300 |
| AI with an own key | ≈ 0.7–9.4 s per member (newest 2026-11-23: 0.7 s), ≈ 6–85 a minute (free google:gemini-3.5-flash-lite key) | ≈ 650 for 50 (180 + 9.4 s each) |
| AI via Apify's model access | not measured on the platform yet | 600 + 9.4 s per member |

## One dataset item

One real item of the local AI run of `storage-example/INPUT.ai.json` (2026-11-23, own key; the home page was read first):

```json
{
 "itemId": "52d5d8224a90",
 "name": "British Pepper and Spice Ltd",
 "url": "https://seasoningandspice.org.uk/members/british-pepper-and-spice-ltd",
 "association": "ssa",
 "associationName": "Seasoning and Spice Association (UK)",
 "memberType": "full",
 "country": "GB",
 "countryName": "United Kingdom",
 "city": "Northampton",
 "address": "Rhoshilli Road, Brackmills, Northampton, NN4 7AN",
 "postcode": null,
 "website": "http://www.britishpepper.co.uk",
 "domain": "britishpepper.co.uk",
 "websiteSource": "list",
 "companyEmail": null,
 "memberUrl": "https://seasoningandspice.org.uk/members/british-pepper-and-spice-ltd",
 "companyKey": "british-pepper-spice:gb",
 "contactWithheld": null,
 "listCheckedAt": null,
 "websiteTitle": "British Pepper & Spice | Bringing Spice to Life",
 "websiteDescription": "British Pepper & Spice is the leading manufacturer of herbs & spices in the UK. From five-star restaurants to home-cooked food, we bring dishes to life.",
 "contactPageUrl": null,
 "linkedinUrl": null,
 "websiteFetched": true,
 "websiteFetchedAt": "2026-11-23T08:00:00+00:00",
 "matchedCheckName": null,
 "associationScope": ["spices", "seasonings", "herbs"],
 "categories": ["pepper", "seasoning", "herb", "spice", "ingredient"],
 "alsoMemberOf": [],
 "contactRoute": "http://www.britishpepper.co.uk",
 "buyerRole": "processor",
 "fitNote": "UK processor making spice blends — a direct buyer for Indian turmeric and chilli.",
 "flags": [],
 "targetFlagsMatched": [],
 "ruleScore": 85,
 "score": 90,
 "label": "hot",
 "fitScore": 90,
 "scoreReasons": [
  "UK manufacturer of herbs and spices — a processor that buys whole turmeric and chilli",
  "Full SSA member in Northampton, the customer's target market",
  "Home page highlights pepper, seasoning, herb and spice ingredients — core product families",
  "Established UK processor likely sourcing Indian turmeric and chilli for blending and packing"
 ],
 "summary": "British Pepper & Spice is a UK manufacturer of herbs, spices, pepper and seasonings based in Northampton.",
 "generatedText": "Your Northampton plant produces pepper, herb and spice blends — we supply Indian turmeric and chilli that fit those lines.",
 "generatedTextBy": "ai",
 "recommendedNextStep": "Open http://www.britishpepper.co.uk, find the purchasing or import contact and send your offer.",
 "aiModel": "google:gemini-3.5-flash-lite",
 "assessedBy": "ai",
 "chargedEvent": "demo",
 "billedAs": "qualified-member-company-ai",
 "dedupeKey": "id:ssa:british-pepper-and-spice-ltd-sample",
 "source": "ssa",
 "sourceUrl": "https://seasoningandspice.org.uk/members",
 "rowId": "ssa:british-pepper-and-spice-ltd-sample",
 "fetchedAt": "2026-11-23T03:13:15+00:00",
 "sourceRun": {"mode": "list"}
}
```

On a live row `sourceRun` is `{"mode": "live", "actorId": null, "reader": "built-in reader of the ESA, SSA and AISEF
member lists"}`; `actor` with an `actorId` appears only on the crawler fallback. `chargedEvent` values:
`qualified-member-company-basic` / `-ai`, `free-tier`, `demo`, `already-charged` (paid under another filter set),
`same-unit` (the company's second list row — one charge per company per run).

## `OUTPUT` record keys

Generate this list from THREE runs merged — list mode with AI on, a scheduled second run of the same search (trend,
history, seeds, scheduled sizing filled) and a refused live run (`outcome: source_refused`) — never from the demo
alone (gate `check_api_reference_output_typed`, 2026-10-23 us-importer-finder-ai V-206). One line per key: type, one
example, and the sub-keys of every nested record.

- `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. `12`; `rows` — int, the delivered rows (the trade-data contract), e.g. `86`; `costUsd` — float
- `stats` — object: the funnel, `discovered`, `skipped_<reason>` counts, `ai_assessed`, `ai_sample_verdicts`, `capped_by_max_qualified`
- `skips` — object | null: `{"<reason>": ["<name>", …]}` — the names each Actor-specific rule dropped (`country_filter`, `check_filter` …)
- `chargedEvents` — object: `{"<event>": <count>}`; `chargeSplit` — object: `demo`, `free`, `basic`, `ai`, `alreadyCharged`, `sameUnit`, `enriched`, `freeKeptForAi`
- `sourceStatus` — object | null: `reader`, `status`, `partial`, `associations`, `refused`, `listCheckedAt`, `queries`
- `sourceError` — str | null · `sourceRefused` — `"plan"` | null · `sampleFallback` — bool | null
- `aiCoverage` — object | null: `aiAssessed`, `ruleScored`, `model`, `aiRejected`, `fallbackReasons`, `sampleVerdicts`; `aiError` — str | null
- `aiTokens` — object | null: `inputPerUnit`, `outputPerUnit`, `model`; `aiTrial` — object | null
- `websites` — object | null: `attempted`, `fetched`, `failed`, `mode` (`ai` = title + description for the AI pass, `full` = `readWebsites`), `timedOut`
- `membershipCheck` — object | null: `names`, `members`, `notFound[]`, `results` — `{"<typed name>": [{name, association, memberType, country, website, url, deliveredBefore}]}`
- `contactCoverage` — object | null: `delivered`, `withWebsite`, `withRoleMailbox`, `byAssociation` — `{"esa": {rows, withWebsite, withRoleMailbox}}` — what you can click or mail, over the delivered rows (Europe buyers, 2026-11-23: 86 delivered, 22 with a website, 0 with a role mailbox)
- `spendCeiling` — str | null: the most this run could charge, all in — `"100 × ($0.01 + ≈ $0.0025 tokens + $0.03 website) ≈ $4.25"`
- `listCoverage` — object | null (an empty run with a country filter): `{esa: "EU, UK and origin countries …", ssa: "United Kingdom (GB) only", aisef: "India (IN) only"}`
- `switchedToLive` — array | null: the typed search fields that left the demo; `termsFromBrief` — array | null: the countries the brief named, e.g. `["DE", "GB"]`
- `demoIgnoredFields`, `demoTextsDropped`, `demoTextsSearched` — array | null; `presetApplied` — object | null: `preset`, `filled[]`
- `webhook` — object | null: `sent`, `failed`, `failedKeys`, `redelivered`, `pendingNextRun`, `signed`
- `trend` — object | null (second run on): `qualified: {from, to}`, `hot: {from, to}`, the Actor's own series
- `history` — array | null: one `{at, qualified, hot, …}` per run of this search, oldest first; `historyDataset` — object | null
- `scheduledSizing`, `firstRunBackfill`, `seedsRolled`, `scanCapHit`, `notDeliveredCap` — object | null: what a scheduled run resized
- `digestEmailed` — bool | null; `scheduleTaskUrl` — str | null; `scheduleInput` — object; `reportUrl` — str | null; `timeSaved` — str | null; `reviewAsked` — bool | null
- `timing` — object: `sourceSecs`, `aiSecs`, `aiSecsPerUnit`, `aiBackoffSecs`, `aiPaceSecs`, `totalSecs`
- `refused` — array | null: `[{association, reason (not_supported | robots | failed), detail, url}]`
- `queries` — array | null: the member-list URLs read, e.g. `["https://seasoningandspice.org.uk/members"]`
- `associations` — object | null: `{esa: {ok, membersRead, byType: {full, associate, association}, kept, withWebsite, listCheckedAt}}`
- `listCheckedAt` — object | null: `{esa: "2026-11-22T10:58:17+00:00"}` — when this run downloaded each list page; `websitesFromOtherList` — int | null
- `nextSteps` — array | null: the status steps that did not fit the 200-character status
