# GroceryAI · developer documentation (full text) > The complete GroceryAI developer documentation as one text file, generated from the same source as https://groceryai.ai/developers. Italian: https://groceryai.ai/it/sviluppatori.md. Index of the website: https://groceryai.ai/llms.txt. ## API reference · GroceryAI > The OpenAPI 3.1 reference verified against the code that serves it, the integration guides and the tested examples. - Version 1.0.0 · 36 operations · 12 scopes · 5 events - API base URL: https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api - The OpenAPI 3.1 contract, no key needed: https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/openapi.json - The error code catalog, no key needed: https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors - HTML: https://groceryai.ai/developers · Markdown: https://groceryai.ai/developers.md · llms-full.txt: https://groceryai.ai/llms-full.txt - Versions and deprecation: 10. Versions and deprecation - The changelog: https://groceryai.ai/developers/changelog - The MCP server for AI agents: https://groceryai.ai/developers/mcp ### GroceryAI API · quickstart (5 steps) From nothing to a catalog loaded and an order received, in the **test** environment. Test data is fully separate from real data: nothing you do here reaches a real customer. Base URL (every path below is appended to it): ``` https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api ``` The full reference is the OpenAPI 3.1 document, readable **without a key**: `GET /v1/openapi.json`. Every operation in it has a request and a response example tested against the test environment. #### 1. Get a test key In the GroceryAI portal: **Developers → API keys → Create key**. Choose the environment `test` and only the scopes you need, for example `catalog:read` and `catalog:write` (scopes never include each other). The key looks like `gai_test_ab12cd34_…` and is shown **once**: store it in a secret manager or an environment variable, never in code. ```bash export GROCERYAI_API_KEY='gai_test_…' # your key; never commit it export GROCERYAI_BASE='https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api' ``` #### 2. Read the contract (no key needed) ```bash curl -s "$GROCERYAI_BASE/v1/openapi.json" -o openapi.json ``` Generate a client from it, or give it to your coding agent. The response carries an `ETag`: send it back as `If-None-Match` and you get `304` when nothing changed. #### 3. Make your first call ```bash curl -s "$GROCERYAI_BASE/v1/products?limit=1" \ -H "Authorization: Bearer $GROCERYAI_API_KEY" ``` A `200` with `{"data": [...], "next_cursor": ..., "request_id": "..."}` means your key works (every new shop comes with its own sandbox shop that has the sample products: create the `test` key there; sample products never go on sale). A `401` or `403` carries `error.code` and `error.doc_url`: open the URL, it tells you what is wrong and how to fix it. #### 4. Load your catalog Writes go in batches of up to 500 items and **always** carry an `Idempotency-Key` (a fresh UUID per operation; reuse it only to retry the very same request). ```bash curl -s -X PUT "$GROCERYAI_BASE/v1/products" \ -H "Authorization: Bearer $GROCERYAI_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{"products":[{"sku":"EXAMPLE-SPAGHETTI-500","title":"Spaghetti 500 g","price":1.29,"stock_qty":140}]}' ``` The response says how many items were `received`, `written` and `rejected`. A rejected item does not fail the batch: it is listed in `errors[]` with its `index`, `code` and `message`. Then keep prices and stock fresh with `PUT /v1/inventory` (only the fields you send change). #### 5. Receive orders Two ways, same data. Pick one: - **Pull** (no inbound endpoint needed): `GET /v1/orders?status=new` returns confirmed orders; after saving one in your system, acknowledge it with `POST /v1/orders/{order_id}/ack` (with an `Idempotency-Key`). It will not come back. - **Webhooks**: register an endpoint in the portal (Developers → Webhooks), verify each delivery with the official Standard Webhooks library (`standardwebhooks` on npm and PyPI; examples in `docs/api/examples/`), answer `2xx` within 15 seconds, and drop duplicates by `webhook-id`. When an order has been delivered, tell us how it went: `POST /v1/orders/{order_id}/status` with `delivered`, `substituted`, `not_delivered` or `returned`. #### Going live Create a `gai_live_…` key with the same scopes and change nothing else: paths, payloads and errors are identical. Live and test never see each other's data, idempotency keys included. #### When something fails - Program against `error.code`, never against `message` (the text may change). - Follow `error.doc_url` (or `GET /v1/errors/{code}`): the page says what happened, how to fix it, and whether retrying the same request unchanged can succeed (`retryable`). - `429 LIMITE_RICHIESTE`: wait `Retry-After` seconds. `5xx`: retry with the same `Idempotency-Key`, it is never applied twice. - If you contact us, send the `request_id`. More: the integration guide (`docs/api/guide.en.md`), the rules for coding agents (`docs/api/AGENTS.md`) and a ready prompt for Claude Code, Codex or Cursor (`docs/api/agent-prompt.md`). ### For AI agents To have a coding agent (Claude Code, Codex, Cursor or another) integrate GroceryAI in your repository: the prompt to paste, the AGENTS.md file to keep in the repository and the error codes with the page of each one. Everything is public; the only secret is the test key you put in the environment. #### Integration prompt for coding agents Paste the block below into Claude Code, Codex, Cursor or any coding agent working in **your** repository. Replace the two lines marked `<…>`. The agent needs nothing else from GroceryAI: the contract, the examples and the error pages are public, and the only secret is the test key you put in the environment. --- ```text You are integrating this repository with the GroceryAI Platform API. Goal: . Our stack: . Sources of truth (fetch them, do not answer from memory): - OpenAPI 3.1 contract, no key needed: https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/openapi.json Every operation has a tested request and response example; response schemas are closed, never invent fields. - Error catalog, no key needed: GET /v1/errors and GET /v1/errors/{code} on the same base URL. Every error response carries error.doc_url pointing to its page: read it when a call fails, it says how to fix the request. Credentials: - The API key is in the environment variable GROCERYAI_API_KEY. It is a test key (gai_test_...): it only sees test data. Never print, log, commit or hard-code the key, and never send it anywhere except the GroceryAI base URL. Do not switch to a live key (gai_live_...); that is a human decision. Working steps: 1. Download the contract and list the operations and scopes the goal needs. 2. Make the first call before writing any code: GET /v1/products?limit=1 with "Authorization: Bearer $GROCERYAI_API_KEY". A 200 proves the key; a 401/403 tells you why in error.code and error.doc_url. If the key lacks a scope, stop and tell me which scope to add; do not work around it. 3. Implement against the contract, applying the rules that concern the operations your goal uses: - every write carries a fresh Idempotency-Key (UUID v4) per logical operation, reused only to retry the same body; - batch writes take at most 500 items; always check errors[] and warnings[] in the 200 response; - paginate with next_cursor -> cursor until it is null (it is present only when there really is another page, so the last page, even a full one, needs no extra request); - branch on error.code (never on message); on 429 wait Retry-After; on 5xx retry with the same Idempotency-Key; - log the request_id of every failed call; - error.code, error.type and values such as stato are stable Italian identifiers; error.message is Italian free text for humans: never parse it. 4. Prove it against the test environment: run the integration end to end, show me the real responses (status, counts, errors[]), and add automated tests that use the documented examples as fixtures. 5. Report: the operations used, the scopes required, what you ran and what it returned, and anything you could not verify. Do not claim success without a real response from the API. ``` --- Why each line is there: the public contract and error pages let the agent work without our help; the test key keeps every experiment away from real customers; idempotency, batch checks and `error.code` branching are the rules that otherwise get guessed wrong; the last step stops an agent from declaring "done" on code it never ran. The same rules, as a file to keep in your repository: `AGENTS.md`. The five steps for a person: `quickstart.md`. #### AGENTS.md · integrating with the GroceryAI API Copy this file into the repository that integrates with GroceryAI (as `AGENTS.md`, or merge it into yours, or into `CLAUDE.md`). It tells a coding agent (Claude Code, Codex, Cursor, Copilot or any other) the rules that hold for every call, so it does not have to guess. ##### Source of truth - Contract: `https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/openapi.json` (OpenAPI 3.1, no key needed, `ETag` + `Cache-Control`). Fetch it; do not rely on memory. Every operation has a tested request and response example. - Error catalog: `GET /v1/errors` and `GET /v1/errors/{code}` (no key needed). Every error response carries `error.doc_url` pointing to its page. - Service status: `GET /v1/status` (no key needed): per component `operational`, `degraded`, `outage` or `unknown`. Before blaming your code for a `5xx`, check it; `unknown` means not measured, never «up». - Schemas are closed (`additionalProperties: false` on responses): never invent fields, read them from the document. ##### Configuration - Base URL: `https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api`. Keep it in configuration, not scattered in code. - Key: read it from the environment (`GROCERYAI_API_KEY`). Never hard-code it, never print or log it, never commit it, never send it to a third party. Logs may show the public prefix (`gai_test_ab12cd34`) only. - Environments: develop and test with a `gai_test_…` key only. Switching to `gai_live_…` is a human decision; the code does not change. - Recommended header for lower latency from outside Europe: `x-region: eu-central-1`. ##### Rules for every call 1. `Authorization: Bearer ` on every operation except `GET /v1/openapi.json`, `GET /v1/errors` and `GET /v1/status`. 2. Every write (`PUT`, `POST`, `DELETE` with `Idempotency-Key` in the document) carries a fresh `Idempotency-Key` (UUID v4) per logical operation. On retry, reuse the **same** key and the **same** body. A different body with a used key is `409 IDEMPOTENCY_KEY_RIUSATA`. 3. Batch writes (`PUT /v1/products`, `PUT /v1/inventory`, `PUT /v1/customers`, `PUT /v1/order_history`) take at most 500 items. Always inspect `errors[]` (rejected items, with `index` and `code`) and `warnings[]` of the response: a `200` does not mean every item was written. 4. Pagination is by cursor: pass `next_cursor` as `cursor` until it is `null`. It is present only when there really is another page, so the last page (even a full one) ends the loop with no extra request. 5. Branch on `error.code`, never on `error.message`. Use `error.param` to locate the field. Codes, `error.type` and values such as `stato` are stable Italian identifiers; `error.message` is Italian free text and may change. 6. Rate limit: it comes from the store's plan (guide §4: from 5 requests per second on trial to 100 on `enterprise` live, with a burst absorbed by a bucket). Every keyed response carries `RateLimit: "key";r=;t=` (and `RateLimit-Policy: "key";q=;w=1;burst=`; a key with its own per-minute cap adds a `"key-minute"` item to both lists); when `r` gets low in any item, spread the remaining requests over its `t` seconds instead of running into the `429`. Retries: `429` → wait `Retry-After` seconds (equal to `t`); `5xx` → exponential backoff with the same `Idempotency-Key`; codes whose page says `retryable: false` → do not retry unchanged, fix the request. 7. Log the `request_id` of every failed call; it is what GroceryAI support asks for. 8. If your key is an **agent key**, operations that remove or cancel something (`DELETE /v1/products/{sku}`, a snapshot commit without `dry_run`, an order status `not_delivered` or `returned`) answer `202` with an approval and change nothing. Do not work around it and do not retry in a loop: tell the human that a person must approve it in the portal (Developers → Approvals), poll `GET /v1/approvals/{approval_id}` at most once a minute, and when `status` is `approved` send the same request again with `GroceryAI-Approval-Id: `. `APPROVAZIONE_RIFIUTATA` is final. 9. A `401 CHIAVE_SOMMA_ERRATA` means the key in your configuration is truncated or mistyped (its last six characters are a checksum): ask the human for the key again, do not try variations. A `403 IP_NON_AMMESSO` means the key is restricted to other addresses: ask the human, do not switch keys. ##### Catalog - `PUT /v1/products` is an upsert by `sku` that MERGES: only the fields you send change. `PUT /v1/inventory` changes only prices, stock and offers of existing products. - To declare "this is the whole catalog" use a snapshot: `POST /v1/products/snapshots`, the batches with its `snapshot_id`, then `POST /v1/products/snapshots/{snapshot_id}/commit` first with `{"dry_run": true}`, then with `{"expected_off": }`. Never withdraw products one by one to emulate a full sync. - For the whole catalog in one call use `POST /v1/catalog/imports` (up to 50,000 products, or the `url` of a file): it answers `202` with `Location`; poll `GET /v1/catalog/imports/{import_id}` at most every 30 seconds until `status` is `succeeded`, `partial` or `failed`, then read `GET /v1/catalog/imports/{import_id}/errors`. Do not split a whole catalog into hundreds of `PUT /v1/products` calls. - `gtin` is optional; if present it must have a valid check digit. Prices are in the shop currency, never converted. ##### Orders - Pull: `GET /v1/orders?status=new`, store the order, then `POST /v1/orders/{order_id}/ack`. Make your storage idempotent by `order_id` (an order can be read again before the ack). - Webhooks follow Standard Webhooks (https://www.standardwebhooks.com): verify with the official library (`standardwebhooks` on npm and PyPI: `new Webhook(secret).verify(rawBody, headers)`), with the endpoint secret exactly as shown (`whsec_`); it checks `webhook-id`, `webhook-timestamp` (300 seconds tolerance) and `webhook-signature` (`v1,`, two signatures during a secret rotation). Answer `2xx` within 15 seconds and process asynchronously; deduplicate by `webhook-id`; `410 Gone` deactivates the endpoint. Verify against the **raw** body bytes, before parsing. - Report the outcome after delivery: `POST /v1/orders/{order_id}/status`. The same call reports progress before it (`preparing`, `ready`, `out_for_delivery`, `delayed`, `rescheduled`, with `eta`, `reason`, `tracking_url`); after an outcome progress answers `409 TRANSIZIONE_NON_AMMESSA`. Guide, section 7-bis. ##### Definition of done for an integration change - The calls it adds are in the OpenAPI document, with the scopes the key really has. - It ran against the test environment and the responses were checked (status, `errors[]`, schema). - Failures are handled per `error.code` and logged with `request_id`; no key appears in code, logs or commits. #### Error codes Every code the GroceryAI API can return. Program against `error.code` (never against `message`, which may change). Each error response also carries `error.doc_url`, the live JSON version of the page below, readable without a key. | code | what happened | retry unchanged? | |---|---|---| | [`AMBIENTE_DEL_NEGOZIO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/AMBIENTE_DEL_NEGOZIO) | The key's environment does not match the shop's environment for this setting. | no | | [`AMBITO_MANCANTE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/AMBITO_MANCANTE) | The key is valid but does not have the scope this operation requires. | no | | [`APPROVAZIONE_DIVERSA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/APPROVAZIONE_DIVERSA) | The request is not the one that was approved. | no | | [`APPROVAZIONE_GIA_USATA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/APPROVAZIONE_GIA_USATA) | This approval already executed its operation. | no | | [`APPROVAZIONE_IN_ATTESA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/APPROVAZIONE_IN_ATTESA) | The approval is still waiting for a person to decide. | yes | | [`APPROVAZIONE_RIFIUTATA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/APPROVAZIONE_RIFIUTATA) | A person at the shop rejected this operation. | no | | [`APPROVAZIONE_SCADUTA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/APPROVAZIONE_SCADUTA) | The approval expired before it was used (72 hours). | no | | [`APPROVAZIONE_SCONOSCIUTA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/APPROVAZIONE_SCONOSCIUTA) | No approval with this id exists for this key. | no | | [`APPROVAZIONI_ASSENTI`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/APPROVAZIONI_ASSENTI) | Approvals for agent keys are not in service on this instance yet. | yes | | [`ATTESO_NON_VALIDO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/ATTESO_NON_VALIDO) | `expected_off` is missing or is not a whole number. | no | | [`BIC_NON_VALIDO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/BIC_NON_VALIDO) | The BIC/SWIFT code is not valid. | no | | [`BOOLEANO_NON_VALIDO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/BOOLEANO_NON_VALIDO) | A yes/no field is not a boolean. | no | | [`CADENZA_NON_VALIDA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/CADENZA_NON_VALIDA) | `every_hours` is outside the allowed range. | no | | [`CAMPO_IN_DUE_POSTI`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/CAMPO_IN_DUE_POSTI) | The same field is both on the item and inside `attributes`, with two different values. | no | | [`CAMPO_NON_PER_PUNTO_VENDITA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/CAMPO_NON_PER_PUNTO_VENDITA) | With `store_code`, the item carries a field that applies to the whole shop. | no | | [`CAMPO_OBBLIGATORIO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/CAMPO_OBBLIGATORIO) | A required field is missing. | no | | [`CAMPO_SCONOSCIUTO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/CAMPO_SCONOSCIUTO) | The body has a field this operation does not know. | no | | [`CHIAVE_ASSENTE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/CHIAVE_ASSENTE) | The request has no API key. | no | | [`CHIAVE_INCOERENTE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/CHIAVE_INCOERENTE) | The visible prefix of the key does not match its secret part. | no | | [`CHIAVE_MALFORMATA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/CHIAVE_MALFORMATA) | The value after `Bearer` is not shaped like a GroceryAI key. | no | | [`CHIAVE_REVOCATA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/CHIAVE_REVOCATA) | This key has been revoked. | no | | [`CHIAVE_SCADUTA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/CHIAVE_SCADUTA) | This key has passed its expiry date. | no | | [`CHIAVE_SCONOSCIUTA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/CHIAVE_SCONOSCIUTA) | The key is well formed but does not exist. | no | | [`CHIAVE_SOMMA_ERRATA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/CHIAVE_SOMMA_ERRATA) | The key has the current GroceryAI format, but its last six characters (the checksum) do not match the rest: it was truncated, mistyped or altered. | no | | [`CLIENTE_SCONOSCIUTO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/CLIENTE_SCONOSCIUTO) | No customer with this reference exists for this shop and environment. | no | | [`CODICE_AMICO_NON_VALIDO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/CODICE_AMICO_NON_VALIDO) | The friend-code settings are not valid. | no | | [`CODICE_ERRORE_SCONOSCIUTO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/CODICE_ERRORE_SCONOSCIUTO) | This API never returns the error code in the path. | no | | [`CONTEGGIO_CAMBIATO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/CONTEGGIO_CAMBIATO) | The number of products to withdraw changed since your dry run: nothing was withdrawn. | yes | | [`COORDINATE_BANCARIE_ASSENTI`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/COORDINATE_BANCARIE_ASSENTI) | `bank_transfer` is enabled but the shop has no bank details. | no | | [`CORPO_NON_JSON`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/CORPO_NON_JSON) | The request body is not valid JSON. | no | | [`CORPO_NON_VALIDO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/CORPO_NON_VALIDO) | The JSON body does not have the shape this operation expects. | no | | [`CORPO_TROPPO_GRANDE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/CORPO_TROPPO_GRANDE) | The request body is larger than this operation accepts: 1 MiB, or 16 MiB for `POST /v1/catalog/imports`. | no | | [`CUSTOMER_REF_NON_VALIDO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/CUSTOMER_REF_NON_VALIDO) | `customer_ref` is missing or malformed. | no | | [`DATA_NON_VALIDA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/DATA_NON_VALIDA) | A date is missing, malformed or not plausible. | no | | [`DATE_INVERTITE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/DATE_INVERTITE) | The offer ends before it starts. | no | | [`DB_URL_ASSENTE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/DB_URL_ASSENTE) | This API instance is not fully configured. | yes | | [`DIPENDENZA_NON_DISPONIBILE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/DIPENDENZA_NON_DISPONIBILE) | A service this operation depends on is temporarily unavailable. | yes | | [`DISPONIBILITA_NON_VALIDA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/DISPONIBILITA_NON_VALIDA) | `available` is not a boolean. | no | | [`DURATA_NON_VALIDA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/DURATA_NON_VALIDA) | `expires_in` is not a whole number of seconds between 30 and 600. | no | | [`ELEMENTO_NON_OGGETTO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/ELEMENTO_NON_OGGETTO) | A batch item is not a JSON object. | no | | [`EMAIL_NON_VALIDA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/EMAIL_NON_VALIDA) | The `email` is not an email address. | no | | [`ENERGIA_NON_COERENTE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/ENERGIA_NON_COERENTE) | Warning: `energy_kj` and `energy_kcal` do not match (1 kcal = 4.184 kJ). | no | | [`ERRORE_INTERNO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/ERRORE_INTERNO) | Something failed on our side. | yes | | [`ETA_MANCANTE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/ETA_MANCANTE) | `rescheduled` needs the new delivery window in `eta`. | no | | [`ETA_NON_AMMESSA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/ETA_NON_AMMESSA) | `eta` is not allowed with this status. | no | | [`EXTERNAL_REF_MANCANTE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/EXTERNAL_REF_MANCANTE) | The customer has no `external_ref`. | no | | [`EXTERNAL_REF_TROPPO_LUNGO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/EXTERNAL_REF_TROPPO_LUNGO) | The `external_ref` is longer than 128 characters. | no | | [`EXTRA_SENZA_CRITERIO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/EXTRA_SENZA_CRITERIO) | A heavy-goods extra has no criterion saying when it applies. | no | | [`FEED_NON_CONFIGURATO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/FEED_NON_CONFIGURATO) | No catalog feed is configured for this environment. | no | | [`FEED_URL_NON_AMMESSO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/FEED_URL_NON_AMMESSO) | The feed URL is not allowed. | no | | [`FORMATO_NON_AMMESSO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/FORMATO_NON_AMMESSO) | The feed format is not one of those supported. | no | | [`FRASE_NON_MODIFICABILE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/FRASE_NON_MODIFICABILE) | This phrase cannot be customised. | no | | [`GIACENZA_NON_VALIDA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/GIACENZA_NON_VALIDA) | `stock_qty` is not a non-negative number. | no | | [`GIORNI_NON_VALIDI`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/GIORNI_NON_VALIDI) | A number of days is outside its allowed range. | no | | [`GRADINI_NON_IN_ORDINE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/GRADINI_NON_IN_ORDINE) | Discount tiers are not in increasing order. | no | | [`GTIN_NON_VALIDO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/GTIN_NON_VALIDO) | The `gtin` is not a valid GTIN/GS1 barcode. | no | | [`IBAN_NON_VALIDO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/IBAN_NON_VALIDO) | The IBAN is not valid. | no | | [`IDEMPOTENCY_KEY_MANCANTE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/IDEMPOTENCY_KEY_MANCANTE) | This operation writes data and needs an `Idempotency-Key` header. | no | | [`IDEMPOTENCY_KEY_RIUSATA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/IDEMPOTENCY_KEY_RIUSATA) | This `Idempotency-Key` was already used for a different request. | no | | [`IDEMPOTENCY_KEY_TROPPO_LUNGA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/IDEMPOTENCY_KEY_TROPPO_LUNGA) | The `Idempotency-Key` is longer than 255 characters. | no | | [`IDENTITA_DI_UN_ALTRO_AMBIENTE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/IDENTITA_DI_UN_ALTRO_AMBIENTE) | Chat session: the identity token belongs to the other environment (test vs live). | no | | [`IDENTITA_FUORI_DAL_NEGOZIO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/IDENTITA_FUORI_DAL_NEGOZIO) | Chat session: the identity token belongs to another shop. | no | | [`IDENTITA_GIA_USATA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/IDENTITA_GIA_USATA) | Chat session: the identity token was already used. | no | | [`IDENTITA_MALFORMATA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/IDENTITA_MALFORMATA) | Chat session: the `identity_token` is not shaped like a GroceryAI identity token. | no | | [`IDENTITA_NON_IN_SERVIZIO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/IDENTITA_NON_IN_SERVIZIO) | Chat identity is not in service on this instance yet. | yes | | [`IDENTITA_SCADUTA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/IDENTITA_SCADUTA) | Chat session: the identity token expired. | no | | [`IDENTITA_SCONOSCIUTA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/IDENTITA_SCONOSCIUTA) | Chat session: the identity token does not exist. | no | | [`IDENTITA_SOLO_NEGOZI_NATIVI`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/IDENTITA_SOLO_NEGOZI_NATIVI) | This shop does not use GroceryAI for customer identity: the website chat stays anonymous. | no | | [`IMPORTAZIONE_SCONOSCIUTA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/IMPORTAZIONE_SCONOSCIUTA) | No catalog import with this `import_id` exists for this account and environment. | no | | [`IMPORTAZIONI_IN_CORSO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/IMPORTAZIONI_IN_CORSO) | There are already 5 unfinished catalog imports in this environment. | yes | | [`IMPORTO_INCOERENTE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/IMPORTO_INCOERENTE) | `delivered_amount` contradicts the status. | no | | [`IMPORTO_MANCANTE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/IMPORTO_MANCANTE) | `delivered_amount` is required for this status. | no | | [`IMPORTO_NON_VALIDO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/IMPORTO_NON_VALIDO) | An amount is not a valid non-negative number. | no | | [`INFORMAZIONI_ALIMENTARI_INCOERENTI`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/INFORMAZIONI_ALIMENTARI_INCOERENTI) | Two food-information fields of the item contradict each other. | no | | [`IP_NON_AMMESSO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/IP_NON_AMMESSO) | This key has an IP allowlist, and the request does not come from an address on it. | no | | [`ISTANTANEA_CHIUSA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/ISTANTANEA_CHIUSA) | The snapshot is already committed and accepts no more batches. | no | | [`ISTANTANEA_SCADUTA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/ISTANTANEA_SCADUTA) | The snapshot expired (snapshots live 24 hours). | no | | [`ISTANTANEA_SCONOSCIUTA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/ISTANTANEA_SCONOSCIUTA) | No snapshot with this `snapshot_id` exists for this account and environment. | no | | [`ISTANTANEA_SOTTO_SOGLIA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/ISTANTANEA_SOTTO_SOGLIA) | The batches of this snapshot cover too few of the active products: nothing was withdrawn. | no | | [`LIMITE_RICHIESTE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/LIMITE_RICHIESTE) | Too many requests for this key in the current minute. | yes | | [`LINGUA_NON_VALIDA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/LINGUA_NON_VALIDA) | `lang` is not a language code. | no | | [`LINK_NELLA_FRASE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/LINK_NELLA_FRASE) | The phrase contains a link. | no | | [`LOTTO_TROPPO_GRANDE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/LOTTO_TROPPO_GRANDE) | The batch has more items than this operation accepts: 500 per call, or 50,000 for `POST /v1/catalog/imports`. | no | | [`LOTTO_VUOTO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/LOTTO_VUOTO) | The batch list is empty. | no | | [`METODO_DI_PAGAMENTO_NON_AMMESSO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/METODO_DI_PAGAMENTO_NON_AMMESSO) | A payment method is not one of those supported. | no | | [`METODO_NON_AMMESSO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/METODO_NON_AMMESSO) | The path exists, but not with this HTTP method. | no | | [`MOTIVO_NON_VALIDO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/MOTIVO_NON_VALIDO) | `reason` is not one of the allowed codes, or not allowed with this status. | no | | [`NESSUN_CAMPO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/NESSUN_CAMPO) | The inventory item changes nothing. | no | | [`NESSUN_METODO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/NESSUN_METODO) | No payment method is enabled. | no | | [`NON_TROVATO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/NON_TROVATO) | The resource in the path does not exist for this account and this key's environment. | no | | [`NOTA_TROPPO_LUNGA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/NOTA_TROPPO_LUNGA) | The note is longer than 500 characters. | no | | [`NUMERO_NON_VALIDO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/NUMERO_NON_VALIDO) | A numeric field is not a valid number for its range. | no | | [`NUTRIZIONE_INCOMPLETA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/NUTRIZIONE_INCOMPLETA) | Warning: the item carries part of the nutrition declaration but not all of it. | no | | [`OFFERTA_NON_SCONTATA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/OFFERTA_NON_SCONTATA) | Warning: the offer price is not below the regular price, so it will not be shown as an offer. | no | | [`OFFERTA_SUPERIORE_AL_PREZZO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/OFFERTA_SUPERIORE_AL_PREZZO) | The offer price is higher than the regular price. | no | | [`ORARI_NON_VALIDI`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/ORARI_NON_VALIDI) | The opening or assistant hours are not valid. | no | | [`ORDINE_MANCANTE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/ORDINE_MANCANTE) | The order line has no `order_ref`. | no | | [`ORDINE_SENZA_CLIENTE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/ORDINE_SENZA_CLIENTE) | The order line does not say who the customer is. | no | | [`OUTBOX_ASSENTE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/OUTBOX_ASSENTE) | The event log is not in service on this instance yet. | yes | | [`PACCHETTO_ASSENTE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/PACCHETTO_ASSENTE) | The shop has no language pack yet, so the preview cannot be rendered. | yes | | [`PARAMETRO_NON_VALIDO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/PARAMETRO_NON_VALIDO) | A query parameter is outside its allowed values. | no | | [`PERCENTUALE_NON_VALIDA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/PERCENTUALE_NON_VALIDA) | A percentage is outside its allowed range. | no | | [`PERCORSO_NON_VALIDO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/PERCORSO_NON_VALIDO) | A site path is not valid. | no | | [`PESO_MEDIO_SENZA_PESO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/PESO_MEDIO_SENZA_PESO) | Warning: an average piece weight was sent for a product not sold by weight; it is not used. | no | | [`PREZZO_NON_VALIDO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/PREZZO_NON_VALIDO) | The price is not a non-negative number. | no | | [`PUNTO_VENDITA_CON_ZONE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/PUNTO_VENDITA_CON_ZONE) | This store cannot be deactivated or removed while delivery zones use it. | no | | [`PUNTO_VENDITA_SCONOSCIUTO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/PUNTO_VENDITA_SCONOSCIUTO) | No active store has this `store_code`. | no | | [`QUANTITA_NON_VALIDA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/QUANTITA_NON_VALIDA) | `quantity` is missing or not greater than zero. | no | | [`REGISTRO_ASSENTE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/REGISTRO_ASSENTE) | The order register is not in service on this instance yet. | yes | | [`REGOLA_SCONOSCIUTA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/REGOLA_SCONOSCIUTA) | A rule or text key is not one this API knows. | no | | [`REGOLE_SOLO_NEGOZI_DEL_PORTALE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/REGOLE_SOLO_NEGOZI_DEL_PORTALE) | This shop does not manage its rules and texts through GroceryAI. | no | | [`RICHIESTA_IN_CORSO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/RICHIESTA_IN_CORSO) | A request with the same `Idempotency-Key` is still being processed. | yes | | [`RIFIUTATA_DAL_DATABASE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/RIFIUTATA_DAL_DATABASE) | The database refused this item. | no | | [`ROTTA_SCONOSCIUTA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/ROTTA_SCONOSCIUTA) | No operation exists for this method and path. | no | | [`SEGNAPOSTO_DIVERSI`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/SEGNAPOSTO_DIVERSI) | The phrase does not keep the same placeholders as the original. | no | | [`SKU_MANCANTE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/SKU_MANCANTE) | The item has no `sku`. | no | | [`SKU_RIPETUTO_NEL_LOTTO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/SKU_RIPETUTO_NEL_LOTTO) | The same `sku` appears twice in one batch. | no | | [`SKU_SCONOSCIUTO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/SKU_SCONOSCIUTO) | No product with this `sku` exists for this account and environment. | no | | [`SKU_TROPPO_LUNGO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/SKU_TROPPO_LUNGO) | The `sku` is longer than 128 characters. | no | | [`SOGLIA_SOTTO_IL_COSTO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/SOGLIA_SOTTO_IL_COSTO) | A zone's free-delivery threshold is below its delivery fee. | no | | [`STATO_NON_MISURABILE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/STATO_NON_MISURABILE) | The service status cannot be read right now: the status is unknown, not operational. | yes | | [`STATO_NON_VALIDO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/STATO_NON_VALIDO) | The `status` is missing or not one of the allowed values. | no | | [`STORICO_SOLO_NEGOZI_NATIVI`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/STORICO_SOLO_NEGOZI_NATIVI) | This shop reads its order history from its own connector, not from this route. | no | | [`TELEFONO_NON_E164`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/TELEFONO_NON_E164) | The phone number is not in international E.164 format. | no | | [`TENANT_NON_DELLA_CHIAMATA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/TENANT_NON_DELLA_CHIAMATA) | The body refers to a different account than the key's. | no | | [`TENANT_SOSPESO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/TENANT_SOSPESO) | The account that owns this key is not active. | no | | [`TERMINE_NON_VALIDO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/TERMINE_NON_VALIDO) | A term or time window is not valid. | no | | [`TESTO_TROPPO_LUNGO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/TESTO_TROPPO_LUNGO) | A text field is longer than allowed. | no | | [`TITLE_MANCANTE`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/TITLE_MANCANTE) | The new product has no `title`. | no | | [`TITLE_TROPPO_LUNGO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/TITLE_TROPPO_LUNGO) | The `title` is longer than 512 characters. | no | | [`TOTALE_NON_VALIDO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/TOTALE_NON_VALIDO) | `order_total` is not a non-negative number. | no | | [`TRANSIZIONE_NON_AMMESSA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/TRANSIZIONE_NON_AMMESSA) | The order already has an outcome: a progress status is no longer recorded. | no | | [`TROPPI_ELEMENTI`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/TROPPI_ELEMENTI) | A list has more items than allowed. | no | | [`UNITA_NON_AMMESSA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/UNITA_NON_AMMESSA) | A unit field has a value that is not allowed. | no | | [`URL_NON_AMMESSO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/URL_NON_AMMESSO) | `tracking_url` is not an `https` address on a tracking domain the shop declared. | no | | [`VALORE_NON_AMMESSO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/VALORE_NON_AMMESSO) | A field has a value outside its allowed list. | no | | [`VALORE_RIPETUTO`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/VALORE_RIPETUTO) | The same value appears twice where values must be unique. | no | | [`VALUTA_DIVERSA_DAL_TENANT`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/VALUTA_DIVERSA_DAL_TENANT) | The item's currency differs from the shop currency. | no | | [`VALUTA_NON_VALIDA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/VALUTA_NON_VALIDA) | `currency` is not an ISO 4217 code. | no | | [`VERSIONE_CAMBIATA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/VERSIONE_CAMBIATA) | The rules changed since the version you read: nothing was saved. | yes | | [`ZONA_NON_VALIDA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/ZONA_NON_VALIDA) | A delivery zone entry is malformed. | no | | [`ZONA_SCONOSCIUTA`](https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/ZONA_SCONOSCIUTA) | A delivery zone is not one of the shop's zones. | no | Full catalog as JSON: `GET https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors` (no key needed). _Generated from the OpenAPI document by `tools/genera-openapi.mjs`: do not edit by hand._ ### GroceryAI API · integration guide The complete reference, route by route, is the OpenAPI 3.1 document (`openapi.json`): response shapes, the error codes of every status (`x-error-codes`) and the events (`webhooks`). This guide explains the rules that hold for every route. The examples in `examples/` are tested on every run against the platform's code. The OpenAPI document is in English, can be downloaded **without a key** (`GET /v1/openapi.json`, with `ETag` and `Cache-Control`) and has a tested request and response example for every operation. Every error response carries `error.doc_url`, the page of its code (what it means, how to fix it): the whole catalog is `GET /v1/errors`, also without a key. To start: `quickstart.md`; for coding agents: `AGENTS.md` and the ready prompt `agent-prompt.md`. Base URL: `https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api` followed by the path (`/v1/products`…). Every response carries `x-request-id` (the same value is `request_id` in the body) and `x-core-version`: if you write to us, send the `request_id`. #### 1. Keys and authentication Every call carries `Authorization: Bearer `. You create keys in the portal (Developers → API keys) and see them **once**: copy the key somewhere safe straight away. | | | |---|---| | shape | `gai__<8-char prefix>_<32-char secret><6-char checksum>`, e.g. `gai_test_ab12cd34_…`. The last 6 characters are the **checksum** (CRC32 of everything before them, in base 62 `0-9A-Za-z`): a truncated or mistyped key can be recognised without calling us, and our gateway refuses it before any lookup (`401 CHIAVE_SOMMA_ERRATA`). Keys created before 5 November 2026 have 32 characters after the prefix, without checksum, and keep working: roll them whenever you want the checksum | | prefix | `gai_test_ab12cd34` is public: you see it in the portal and in the activity log; on its own it opens nothing | | environment | `test` or `live`. It separates the **data**, not just the label: a `test` key only sees test catalogue, customers and orders, a `live` key only real ones | | scopes | `catalog:read`, `catalog:write`, `customers:read`, `customers:write`, `orders:read`, `orders:write`, `chat:write` (opening chat sessions from your server). None includes another: `catalog:write` does not let you read the catalogue | | publishable key | `gai_pk_…` is for the chat on your website and has no scopes: on this API it gets `403 AMBITO_MANCANTE` | | allowed IP addresses | optional, per key (portal → the key → «Allowed IP addresses»): CIDR networks or single addresses, at most 50. A call from outside the list, or whose origin address we do not know, gets `403 IP_NON_AMMESSO`. Without a list the key works from anywhere | | key for an AI agent | optional, per key: operations that remove or cancel something wait for a person at the shop to approve them (§11) | A key that does not open gets `401` with a precise code: `CHIAVE_ASSENTE` (missing), `CHIAVE_MALFORMATA` (malformed), `CHIAVE_SOMMA_ERRATA` (wrong checksum), `CHIAVE_SCONOSCIUTA` (unknown), `CHIAVE_REVOCATA` (revoked), `CHIAVE_SCADUTA` (expired), `CHIAVE_INCOERENTE` (prefix does not match the key). A store that is not active gets `403 TENANT_SOSPESO`; a key without the route's scope `403 AMBITO_MANCANTE`; a key used from an address its allowlist does not admit `403 IP_NON_AMMESSO`. #### 2. Errors One shape, on every route and for every error, ours or yours: ```json { "error": { "type": "richiesta_non_valida", "code": "PARAMETRO_NON_VALIDO", "message": "`limit` deve essere un intero fra 1 e 200.", "param": "limit" }, "request_id": "6f1c…" } ``` - **`code`** is what you program against: the possible values for every route and status are in `x-error-codes` in the document. Codes are stable identifiers (in Italian, like the rest of the platform's vocabulary). - **`type`** is the family and depends only on the HTTP status: 400 and 405 `richiesta_non_valida`, 401 `autenticazione`, 403 `autorizzazione`, 404 `non_trovato`, 409 `conflitto`, 413 `troppo_grande`, 429 `limite_richieste`, 503 `servizio_non_disponibile`, other 5xx `errore_interno`. - **`message`** is for humans and may change; **`param`** is there when the error concerns a field or a parameter. - A path that does not exist is `404 ROTTA_SCONOSCIUTA`; an existing path with the wrong method is `405 METODO_NON_AMMESSO`. The key is checked before the path: without a valid key you get the `401`. - A `5xx` never carries internal details: the `request_id` is enough for us to find it. #### 3. Idempotency Every call that writes (`PUT /v1/products`, `PUT /v1/inventory`, `PUT /v1/customers`, the `POST …/ack`) requires an `Idempotency-Key` header: a value of yours, at most 255 characters. Without it: `400 IDEMPOTENCY_KEY_MANCANTE`. - Same key, same body: you get **the same response** (status, body and `request_id` of the first time) with `idempotent-replayed: true`, and nothing runs again. So you can safely repeat a call whose response you did not see (dropped connection, timeout). - Same key, different body: `409 IDEMPOTENCY_KEY_RIUSATA`. - Same key while the first call is still running: `409 RICHIESTA_IN_CORSO`; retry in a few seconds. - A key is scoped **to the store and the environment** (across all API keys of the same environment): the same key used first with a `test` key and then with a `live` one runs in `live`, without replaying the test response. **It expires after 24 hours**: from then on the same key runs again. Use a new value for every distinct operation (a UUID, or an id from your system such as `ack-`). - The outcome of a call that failed after being accepted is recorded too (a `404` on the ack of an order that does not exist, a `5xx`): repeating it with the same key gives you that outcome again, marked `idempotent-replayed`. To really retry, use a new key. Errors that happen earlier (API key, scopes, rate limit, body not JSON or too large, `Idempotency-Key` missing or too long) do not consume the key. #### 4. Limits | | | |---|---| | requests | per API key, according to the **store's plan** (table below): a sustained rate per second and a burst the bucket absorbs. A key may have its own, lower, per-minute cap. Beyond: `429 LIMITE_RICHIESTE` with `Retry-After`. Every response says what is left: `RateLimit` (below) | | body | at most 1 MiB (16 MiB for `POST /v1/catalog/imports`): beyond, `413 CORPO_TROPPO_GRANDE` | | batches | at most 500 items per call (50,000 for `POST /v1/catalog/imports`, §8-bis): beyond, `400 LOTTO_TROPPO_GRANDE`; an empty list is `400 LOTTO_VUOTO` | | imports | at most 5 unfinished per environment: beyond, `409 IMPORTAZIONI_IN_CORSO` | ##### Limits per plan | plan | `test` keys | `live` keys | |---|---|---| | trial (no plan) | 5 per second, burst 120 | 5 per second, burst 120 | | `small` | 10 per second, burst 120 | 25 per second, burst 250 | | `mid` | 25 per second, burst 250 | 50 per second, burst 500 | | `enterprise` | 25 per second, burst 250 | 100 per second, burst 1000 | The limit is counted with one **bucket** per key: it fills at the plan's rate up to the burst, and every request takes one token. A back-office system that sends 250 requests in a row with a `small` live key sees them all pass, then goes on at 25 per second; a refused request does not use up tokens. A contract can set a limit for the store other than the plan's (written by us, never implicit). A key minted with `rate_limit_per_min` also has its own per-minute cap, which counts only when it is lower than the plan; without it, the key follows the plan. `test` keys have lower limits than `live` ones, as in the sandboxes of the large providers: load tests do not belong in `test`. ##### What is left: `RateLimit-Policy` and `RateLimit` Every response of a keyed route carries two headers in the form of the IETF draft `draft-ietf-httpapi-ratelimit-headers` (version -11, 23 May 2026), so you slow down **before** the `429` instead of finding the ceiling by hitting it: ``` RateLimit-Policy: "key";q=25;w=1;burst=250 RateLimit: "key";r=249;t=1 ``` - `q` is the plan's sustained rate, in requests per second, `w=1` a one-second window, `burst` the burst (the requests that pass in a row when the bucket is full). - `r` is the number of requests you can make **now**, in a row, **this one already counted** (the tokens in the bucket); `t` the seconds to the next token. Every counted request lowers `r` by one, a replay with the same `Idempotency-Key` included. - If the key has its own per-minute cap the lists carry a second item, `"key-minute";q=;w=60` and `"key-minute";r=;t=`: the stricter of the two applies. - With `r=0` the next request before `t` seconds receives `429`, which carries `r=0` and a `Retry-After` **equal** to the `t` of the policy that refused it. - 401, 403 and the 404/405 of a path that does not exist come before the count and do not carry them; neither do the routes without a key (`/v1/openapi.json`, `/v1/errors`, `/v1/status`). The limit is per key: two keys of the same store have two buckets. - A positive `r` is not a guarantee (the draft, §8.3): a `429` must be handled anyway. - The **official SDKs** do it for you: with `r=0` they wait `t` seconds before the next request, and still retry a `429` after `Retry-After` (`docs/api/sdk.md`; turn it off with `throttle: false`). The **MCP server** carries the same two headers, from the same count, in one-minute windows on the plan's equivalent cap (`docs/api/mcp.en.md`, «Limits»). A client that slows down by itself (Node, `fetch`; our test bench runs this example against the real headers): ```js // How long to wait before the next request, read from the previous response. function attesaMs(risposta) { let attesa = 0; // no declared limit (route without a key, 401, 403): go on // One item per policy: the plan's bucket ("key") and, if there is one, the key's per-minute cap ("key-minute"). for (const m of (risposta.headers.get('ratelimit') ?? '').matchAll(/;r=(\d+);t=(\d+)/g)) { const restano = Number(m[1]), secondi = Number(m[2]); if (restano === 0) attesa = Math.max(attesa, secondi * 1000); // quota used up: wait t else if (restano < 10) attesa = Math.max(attesa, Math.ceil((secondi * 1000) / restano)); // almost used up: spread what is left } return attesa; // the strictest policy wins } ``` In a batch an invalid item **does not sink** the batch: the response says how many arrived, how many were written and which were rejected, with position and reason. ```json { "received": 3, "written": 2, "rejected": 1, "errors": [{ "index": 1, "id": "SKU-9", "code": "GTIN_NON_VALIDO", "message": "…" }], "request_id": "…" } ``` `index` is the position in your batch (from 0); it is `null` when the database rejected the item after validation (`RIFIUTATA_DAL_DATABASE`). On `PUT /v1/inventory` an SKU that does not exist is `SKU_SCONOSCIUTO`: no half product is created. Prices are loaded in the store's currency: another currency is `VALUTA_DIVERSA_DAL_TENANT`, never converted. #### 5. Pagination - **Catalogue** (`GET /v1/products`): sorted by `sku`; `limit` from 1 to 200 (50 by default); ask for the next page with `cursor` = the previous `next_cursor`. `next_cursor` is present only when there really is another page: on the last one, even a full one, it is `null` and the loop ends with no extra call. Filters: `sku`, `gtin`. - **Orders and support requests** (`GET /v1/orders`, `GET /v1/support_requests`): oldest first, `limit` from 1 to 200. There is no cursor: the queue moves forward with the **ack**. `status=new` (default) returns what you have not acknowledged yet, `status=acked` what you have. #### 6. Events by webhook When a customer confirms an order (`order.confirmed`) or asks for a member of staff (`support.requested`), or when the store reports where an order stands (`order.updated`, section 7-bis), the platform sends a signed `POST` to every endpoint of the store subscribed to that event. The portal's "Send a test event" button sends a `webhook.ping` (environment `test`) to the endpoint under test only. Deliveries follow **Standard Webhooks** (specification 1.0.0, https://www.standardwebhooks.com): the official library for your language verifies them as they are, with nothing of ours to copy. The body is always the same envelope: ```json { "id": "2b1e…", "type": "order.confirmed", "environment": "live", "timestamp": "2026-10-13T09:00:00.000Z", "occurred_at": "2026-10-13T09:00:00.000Z", "resource_id": "ORD-1042", "attempt": 1, "data": { "schema_version": 2, "order": { … } } } ``` `data` depends on the type; the exact shapes are in the document (`webhooks`, schemas `OrdineConfermato`, `RichiestaAssistenza`, `OrdineAggiornato`, `Ping`). `environment` tells a test from a real event: the endpoints are the same. `timestamp` (the Standard Webhooks field) and `occurred_at` are the same instant: when the fact happened, not when it was delivered. ##### Verifying the signature Every delivery carries the three Standard Webhooks headers: | header | | |---|---| | `webhook-id` | the message id: the event `id`, the same on every attempt and on every redelivery | | `webhook-timestamp` | Unix seconds of this attempt (it changes on every retry) | | `webhook-signature` | `v1,`, the HMAC-SHA256 of `..`; two of them, separated by a space, while a secret rotation is in progress | Verify with the official library (`npm install standardwebhooks`, `pip install standardwebhooks`), passing the **raw body** (the exact bytes received: parsing and re-serialising the JSON changes them) and the secret exactly as the portal showed it, `whsec_` included: ```js import { Webhook } from 'standardwebhooks'; const wh = new Webhook(process.env.GAI_WEBHOOK_SECRET); // "whsec_..." app.post('/webhooks', express.raw({ type: 'application/json' }), (req, res) => { let event; try { event = wh.verify(req.body.toString('utf8'), req.headers); } // throws if forged, altered or stale catch { return res.status(400).end(); } res.status(200).end(); // answer within 15 seconds, work afterwards // drop duplicates by req.headers['webhook-id'] (= event.id), then handle event.type }); ``` ```python from standardwebhooks.webhooks import Webhook, WebhookVerificationError wh = Webhook(os.environ["GAI_WEBHOOK_SECRET"]) # "whsec_..." def webhooks(): # Flask; any framework works try: event = wh.verify(request.get_data(as_text=True), dict(request.headers)) except WebhookVerificationError: return "", 400 # drop duplicates by request.headers["webhook-id"] (= event["id"]), then handle event["type"] return "", 200 app.add_url_rule("/webhooks", view_func=webhooks, methods=["POST"]) ``` The library rejects a `webhook-timestamp` more than **300 seconds** away from your clock: a genuine delivery captured and replayed later fails there, even with the right signature. The secret is `whsec_` followed by the base64 of 32 random bytes; the HMAC key is the decoded bytes. Complete, tested receivers: `examples/verify-standardwebhooks.mjs` and `examples/verify_standardwebhooks.py` (official libraries); `examples/verify-signature.mjs` and `examples/verify_signature.py` do the same with no dependency at all, for a runtime where you cannot add one. ##### Rotating the secret Through the portal (`POST /organizations/{org}/webhooks/{endpoint_id}/rotate-secret` with `{"overlap_hours": 0-72}`) the endpoint gets a new secret, shown once. For `overlap_hours` the old one stays valid too: every delivery carries **two** signatures, the new and the old, and the library accepts either. Put the new secret in your configuration within that window; `0` invalidates the old one at once (for a leaked secret). ##### Responding and retries - Answer `2xx` **within 15 seconds** and do the work afterwards. Any other answer (a redirect included: it is not followed), or no answer in time, is a failed attempt. - There are ten attempts: the first within about a minute of the event, then each one after the previous by 1 minute, 5 minutes, 30 minutes, 2 hours, 5 hours, 10 hours, 14 hours, 20 hours and 24 hours (a little over three days in all), each delay varied by up to 10 % so that endpoints that failed together are not retried in the same second. A `Retry-After` header in your answer makes us wait longer (up to a day for that attempt), never shorter. After the tenth the delivery is abandoned; you see it in the portal (Developers → Webhooks → Deliveries), where you can send it again. - `410 Gone` means "stop": the endpoint is **deactivated** at once (the portal's list of endpoints says why: `disabled_reason: "http_410"`) and receives nothing more until you create it again. Every other `4xx` is retried like a `5xx`: an endpoint that answers `401` because it does not have the new secret yet loses nothing. - Every attempt is signed again, with its own `webhook-timestamp` and `attempt`; `webhook-id`, `id` and `data` do not change. - The same event can reach you more than once (a retry after a `2xx` we never received, a delivery resent from the portal): drop duplicates by `webhook-id`. - The secret is shown once, when the endpoint is created or rotated. An endpoint deactivated and then reactivated gets a **new** secret. #### 7. Pull If you do not want an inbound endpoint, take orders and requests when you choose: `GET /v1/orders?status=new` (scope `orders:read`), save them, and acknowledge with `POST /v1/orders/{order_id}/ack` (scope `orders:write`, with `Idempotency-Key`). The same for `GET /v1/support_requests` and `POST /v1/support_requests/{support_id}/ack`. - You only see what belongs to your key's environment. - Every item carries `event_id` (the same `id` as the webhook), the identifier to pass to the ack, `payload` (the same `data` as the webhook), `occurred_at` and `created_at`, and `stato` (`in_attesa`, "pending", until you acknowledge, then `consegnato`, "delivered", with `consegnato_at`). - Acknowledging twice is not an error. Until you acknowledge, the item comes back on every read: save by id, idempotently, and if you crash between saving and acknowledging you will see it again instead of losing it. - Orders older than 11 October 2026 follow version 1 of the contract: no `schema_version`, and the customer only has `chatId`. Complete, tested example: `examples/pull-orders.mjs`. #### 7-bis. Where the order stands, and how it went After the ack, your system tells GroceryAI what happens to the order with **one call**, the same for its whole life: `POST /v1/orders/{order_id}/status` (scope `orders:write`, with `Idempotency-Key`). `status` is a code: - **progress**, before the outcome: `preparing`, `ready` (also for pickup), `out_for_delivery`, `delayed`, `rescheduled` (moved to a new window); - **outcome**: `delivered`, `substituted` (with substitutions or missing items, with `delivered_amount`), `not_delivered`, `returned`. The outcome is what counts for billing, and the last one reported wins; progress never touches it. ```json { "status": "out_for_delivery", "eta": { "start": "2026-11-06T17:00:00Z", "end": "2026-11-06T18:00:00Z" }, "tracking_url": "https://tracking.example-carrier.com/t/ORD-1042" } ``` - `eta` is the expected or agreed window: **required** with `rescheduled` (`400 ETA_MANCANTE`), optional with `out_for_delivery` and `delayed`, not allowed with other statuses (`400 ETA_NON_AMMESSA`); the end after the start, at most 24 hours later, the start within 30 days (`400 DATA_NON_VALIDA`). - `reason` is a code, never a text: `stock`, `capacity`, `traffic`, `weather`, `customer_request`, `shop_request`, `failed_attempt`, `other`; only with `delayed`, `rescheduled` and `not_delivered` (`400 MOTIVO_NON_VALIDO`). The customer reads the sentence in their language. - `tracking_url` is `https` on a tracking domain declared for the store (`400 URL_NON_AMMESSO`); for a new carrier ask support to declare its domain. - `delivered_amount` goes only with an outcome (`400 IMPORTO_INCOERENTE` with progress). - After an outcome progress is no longer recorded: `409 TRANSIZIONE_NON_AMMESSA`. Another outcome is (the last one wins). - Between two progress reports the most recent by `reported_at` wins, not the last to arrive: an older one is kept and answers `superseded: true`, without an event. - The same status reported again (with another `Idempotency-Key`) answers `duplicate: true` and sends no second event. - With an agent key progress needs no person's approval; `not_delivered` and `returned` do (section 11). The response echoes what you sent, plus `kind` (`outcome` or `progress`). Every recorded report becomes the **`order.updated`** event for the subscribed endpoints (section 6): `resource_id` is the identifier of the report, the order is `data.order.id`, and the body carries no customer data and no amounts. `order.updated` is not available via pull. #### 8. Keeping the catalog up to date Prices change every day: these are the ways to keep the catalog true without reloading everything. - **Merge, by default.** `PUT /v1/products` updates only the fields an item names: an item with `sku`, `title` and `price` changes the price and leaves size, pieces, offer, brand and department as they were. `attributes` are merged with the stored ones; send a field as `null` to remove it. The same `sku` twice in one batch: the first one wins. - **The catalog contract fields** go in the item under their own name (`min_order_qty`, `min_order_unit`, `sold_by_weight`, `avg_piece_weight_kg`, `items_per_pack`, `pack_only`, `stock_managed`, `unit_price`, `gross_weight_kg`, `tare_kg`, `list_price`, `subcategory`, `description`, `vat_rate`, `diet_tags`, `offer_price`, `offer_start`, `offer_end`, `offer_min_qty`, `offer_label`; `is_online` is `available`) and are validated as in the portal file: an unreadable value stops only its item, with a `code` per field. - **Food information** (Article 14 of Regulation (EU) 1169/2011: for distance selling of prepacked food it must be available before the purchase) goes in optional fields of the same item: `allergens` (the 14 of Annex II with the codes `gluten`, `crustaceans`, `eggs`, `fish`, `peanuts`, `soybeans`, `milk`, `nuts`, `celery`, `mustard`, `sesame`, `sulphites`, `lupin`, `molluscs`, or the GS1 codes such as `AW`; `none` declares that there are none), `may_contain` (traces), `ingredients`, `nutrition_basis` (`100g` or `100ml`) with `energy_kj`, `energy_kcal`, `fat_g`, `saturated_fat_g`, `carbohydrate_g`, `sugars_g`, `protein_g`, `salt_g`, `fibre_g`, and `storage_conditions`, `usage_instructions`, `food_business_operator`, `origin`, `alcohol_percent`, `food_info_url` (the product page, if the information is on a page). An absent field means «not declared»: the assistant tells the customer so and never guesses an allergen. The batch response also carries `warnings`: the item is written, but something will not be used (an offer that is not a discount). - **Light updates of prices, stock and offers.** `PUT /v1/inventory` touches only what the item carries: `price`, `stock_qty`, `available`, the strike-through `list_price` and the offer (`offer_price`, `offer_start`, `offer_end`). `price` stays the full price; the offer applies within its dates, in the store's time zone, and ends by itself. - **Withdrawing a product.** `DELETE /v1/products/{sku}` switches it off, it does not delete it: the assistant no longer sells it, and orders that mention it stay readable. To put it back on sale, send it again with `PUT /v1/products`. - **"This is the whole catalog".** `POST /v1/products/snapshots` opens a snapshot; send the batches with `PUT /v1/products` and the `snapshot_id` in the body; then `POST /v1/products/snapshots/{snapshot_id}/commit` with `{"dry_run": true}` tells you how many active products the batches did not carry (`to_switch_off`) and the first 20; call it again with `{"expected_off": n}` and those are withdrawn. If the batches carried less than **90 %** of the active products, nothing is withdrawn (`409 ISTANTANEA_SOTTO_SOGLIA`) and the snapshot stays open: a truncated file does not empty the catalog. If the number changed between the dry run and the commit, `409 CONTEGGIO_CAMBIATO` and nothing is withdrawn. A snapshot lives 24 hours. - **The scheduled feed.** `PUT /v1/catalog/feed` with `{"url": "https://…", "format": "google_merchant_xml"}` (or `google_merchant_tsv`, `csv`, `xlsx`): we read it every `every_hours` hours (24 by default), with the same rules as the portal file. A Google Merchant or Meta Commerce product feed works as it is: `id`, `title`, `price`, `sale_price` with `sale_price_effective_date` (the offer dates), `availability`, `gtin`, `brand`, `product_type`, `unit_pricing_measure`, `link`, `image_link`. With `"mode": "snapshot"` the products the feed does not carry are withdrawn, with the 90 % gate. `POST /v1/catalog/feed/run` reads it now; `GET /v1/catalog/feed` reports the last run. The URL must be `https://` on a public host name. - **Freshness.** Declare how often you update (`PUT /v1/catalog/feed` with `{"declared_refresh_hours": 24}`, also without a feed); `GET /v1/catalog/freshness` returns the last update and `stale: true` when the catalog has not moved for more than twice that. #### 8-bis. The whole catalog at once: asynchronous imports A catalog of tens of thousands of products does not need eighty batches in a row: one call, and we do the work afterwards, in chunks. It is the design of Shopify's Bulk Operations: an operation with an id, a status to read, and the end as an event. 1. **Send the catalog** with `POST /v1/catalog/imports` and an `Idempotency-Key`, in one of three ways: - `{"products": [...], "mode": "delta"}`: up to **50,000** items, the same as `PUT /v1/products` (GS1 codes included), in a body of up to **16 MiB**; - the CSV of the portal file in the body, with `Content-Type: text/csv` (and `?mode=snapshot` in the query when it is the whole catalog); - `{"url": "https://…", "format": "jsonl"}`: the address of a file we read ourselves, with the guards of the feed (up to 40 MB). `format` is `json` (a list, or `{"products": [...]}`), `jsonl` (one product per line, like Shopify's files), `csv` or `xlsx` (the portal file), `google_merchant_xml` or `google_merchant_tsv`. 2. **The answer is an immediate `202`** with the import (`status: queued`, `id`) and a `Location` header, the address of its status. It starts within a minute. 3. **Read the status** with `GET /v1/catalog/imports/{import_id}` (once every 30 seconds is enough): `running` while it works (`chunks_done` out of `chunks_total`, and `written`, `rejected`, `warnings` grow), then `succeeded`, `partial` (rejected rows, or the snapshot gate that withdrew nothing: `error` says which) or `failed` (`error.code`: the address that does not answer, the unreadable file, no row written…). `GET /v1/catalog/imports` lists them. 4. **The end also arrives as the event** `catalog_import.completed` at the subscribed endpoints (§6), with the same numbers. As with Shopify, a webhook delivery can go missing: the status stays readable, always. 5. **The rejected rows, one by one**: `GET /v1/catalog/imports/{import_id}/errors` (`?type=warnings` for the warnings), in pages with `cursor`. Each row gives `index` (the position in `products`, from 0) or `row` (the row of the file, with the header on row 1), the `sku`, the `code` and the `field`. With `complete: true` the list is whole. The rules are the ones you know: merge by `sku` like `PUT /v1/products` (or the rules of the portal file for CSV, XLSX and feeds); the same `sku` twice in one import: the first one wins (`SKU_RIPETUTO_NEL_LOTTO`); with `"mode": "snapshot"` the active products the import does not carry are withdrawn at the end, behind the **90 %** gate (with an agent key it waits for a person's approval, §11). The same request with the same `Idempotency-Key` returns the same import, even after the 24 hours of the register; a different request with a used key is `409 IDEMPOTENCY_KEY_RIUSATA`. If a chunk cannot be written (the database does not answer) it is retried a minute later from the chunk where it stopped, never from the start; after five attempts its rows come back as `PEZZO_NON_SCRITTO` and the rest goes on. #### 9. The chat on your site for your signed-in customer On your site's chat the customer is anonymous: if they type a phone number nobody verifies it, so the chat does not open their history (it would show one person's purchases to whoever types their number). When the customer has **signed in to your site**, your server can vouch for them, and the chat becomes theirs: the same basket and conversation from one visit to the next, and their usual products (the history from `PUT /v1/order_history` and the orders placed in chat), as on WhatsApp. Load the customer first with `PUT /v1/customers` (`{"customers": [...]}`), with the names of `core.customers` (`external_ref`, `display_name`, `address`, `attributes`) or with those of the customers model of the specification (`customer_ref`, `full_name`, `street`, `house_number`, `city`, `postal_code`, `floor`, `intercom`, `delivery_notes`, `language`, `exemption`): the address fields go into `address` under their own name. The phone is international (`+44…`), or the row is rejected with `TELEFONO_NON_E164`. A field that belongs to neither list is not written, and the answer says so in `warnings` (`CAMPO_SCONOSCIUTO`); the same data in two places with two different values is `CAMPO_IN_DUE_POSTI`. 1. Your **server** asks for a token for that customer: `POST /v1/chat_identity_tokens` with your **secret** key and the `chat:write` scope, body `{"customer_ref": ""}` (optional `expires_in`, in seconds: 30 to 600, 300 by default). The customer must exist in the key's environment (`PUT /v1/customers`), or the answer is `404 CLIENTE_SCONOSCIUTO`. 2. The response carries `identity_token` (`gai_cid_test_…` or `gai_cid_live_…`), `expires_at` and `chat_id`. The token is shown only in this response: that is why the route does not use `Idempotency-Key`, and a repeated call mints another token with no further effect. `chat_id` is the customer's chat identity, **always the same**: it is the `customer.chatId` of the orders and support requests coming from their chat, so you can link them to your customer. 3. The **page** hands the token to the widget (`data-identity-token="…"` next to `data-site-key`): the widget sends it to `core-chat /session` as `identity_token`, with your publishable key. In server mode your server sends it to `/session` itself, with the secret key, and hands the `session_token` to the page. The token works **once** and for a few minutes, for your shop and for the environment of the key that minted it. Mint one when you render the page for that customer, and serve that page with `Cache-Control: private, no-store`: a cached page served to another visitor would carry a token already used, which opens nothing. Without a token `/session` answers as always. With one, the response also has `identity`: `{"status": "verified"}`, or `{"status": "not_verified", "code": …}` and the session starts **anonymous**, as today (the chat still works). The reasons: `IDENTITA_MALFORMATA` (not a token), `IDENTITA_SCONOSCIUTA` (nobody minted it, or another shop did), `IDENTITA_GIA_USATA` (already used), `IDENTITA_SCADUTA` (expired), `IDENTITA_DI_UN_ALTRO_AMBIENTE` (minted with the `test` key and used with the `live` one, or the other way round: it stays good for its own environment), `CLIENTE_SCONOSCIUTO` (the customer was removed meanwhile), `IDENTITA_FUORI_DAL_NEGOZIO` (the portal's test chat does not carry a customer), `IDENTITA_NON_IN_SERVIZIO`. Complete, tested server-side examples: `examples/chat-identity.mjs` (Node) and `examples/chat_identity.py` (Python). #### 10. Versions and deprecation What you build today must keep working tomorrow. The rules: - **The version is in the path**: `/v1`. `x-core-version` on responses tells which platform release answered, not the contract version: do not program against it. - **Within `/v1` we only make compatible changes**: new operations, new optional request parameters and fields, new response fields, new error codes, new values of free-text fields, new event types, the order of fields, the length of identifiers and the text of `error.message`. Your code must **ignore** what it does not know (a field, an event type, a code) instead of failing. The rule holds from 1 November 2026: before, some breaking changes entered `/v1` while the API had no integrator in production, and the changelog (`CHANGELOG.md`) lists all of them as such. - **Incompatible** is anything that can break a well-written integration: removing or renaming an operation, a field or a value of a closed list (`enum`), changing a type, making a field required that was optional, rejecting a value that used to be accepted, changing the meaning of a field or a code, changing the scope an operation requires, changing the webhook signature. We do not do it within `/v1`: it comes with a new path version (`/v2`), or by deprecating an operation and offering another one next to it. - **A deprecated operation keeps working as before for at least 12 months** from its deprecation date. You see it in three places: the OpenAPI document marks it `deprecated: true` with `x-deprecation` (dates and replacement operation); **every response** it gives, successful or not, carries the headers ``` Deprecation: @1793491200 Sunset: Thu, 31 Dec 2099 23:59:59 GMT Link: ; rel="deprecation" ``` where `Deprecation` (RFC 9745) is the deprecation date in seconds since the epoch after `@`, `Sunset` (RFC 8594) the date from which the operation may stop responding (never earlier than 12 months after the first), and `Link` the page that says what to use instead. A call rejected for its key (`401`) does not carry them: the route is not known yet. - **Notice**: on the day of the deprecation we email the shop owners (the account email in the portal) and publish the entry in the **changelog** (`CHANGELOG.md`), with the `Sunset` date and the replacement. A path version that retires (`/v1` once `/v2` exists) follows the same rules: 12 months, the same headers on every response, the same notice. - **The changelog** (`CHANGELOG.md`) lists, day by day since 7 September 2026, every change to the contract and whether it is compatible. To test your code that reads the headers there is a **test route**: `GET /v1/_deprecation_probe` with a `gai_test_…` key returns `200` with the three headers above and the same dates in the body (`deprecated_at`, `sunset_at`, `replacement`, `link`). It is not a feature of the API, does not touch your data and is never retired; with a `gai_live_…` key it returns `404 ROTTA_SCONOSCIUTA`. #### 11. Keys for an AI agent and a person's approval If you give the key to an AI agent (Claude Code, Codex, Cursor, an automation), create it in the portal with **«Key for an AI agent»**. The agent reads and writes as with any key, but operations that **remove or cancel** something do not run straight away: | operation | when it waits | |---|---| | `DELETE /v1/products/{sku}` | always | | `POST /v1/products/snapshots/{snapshot_id}/commit` | without `dry_run: true` (the dry run answers straight away) | | `POST /v1/orders/{order_id}/status` | with `status` = `not_delivered` or `returned` | 1. The agent calls the operation as usual and gets `202` with `data.id` (the approval), `data.status = "pending"` and `data.next` (what to do). **Nothing has changed.** Sending the same request again finds the same approval. 2. A person at the shop (owner or admin) sees it in the portal, **Developers → Approvals**, with the operation, the path and the data, and approves or rejects it. 3. The agent follows the status with `GET /v1/approvals/{approval_id}` (once a minute is enough). When it is `approved`, it sends **the same request** again (same method, path and body) with the header `GroceryAI-Approval-Id: `: the operation runs, once. You can reuse the `Idempotency-Key` of the first request. What can go wrong: `409 APPROVAZIONE_IN_ATTESA` (nobody has decided yet), `409 APPROVAZIONE_RIFIUTATA`, `409 APPROVAZIONE_SCADUTA` (72 hours without use: ask for a new one), `409 APPROVAZIONE_GIA_USATA`, `409 APPROVAZIONE_DIVERSA` (the request is not the approved one), `404 APPROVAZIONE_SCONOSCIUTA` (the id does not belong to this key). The approval is valid only for the key that requested it. A key that is not «for an AI agent» works as before, and the header is ignored. #### 12. Service status `GET /v1/status`, **without a key**, says how the service is doing now, component by component, and how it did: | component | what it is | |---|---| | `assistant` | the conversation that builds the cart and the order, on every channel | | `web_chat` | the chat on the shop's website | | `api` | this API (`/v1`) and the scheduled catalog feed | | `events` | webhooks, the pull queue and the order emails | | `portal` | the merchant portal | | `mcp` | the MCP server for AI agents | - `status`: `operational`; `degraded` (it answers, but part of the work fails: `5xx` responses, conversation turns with errors, abandoned or late deliveries, a stopped scheduled job); `outage` (it does not answer as it should to two probes in a row, one a minute); `unknown` (**not measured**: no probe, a probe that has not completed a round yet, or the measurement stopped). Never read `unknown` as up. - `measured_at`: the last measurement (once a minute). Older than 3 minutes means every component is `unknown`. - `availability.30d` / `availability.90d`: computed on **measured minutes only**, from `from`: each component counts from when its own probe started (24 October 2026; `mcp` from 5 November 2026), and `complete` is `false` until its history covers the whole window. `uptime_percent` counts `outage` minutes; `degraded` minutes are reported apart and do not lower it. - `incidents`: the latest (at most 50 in 90 days), with `started_at`, `last_seen_at` (the last minute the failure was seen) and `resolved_at` (an incident is resolved after 10 minutes without the failure). The answer contains no data about any shop. It changes at most once a minute: it is cached for 30 seconds and `If-None-Match` with the last `ETag` returns `304`. Poll it once a minute at most. If the status itself cannot be read the answer is `503 STATO_NON_MISURABILE`: the status is unknown, which says nothing about the other components. ### Endpoint reference The GroceryAI platform API, from your systems to ours: catalog, prices and stock, customers, order status (including what happened to an order after the shop took it: delivered, substituted, not delivered, returned). **Authentication**: one API key per account, sent as `Authorization: Bearer gai_live_…`. Keys have an environment (`test` or `live`) that separates the data, not just the labels, and scopes (catalog:read, catalog:write, customers:read, customers:write, orders:read, orders:write, chat:write, history:write, rules:read, rules:write, texts:read, texts:write). The plain value is shown only once. **Batches**: writes accept up to 500 items per call; each item is validated on its own and the rejected ones are listed in the response instead of failing the whole batch. **Idempotency**: every call that writes requires `Idempotency-Key`. Replaying it with the same body returns the same response without running it again. The key is scoped to the environment (`test` and `live` never see each other) and expires after 24 hours. **Traceability**: every response, successful or not, carries `request_id`. It is the only thing we ask for when you contact us. **Events**: confirmed orders and customer support requests reach the shop's endpoint as webhooks signed according to Standard Webhooks (see `webhooks`; https://www.standardwebhooks.com: verify them with the official library for your language), or are pulled (`GET /v1/orders`, `GET /v1/support_requests`) and acknowledged. **Errors**: a single format, `{"error": {"type", "code", "message", "param", "doc_url"}, "request_id"}`. Program against `code`; `doc_url` links to the code's page (what it means, how to fix it, whether retrying helps). The full catalog: `GET /v1/errors`. **No key needed**: this document (`GET /v1/openapi.json`) and the error catalog (`GET /v1/errors`, `GET /v1/errors/{code}`) are readable without a key, with `ETag` and `Cache-Control`. Every other operation requires a key. **Getting started**: with a `gai_test_…` key you work in the test environment, separate from real data. Every operation below has a request and a 200-response example (and every error response an example envelope): the examples are valid against the schemas and were sent to the test environment, but the data is illustrative; your test shop returns its own. Recommended first call: `GET /v1/products?limit=1`. **Versions and deprecation**: the contract version is in the path (`/v1`). Within `/v1` we only make compatible changes (new operations, optional fields, response fields, error codes, event types): your code must ignore what it does not know. An incompatible change only comes with a new path version, or by deprecating an operation: a deprecated operation carries `deprecated: true` here and the `Deprecation` (RFC 9745), `Sunset` (RFC 8594) and `Link: rel="deprecation"` headers on every response, and stays in service for at least 12 months; notice is sent by email to the shop owners and published in the changelog. To try them: `GET /v1/_deprecation_probe` with a `gai_test_…` key. **Language**: this document is in English; codes (`error.code`), types (`error.type`) and values such as `stato` are stable Italian identifiers, and `error.message` is in Italian and may change. #### Key scopes Every operation requires a scope on the key; a key without it receives 403 AMBITO_MANCANTE. Here each scope with the operations that require it. - `catalog:write`: `PUT /v1/products`, `DELETE /v1/products/{sku}`, `POST /v1/products/snapshots`, `POST /v1/products/snapshots/{snapshot_id}/commit`, `PUT /v1/catalog/feed`, `POST /v1/catalog/feed/run`, `POST /v1/catalog/imports`, `PUT /v1/inventory`, `PUT /v1/stores` - `catalog:read`: `GET /v1/products`, `GET /v1/catalog/freshness`, `GET /v1/catalog/feed`, `GET /v1/catalog/imports`, `GET /v1/catalog/imports/{import_id}`, `GET /v1/catalog/imports/{import_id}/errors`, `GET /v1/stores` - `customers:write`: `PUT /v1/customers` - `history:write`: `PUT /v1/order_history` - `rules:read`: `GET /v1/rules`, `POST /v1/rules/preview` - `rules:write`: `PUT /v1/rules` - `texts:read`: `GET /v1/store_texts` - `texts:write`: `PUT /v1/store_texts` - `customers:read`: `GET /v1/customers/{external_ref}` - `orders:read`: `GET /v1/orders`, `GET /v1/support_requests` - `orders:write`: `POST /v1/orders/{order_id}/ack`, `POST /v1/orders/{order_id}/status`, `POST /v1/support_requests/{support_id}/ack` - `chat:write`: `POST /v1/chat_identity_tokens` #### `GET /v1/openapi.json` `operationId`: `getOpenapi` **The OpenAPI document of this API** Generated from the same route table that serves the calls, so it cannot drift from the behaviour. Downloadable without a key from a stable address, with `ETag` and `Cache-Control`: with `If-None-Match` equal to the `ETag` the response is `304` with no body. No key: called without authentication. ##### Parameters - `If-None-Match` · header (string) — The `ETag` of a previous read: if the content has not changed the response is `304` with no body. ##### Example · Response 200 ```json { "openapi": "3.1.0", "info": { "title": "GroceryAI Platform API", "version": "1.0.0" }, "paths": { "/v1/products": { "get": { "operationId": "getProducts" } } } } ``` ##### Responses - `200` The OpenAPI 3.1 document. — Headers: `x-request-id`, `x-core-version`, `cache-control`, `access-control-allow-origin`, `access-control-expose-headers`, `etag` - `304` The document has not changed since the `ETag` sent in `If-None-Match`: no body. — Headers: `x-request-id`, `x-core-version`, `cache-control`, `access-control-allow-origin`, `access-control-expose-headers`, `etag` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `cache-control`, `access-control-allow-origin`, `access-control-expose-headers` #### `GET /v1/errors` `operationId`: `listErrorCodes` **The error code catalog** Every code this API can return in `error.code`, in a batch's `errors[].code` or in `warnings[].code`: what it means, how to fix it, with which statuses and in which operations it appears. No key needed. No key: called without authentication. ##### Parameters - `If-None-Match` · header (string) — The `ETag` of a previous read: if the content has not changed the response is `304` with no body. ##### Example · Response 200 ```json { "data": [ { "code": "IDEMPOTENCY_KEY_MANCANTE", "title": "This operation writes data and needs an `Idempotency-Key` header.", "how_to_fix": "Generate a unique value per logical operation (a UUID v4 is ideal), send it as `Idempotency-Key`, and reuse the same value only when retrying that same request.", "retryable": false, "appears_as": { "error": [ { "status": 400, "type": "richiesta_non_valida", "operations": [ "putProducts", "createProductSnapshot", "commitProductSnapshot", "putCatalogFeed", "runCatalogFeed", "createCatalogImport", "putInventory", "putCustomers", "putOrderHistory", "putStores", "putRules", "putStoreTexts", "ackOrder", "reportOrderStatus", "ackSupportRequest" ] } ], "batch_item_error": [], "batch_item_warning": [], "chat_session_identity": false }, "doc_url": "https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/IDEMPOTENCY_KEY_MANCANTE" } ] } ``` ##### Responses - `200` All codes, in alphabetical order. — Headers: `x-request-id`, `x-core-version`, `cache-control`, `access-control-allow-origin`, `access-control-expose-headers`, `etag` - `304` The catalog has not changed since the `ETag` sent in `If-None-Match`: no body. — Headers: `x-request-id`, `x-core-version`, `cache-control`, `access-control-allow-origin`, `access-control-expose-headers`, `etag` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `cache-control`, `access-control-allow-origin`, `access-control-expose-headers` #### `GET /v1/errors/{code}` `operationId`: `getErrorCode` **The page of one error code** The page `error.doc_url` points to: what the code means, how to fix it, the statuses and operations in which it appears. No key needed. No key: called without authentication. ##### Parameters - `code` · path (string) · required — The code, as written in `error.code` (for example `IDEMPOTENCY_KEY_MANCANTE`). - `If-None-Match` · header (string) — The `ETag` of a previous read: if the content has not changed the response is `304` with no body. ##### Example · Response 200 ```json { "data": { "code": "IDEMPOTENCY_KEY_MANCANTE", "title": "This operation writes data and needs an `Idempotency-Key` header.", "how_to_fix": "Generate a unique value per logical operation (a UUID v4 is ideal), send it as `Idempotency-Key`, and reuse the same value only when retrying that same request.", "retryable": false, "appears_as": { "error": [ { "status": 400, "type": "richiesta_non_valida", "operations": [ "putProducts", "createProductSnapshot", "commitProductSnapshot", "putCatalogFeed", "runCatalogFeed", "createCatalogImport", "putInventory", "putCustomers", "putOrderHistory", "putStores", "putRules", "putStoreTexts", "ackOrder", "reportOrderStatus", "ackSupportRequest" ] } ], "batch_item_error": [], "batch_item_warning": [], "chat_session_identity": false }, "doc_url": "https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/errors/IDEMPOTENCY_KEY_MANCANTE" } } ``` ##### Responses - `200` The code's page. — Headers: `x-request-id`, `x-core-version`, `cache-control`, `access-control-allow-origin`, `access-control-expose-headers`, `etag` - `304` The page has not changed since the `ETag` sent in `If-None-Match`: no body. — Headers: `x-request-id`, `x-core-version`, `cache-control`, `access-control-allow-origin`, `access-control-expose-headers`, `etag` - `404` `CODICE_ERRORE_SCONOSCIUTO`: this API never returns that code (the full catalog is `GET /v1/errors`). — Error codes: `CODICE_ERRORE_SCONOSCIUTO` — Headers: `x-request-id`, `x-core-version`, `cache-control`, `access-control-allow-origin`, `access-control-expose-headers` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `cache-control`, `access-control-allow-origin`, `access-control-expose-headers` #### `GET /v1/status` `operationId`: `getStatus` **The status of the service, per component** For each component (`assistant`, `web_chat`, `api`, `events`, `portal`, `mcp`) its status now, from the same rules as the internal alarms that measure the service every minute: `operational`, `degraded` (it answers, but part of the work fails: 5xx responses, conversation turns with errors, abandoned or late deliveries, stopped scheduled jobs), `outage` (it does not answer as it should to two probes in a row) or `unknown` (not measured: no probe, measurement stopped for more than 3 minutes or failing for more than 10). Then availability over the last 30 and 90 days, on measured minutes only (with `from` and `complete`: the history starts on 2026-10-24), and the latest incidents with start, last impact and resolution (an incident is resolved after 10 minutes without errors). No key, no data about any shop. Updated at most once a minute: `Cache-Control` of 30 seconds, `ETag` and `304`. No key: called without authentication. ##### Parameters - `If-None-Match` · header (string) — The `ETag` of a previous read: if the content has not changed the response is `304` with no body. ##### Example · Response 200 ```json { "status": "operational", "measured_at": "2026-10-31T09:15:00.000Z", "measured_since": "2026-10-24T12:51:00.000Z", "components": [ { "id": "assistant", "name": "Shopping assistant", "description": "The conversation that builds the cart and the order, on every channel.", "status": "operational", "availability": { "30d": { "window_days": 30, "from": "2026-10-24T12:51:00.000Z", "complete": false, "measured_minutes": 10104, "outage_minutes": 0, "degraded_minutes": 5, "uptime_percent": 100 }, "90d": { "window_days": 90, "from": "2026-10-24T12:51:00.000Z", "complete": false, "measured_minutes": 10104, "outage_minutes": 0, "degraded_minutes": 5, "uptime_percent": 100 }, "month": { "month": "2026-10", "from": "2026-10-24T12:51:00.000Z", "to": "2026-10-31T09:15:00.000Z", "complete": false, "measured_minutes": 10104, "outage_minutes": 0, "degraded_minutes": 5, "downtime_minutes": 5, "availability_percent": 99.951, "objective_percent": 99.9, "objective_met": true }, "previous_month": null } }, { "id": "web_chat", "name": "Web chat", "description": "The chat on the shop's website.", "status": "operational", "availability": { "30d": { "window_days": 30, "from": "2026-10-24T12:51:00.000Z", "complete": false, "measured_minutes": 10104, "outage_minutes": 4, "degraded_minutes": 0, "uptime_percent": 99.96 }, "90d": { "window_days": 90, "from": "2026-10-24T12:51:00.000Z", "complete": false, "measured_minutes": 10104, "outage_minutes": 4, "degraded_minutes": 0, "uptime_percent": 99.96 }, "month": { "month": "2026-10", "from": "2026-10-24T12:51:00.000Z", "to": "2026-10-31T09:15:00.000Z", "complete": false, "measured_minutes": 10104, "outage_minutes": 4, "degraded_minutes": 0, "downtime_minutes": 4, "availability_percent": 99.96, "objective_percent": 99.9, "objective_met": true }, "previous_month": null } }, { "id": "api", "name": "API", "description": "The REST API for catalog, customers, orders and events (`/v1`), and the scheduled catalog feed.", "status": "operational", "availability": { "30d": { "window_days": 30, "from": "2026-10-24T12:51:00.000Z", "complete": false, "measured_minutes": 10104, "outage_minutes": 0, "degraded_minutes": 0, "uptime_percent": 100 }, "90d": { "window_days": 90, "from": "2026-10-24T12:51:00.000Z", "complete": false, "measured_minutes": 10104, "outage_minutes": 0, "degraded_minutes": 0, "uptime_percent": 100 }, "month": { "month": "2026-10", "from": "2026-10-24T12:51:00.000Z", "to": "2026-10-31T09:15:00.000Z", "complete": false, "measured_minutes": 10104, "outage_minutes": 0, "degraded_minutes": 0, "downtime_minutes": 0, "availability_percent": 100, "objective_percent": 99.9, "objective_met": true }, "previous_month": null } }, { "id": "events", "name": "Webhooks and order delivery", "description": "Signed events to your endpoints, the pull queue and the order emails.", "status": "operational", "availability": { "30d": { "window_days": 30, "from": "2026-10-24T12:51:00.000Z", "complete": false, "measured_minutes": 10104, "outage_minutes": 0, "degraded_minutes": 0, "uptime_percent": 100 }, "90d": { "window_days": 90, "from": "2026-10-24T12:51:00.000Z", "complete": false, "measured_minutes": 10104, "outage_minutes": 0, "degraded_minutes": 0, "uptime_percent": 100 }, "month": { "month": "2026-10", "from": "2026-10-24T12:51:00.000Z", "to": "2026-10-31T09:15:00.000Z", "complete": false, "measured_minutes": 10104, "outage_minutes": 0, "degraded_minutes": 0, "downtime_minutes": 0, "availability_percent": 100, "objective_percent": 99.9, "objective_met": true }, "previous_month": null } }, { "id": "portal", "name": "Merchant portal", "description": "The portal where shops manage their catalog, keys and settings.", "status": "operational", "availability": { "30d": { "window_days": 30, "from": "2026-10-24T12:51:00.000Z", "complete": false, "measured_minutes": 10104, "outage_minutes": 0, "degraded_minutes": 0, "uptime_percent": 100 }, "90d": { "window_days": 90, "from": "2026-10-24T12:51:00.000Z", "complete": false, "measured_minutes": 10104, "outage_minutes": 0, "degraded_minutes": 0, "uptime_percent": 100 }, "month": { "month": "2026-10", "from": "2026-10-24T12:51:00.000Z", "to": "2026-10-31T09:15:00.000Z", "complete": false, "measured_minutes": 10104, "outage_minutes": 0, "degraded_minutes": 0, "downtime_minutes": 0, "availability_percent": 100, "objective_percent": 99.9, "objective_met": true }, "previous_month": null } }, { "id": "mcp", "name": "MCP server", "description": "The Model Context Protocol server for AI agents.", "status": "operational", "availability": { "30d": { "window_days": 30, "from": "2026-10-30T12:00:00.000Z", "complete": false, "measured_minutes": 1275, "outage_minutes": 0, "degraded_minutes": 0, "uptime_percent": 100 }, "90d": { "window_days": 90, "from": "2026-10-30T12:00:00.000Z", "complete": false, "measured_minutes": 1275, "outage_minutes": 0, "degraded_minutes": 0, "uptime_percent": 100 }, "month": { "month": "2026-10", "from": "2026-10-30T12:00:00.000Z", "to": "2026-10-31T09:15:00.000Z", "complete": false, "measured_minutes": 1275, "outage_minutes": 0, "degraded_minutes": 0, "downtime_minutes": 0, "availability_percent": 100, "objective_percent": 99.9, "objective_met": true }, "previous_month": null } } ], "incidents": [ { "components": [ "web_chat" ], "severity": "outage", "status": "resolved", "started_at": "2026-10-30T07:02:00.000Z", "last_seen_at": "2026-10-30T07:05:00.000Z", "resolved_at": "2026-10-30T07:15:00.000Z" }, { "components": [ "assistant" ], "severity": "degraded", "status": "resolved", "started_at": "2026-10-28T10:30:00.000Z", "last_seen_at": "2026-10-28T10:34:00.000Z", "resolved_at": "2026-10-28T10:44:00.000Z" } ] } ``` ##### Responses - `200` The status, the availability and the incidents. — Headers: `x-request-id`, `x-core-version`, `cache-control`, `access-control-allow-origin`, `access-control-expose-headers`, `etag` - `304` The status has not changed since the `ETag` sent in `If-None-Match`: no body. — Headers: `x-request-id`, `x-core-version`, `cache-control`, `access-control-allow-origin`, `access-control-expose-headers`, `etag` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `cache-control`, `access-control-allow-origin`, `access-control-expose-headers` - `503` `STATO_NON_MISURABILE`: the measurement cannot be read right now. The status is unknown, not operational: retry in a minute. — Error codes: `STATO_NON_MISURABILE` — Headers: `x-request-id`, `x-core-version`, `cache-control`, `access-control-allow-origin`, `access-control-expose-headers` #### `PUT /v1/products` `operationId`: `putProducts` **Create or update the catalog, in batches** Upsert by `sku`, as a MERGE: on an existing product only the fields the item names are updated, and the ones it does not name stay as they were; `attributes` are merged, and a key set to `null` is removed. The catalog contract fields (`min_order_qty`, `min_order_unit`, `sold_by_weight`, `avg_piece_weight_kg`, `items_per_pack`, `pack_only`, `stock_managed`, `unit_price`, `gross_weight_kg`, `tare_kg`, `list_price`, `subcategory`, `description`, `vat_rate`, `diet_tags`, `offer_price`, `offer_start`, `offer_end`, `offer_min_qty`, `offer_label`; `is_online` is `available`) are written with their name on the item and validated. A withdrawn product (`DELETE` or snapshot) that is sent again goes back on sale. `gtin` is optional, but if present it must be a valid GTIN/GS1 (8, 12, 13 or 14 digits, check digit included): a wrong barcode is worse than none. With `snapshot_id` the batch is part of a snapshot (`POST /v1/products/snapshots`). Scope: `catalog:write` ##### Parameters - `Idempotency-Key` · header (string) · required — A key chosen by the caller. The same key with the same body returns the same response without running again; with a different body it is a 409. ##### Example · Request body ```json { "products": [ { "sku": "EXAMPLE-SPAGHETTI-500", "title": "Spaghetti di semola 500 g", "gtin": "4006381333931", "brand": "Esempio", "category": "Pasta", "unit": "pz", "price": 1.29, "currency": "EUR", "stock_qty": 140, "available": true, "vat_rate": 4, "link": "https://shop.example.invalid/p/spaghetti-500", "image_link": "https://shop.example.invalid/img/spaghetti-500.jpg" }, { "sku": "EXAMPLE-MILK-1L", "title": "Latte intero 1 l", "brand": "Esempio", "category": "Latte e derivati", "unit": "pz", "price": 1.49, "stock_qty": 60 } ] } ``` ##### Example · Response 200 ```json { "received": 2, "written": 2, "rejected": 0, "errors": [], "warnings": [], "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` Batch outcome: how many received, how many written, which were rejected and why, and the warnings. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `idempotent-replayed` - `400` Invalid body, or a batch over 500 items. — Error codes: `CORPO_NON_JSON`, `IDEMPOTENCY_KEY_MANCANTE`, `IDEMPOTENCY_KEY_TROPPO_LUNGA`, `CORPO_NON_VALIDO`, `LOTTO_VUOTO`, `LOTTO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `404` `ISTANTANEA_SCONOSCIUTA`: the `snapshot_id` does not belong to this account and environment. — Error codes: `ISTANTANEA_SCONOSCIUTA` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `409` `ISTANTANEA_CHIUSA` or `ISTANTANEA_SCADUTA`: the snapshot no longer accepts batches. — Error codes: `IDEMPOTENCY_KEY_RIUSATA`, `RICHIESTA_IN_CORSO`, `ISTANTANEA_CHIUSA`, `ISTANTANEA_SCADUTA` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `413` Body over the allowed limit (1 MiB). — Error codes: `CORPO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `GET /v1/products` `operationId`: `getProducts` **List the catalog** Sorted by `sku`. Cursor pagination: `cursor` is the last `sku` of the previous page. Scope: `catalog:read` ##### Parameters - `sku` · query (string) — A single product, by SKU. - `gtin` · query (string) — The products with this GTIN. - `limit` · query (integer) — From 1 to 200 (default 50). - `cursor` · query (string) — Last `sku` of the previous page. - `store_code` · query (string) — The catalog as it is in one store (`GET /v1/stores`): price, strikethrough price, offer, stock and availability of the store where it declares them, the shop's where it does not. ##### Example · Response 200 ```json { "data": [ { "sku": "EXAMPLE-SPAGHETTI-500", "gtin": "4006381333931", "title": "Spaghetti di semola 500 g", "brand": "Esempio", "category": "Pasta", "unit": "pz", "price": 1.29, "net_price": null, "currency": "EUR", "stock_qty": 140, "available": true, "link": "https://shop.example.invalid/p/spaghetti-500", "image_link": "https://shop.example.invalid/img/spaghetti-500.jpg", "attributes": { "vat_rate": 4 } } ], "next_cursor": "EXAMPLE-SPAGHETTI-500", "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The page, with `next_cursor` when there is more. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `400` Invalid request: `code` says which field or header, `param` where. — Error codes: `PARAMETRO_NON_VALIDO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `404` `PUNTO_VENDITA_SCONOSCIUTO`: no active store with that `store_code`. — Error codes: `PUNTO_VENDITA_SCONOSCIUTO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `DELETE /v1/products/{sku}` `operationId`: `deleteProduct` **Withdraw a product from sale** The product is switched off (`available: false`, with the withdrawal date in `attributes.withdrawn_at`), not deleted: orders and history that mention it stay readable, and the assistant stops selling it. Withdrawing the same product twice is not an error. To put it back on sale, send it again with `PUT /v1/products`. With an agent key it waits for a person's approval (`202`). Scope: `catalog:write` ##### Parameters - `sku` · path (string) · required — The product's `sku`. ##### Example · Response 200 ```json { "data": { "sku": "EXAMPLE-MILK-1L", "available": false, "withdrawn": true }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` Withdrawn. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `202` Agent key: waiting for a person's approval. Nothing has changed. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `400` Invalid request: `code` says which field or header, `param` where. — Error codes: `CORPO_NON_JSON` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `404` No product with this `sku` for the account and the key's environment. — Error codes: `NON_TROVATO`, `APPROVAZIONE_SCONOSCIUTA` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `409` `Idempotency-Key` already used for a different request, or a request still in progress. — Error codes: `APPROVAZIONE_IN_ATTESA`, `APPROVAZIONE_RIFIUTATA`, `APPROVAZIONE_SCADUTA`, `APPROVAZIONE_GIA_USATA`, `APPROVAZIONE_DIVERSA` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `413` Body over the allowed limit (1 MiB). — Error codes: `CORPO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE`, `APPROVAZIONI_ASSENTI` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `POST /v1/products/snapshots` `operationId`: `createProductSnapshot` **Open a catalog snapshot ("this is the whole catalog")** To say the catalog you send is the WHOLE catalog: open the snapshot, send the batches with `PUT /v1/products` and the `snapshot_id`, and close it with `commit`. On commit, the active products that no batch carried are withdrawn (switched off, not deleted), but only if the batches carried at least 90% of the active products (the threshold can be declared): a truncated file does not empty the catalog. A snapshot lives 24 hours. Scope: `catalog:write` ##### Parameters - `Idempotency-Key` · header (string) · required — A key chosen by the caller. The same key with the same body returns the same response without running again; with a different body it is a 409. ##### Example · Request body ```json {} ``` ##### Example · Response 200 ```json { "data": { "snapshot_id": "3b9f0e62-1d4a-4c8e-a7b2-5f6e9d0c1a23", "expires_at": "2026-11-01T09:15:00Z", "active_products": 1240 }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The open snapshot: `snapshot_id`, expiry, products active now. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `idempotent-replayed` - `400` Invalid request: `code` says which field or header, `param` where. — Error codes: `CORPO_NON_JSON`, `IDEMPOTENCY_KEY_MANCANTE`, `IDEMPOTENCY_KEY_TROPPO_LUNGA` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `409` `Idempotency-Key` already used for a different request, or a request still in progress. — Error codes: `IDEMPOTENCY_KEY_RIUSATA`, `RICHIESTA_IN_CORSO` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `413` Body over the allowed limit (1 MiB). — Error codes: `CORPO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `POST /v1/products/snapshots/{snapshot_id}/commit` `operationId`: `commitProductSnapshot` **Commit the snapshot: withdraw the products the batches did not carry** With `dry_run: true` it only returns the numbers (active, carried, to withdraw, the share, the threshold, the first 20 skus to withdraw) and changes nothing. Without it, it requires `expected_off`, the number to withdraw read in the dry run: if it changed in the meantime nothing is withdrawn (409 `CONTEGGIO_CAMBIATO`). Below the threshold nothing is withdrawn (409 `ISTANTANEA_SOTTO_SOGLIA`) and the snapshot stays open: the missing batches can still be sent. With an agent key the real commit (without `dry_run`) waits for a person's approval (`202`). Scope: `catalog:write` ##### Parameters - `snapshot_id` · path (string) · required — The snapshot identifier. - `Idempotency-Key` · header (string) · required — A key chosen by the caller. The same key with the same body returns the same response without running again; with a different body it is a 409. ##### Example · Request body ```json { "dry_run": true } ``` ##### Example · Response 200 ```json { "data": { "snapshot_id": "3b9f0e62-1d4a-4c8e-a7b2-5f6e9d0c1a23", "active": 1240, "seen_active": 1228, "to_switch_off": 12, "share": 0.9903, "min_share": 0.9, "allowed": true, "count_changed": false, "dry_run": true, "switched_off": 0, "sample": [ "EXAMPLE-OLD-001", "EXAMPLE-OLD-002" ] }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The gate numbers and, without `dry_run`, how many products were withdrawn. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `idempotent-replayed` - `202` Agent key, without `dry_run`: waiting for a person's approval. Nothing has changed. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `idempotent-replayed` - `400` Invalid body: `expected_off` is missing or not an integer. — Error codes: `CORPO_NON_JSON`, `IDEMPOTENCY_KEY_MANCANTE`, `IDEMPOTENCY_KEY_TROPPO_LUNGA`, `CORPO_NON_VALIDO`, `ATTESO_NON_VALIDO` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `404` `ISTANTANEA_SCONOSCIUTA`. — Error codes: `ISTANTANEA_SCONOSCIUTA`, `APPROVAZIONE_SCONOSCIUTA` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `409` `ISTANTANEA_SOTTO_SOGLIA`, `CONTEGGIO_CAMBIATO`, `ISTANTANEA_CHIUSA` or `ISTANTANEA_SCADUTA`. — Error codes: `IDEMPOTENCY_KEY_RIUSATA`, `RICHIESTA_IN_CORSO`, `ISTANTANEA_SOTTO_SOGLIA`, `CONTEGGIO_CAMBIATO`, `ISTANTANEA_CHIUSA`, `ISTANTANEA_SCADUTA`, `APPROVAZIONE_IN_ATTESA`, `APPROVAZIONE_RIFIUTATA`, `APPROVAZIONE_SCADUTA`, `APPROVAZIONE_GIA_USATA`, `APPROVAZIONE_DIVERSA` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `413` Body over the allowed limit (1 MiB). — Error codes: `CORPO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE`, `APPROVAZIONI_ASSENTI` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `GET /v1/catalog/freshness` `operationId`: `getCatalogFreshness` **How fresh the catalog is** The last catalog update (any channel: file, API, feed), the refresh interval the shop declared, and whether the catalog has been unchanged for more than twice that interval (`stale`). Scope: `catalog:read` ##### Example · Response 200 ```json { "data": { "environment": "test", "last_update_at": "2026-10-31T09:15:00Z", "age_hours": 2.5, "declared_refresh_hours": 24, "stale": false, "products": 1240, "available": 1198 }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The freshness. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `GET /v1/catalog/feed` `operationId`: `getCatalogFeed` **The scheduled catalog feed and its last run** The configuration (URL, format, how many hours apart, delta or snapshot, on or off, the declared refresh interval) and the outcome of the last run. A shop that never configured it receives `data: null`. Scope: `catalog:read` ##### Example · Response 200 ```json { "data": { "url": "https://shop.example.invalid/feed/products.csv", "format": "csv", "every_hours": 6, "mode": "delta", "enabled": true, "declared_refresh_hours": 24, "next_run_at": "2026-10-31T15:15:00Z", "last_run_at": null, "last_run": null, "updated_at": "2026-10-31T09:15:00Z" }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The configuration, or `null`. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `PUT /v1/catalog/feed` `operationId`: `putCatalogFeed` **Configure the scheduled feed and the declared refresh interval** An `https://` URL that GroceryAI reads every `every_hours` hours (24 by default): our CSV or XLSX, or the Google Merchant / Meta Commerce product feed (XML or TSV). `mode: snapshot` withdraws the products the feed does not carry, behind the 90% gate; the default `delta` only updates. `declared_refresh_hours` is how often the shop updates prices and stock (through any channel): past twice that, the catalog is flagged as stale. The interval can be declared without a feed (`url: null`). Scope: `catalog:write` ##### Parameters - `Idempotency-Key` · header (string) · required — A key chosen by the caller. The same key with the same body returns the same response without running again; with a different body it is a 409. ##### Example · Request body ```json { "url": "https://shop.example.invalid/feed/products.csv", "format": "csv", "every_hours": 6, "mode": "delta", "enabled": true, "declared_refresh_hours": 24 } ``` ##### Example · Response 200 ```json { "data": { "url": "https://shop.example.invalid/feed/products.csv", "format": "csv", "every_hours": 6, "mode": "delta", "enabled": true, "declared_refresh_hours": 24, "next_run_at": "2026-10-31T15:15:00Z", "last_run_at": null, "last_run": null, "updated_at": "2026-10-31T09:15:00Z" }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The saved configuration. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `idempotent-replayed` - `400` Invalid body: `code` says which field. — Error codes: `CORPO_NON_JSON`, `IDEMPOTENCY_KEY_MANCANTE`, `IDEMPOTENCY_KEY_TROPPO_LUNGA`, `CORPO_NON_VALIDO`, `CAMPO_SCONOSCIUTO`, `FEED_URL_NON_AMMESSO`, `FORMATO_NON_AMMESSO`, `CADENZA_NON_VALIDA`, `VALORE_NON_AMMESSO` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `409` `Idempotency-Key` already used for a different request, or a request still in progress. — Error codes: `IDEMPOTENCY_KEY_RIUSATA`, `RICHIESTA_IN_CORSO` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `413` Body over the allowed limit (1 MiB). — Error codes: `CORPO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `POST /v1/catalog/feed/run` `operationId`: `runCatalogFeed` **Run the feed now** The same run as the scheduler, right now: reads the URL, prepares the rows with the rules of the portal file import, writes them as a merge and, in `mode: snapshot`, withdraws the missing ones behind the gate. The run is recorded even when it fails. Scope: `catalog:write` ##### Parameters - `Idempotency-Key` · header (string) · required — A key chosen by the caller. The same key with the same body returns the same response without running again; with a different body it is a 409. ##### Example · Request body ```json {} ``` ##### Example · Response 200 ```json { "data": { "status": "ok", "error_code": null, "message": null, "received": 1240, "written": 1240, "rejected": 0, "switched_off": 0, "errors": [], "snapshot": null, "started_at": "2026-10-31T09:15:00Z", "finished_at": "2026-10-31T09:15:04Z" }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The run outcome (`status`: `ok`, `partial` with rejected rows, `failed` with `error_code`). — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `idempotent-replayed` - `400` Invalid request: `code` says which field or header, `param` where. — Error codes: `CORPO_NON_JSON`, `IDEMPOTENCY_KEY_MANCANTE`, `IDEMPOTENCY_KEY_TROPPO_LUNGA` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `409` `FEED_NON_CONFIGURATO`: no URL configured for this environment. — Error codes: `IDEMPOTENCY_KEY_RIUSATA`, `RICHIESTA_IN_CORSO`, `FEED_NON_CONFIGURATO` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `413` Body over the allowed limit (1 MiB). — Error codes: `CORPO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `POST /v1/catalog/imports` `operationId`: `createCatalogImport` **Import the whole catalog, asynchronously** For the whole catalog in one call: up to 50,000 products in the body (`products`: the same items as `PUT /v1/products`, GS1 codes included), a CSV in the body (`Content-Type: text/csv`, the columns of the portal file; `mode` in the query), or the address of a file (`url` and `format`: `json`, `jsonl`, `csv`, `xlsx`, `google_merchant_xml`, `google_merchant_tsv`). The body can be up to 16 MiB. The answer is an IMMEDIATE `202` with the import (`status: queued`) and `Location`: the work happens afterwards, in chunks of 500 items, with the rules of `PUT /v1/products` (merge by `sku`) or of the portal file. Read the status with `GET /v1/catalog/imports/{import_id}`, the rejected rows with `.../errors`, and the end arrives as a `catalog_import.completed` event at the subscribed endpoints. The same `sku` twice in the same import: the first one wins. `mode: snapshot` withdraws, at the end, the active products the import does not carry, behind the 90 % gate (with an agent key it waits for a person's approval). At most 5 unfinished imports per environment. Scope: `catalog:write` ##### Parameters - `mode` · query (string) — Only with a CSV body: `delta` (default) or `snapshot`. With a JSON body, `mode` goes in the body. - `Idempotency-Key` · header (string) · required — A key chosen by the caller. The same key with the same body returns the same response without running again; with a different body it is a 409. ##### Example · Request body ```json { "products": [ { "sku": "EXAMPLE-SPAGHETTI-500", "gtin": "8000000000017", "title": "Spaghetti n.5 500 g", "brand": "Esempio", "category": "Pasta", "price": 1.29, "stock_qty": 240 }, { "sku": "EXAMPLE-MILK-1L", "title": "Latte intero 1 l", "category": "Latte e derivati", "price": 1.49, "available": true } ], "mode": "delta" } ``` ##### Example · Response 202 ```json { "data": { "id": "3c9e7a51-2f4b-4d8e-9a16-5b7c0d2e4f81", "status": "queued", "mode": "delta", "source": "body", "format": "json", "url": null, "received": 2, "written": 0, "rejected": 0, "warnings": 0, "switched_off": 0, "chunks_total": 1, "chunks_done": 0, "error": null, "snapshot": null, "created_at": "2026-10-31T09:15:00.000Z", "started_at": null, "finished_at": null, "links": { "self": "https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/catalog/imports/3c9e7a51-2f4b-4d8e-9a16-5b7c0d2e4f81", "errors": "https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/catalog/imports/3c9e7a51-2f4b-4d8e-9a16-5b7c0d2e4f81/errors" } }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `202` Accepted: the import is queued, with `Location` pointing to its status. With an agent key and `mode: snapshot`, the approval request. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `idempotent-replayed`, `location` - `400` Invalid body: neither `products` nor `url`, an empty list or more than 50,000 items, a format or address that is not allowed. — Error codes: `CORPO_NON_JSON`, `IDEMPOTENCY_KEY_MANCANTE`, `IDEMPOTENCY_KEY_TROPPO_LUNGA`, `CORPO_NON_VALIDO`, `LOTTO_VUOTO`, `LOTTO_TROPPO_GRANDE`, `CAMPO_SCONOSCIUTO`, `VALORE_NON_AMMESSO`, `FORMATO_NON_AMMESSO`, `FEED_URL_NON_AMMESSO` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `404` `APPROVAZIONE_SCONOSCIUTA`: with an agent key, the `GroceryAI-Approval-Id` header is not an approval of this key. — Error codes: `APPROVAZIONE_SCONOSCIUTA` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `409` `IMPORTAZIONI_IN_CORSO`: there are already 5 unfinished imports in this environment. — Error codes: `IDEMPOTENCY_KEY_RIUSATA`, `RICHIESTA_IN_CORSO`, `IMPORTAZIONI_IN_CORSO`, `APPROVAZIONE_IN_ATTESA`, `APPROVAZIONE_RIFIUTATA`, `APPROVAZIONE_SCADUTA`, `APPROVAZIONE_GIA_USATA`, `APPROVAZIONE_DIVERSA` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `413` Body over the allowed limit (1 MiB). — Error codes: `CORPO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE`, `APPROVAZIONI_ASSENTI` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `GET /v1/catalog/imports` `operationId`: `listCatalogImports` **The catalog imports, most recent first** Cursor pagination: `cursor` is the `id` of the last import of the previous page. Scope: `catalog:read` ##### Parameters - `limit` · query (integer) — From 1 to 100 (default 20). - `cursor` · query (string) — The `id` of the last import of the previous page. ##### Example · Response 200 ```json { "data": [ { "id": "3c9e7a51-2f4b-4d8e-9a16-5b7c0d2e4f81", "status": "partial", "mode": "delta", "source": "url", "format": "jsonl", "url": "https://shop.example.invalid/export/products.jsonl", "received": 38412, "written": 38408, "rejected": 4, "warnings": 12, "switched_off": 0, "chunks_total": 77, "chunks_done": 77, "error": null, "snapshot": null, "created_at": "2026-10-31T09:15:00.000Z", "started_at": "2026-10-31T09:15:41.000Z", "finished_at": "2026-10-31T09:19:02.000Z", "links": { "self": "https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/catalog/imports/3c9e7a51-2f4b-4d8e-9a16-5b7c0d2e4f81", "errors": "https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/catalog/imports/3c9e7a51-2f4b-4d8e-9a16-5b7c0d2e4f81/errors" } } ], "next_cursor": null, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The page, with `next_cursor` when there is more. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `400` Invalid request: `code` says which field or header, `param` where. — Error codes: `PARAMETRO_NON_VALIDO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `GET /v1/catalog/imports/{import_id}` `operationId`: `getCatalogImport` **The status of a catalog import** `status`: `queued` (waiting: it starts within a minute), `running` (in progress: `chunks_done` out of `chunks_total`, and the counts grow), `succeeded`, `partial` (rejected rows, or the snapshot gate that withdrew nothing: `error`), `failed` (`error` says why). `received`, `written`, `rejected` and `warnings` count the items (or the rows of the file). Scope: `catalog:read` ##### Parameters - `import_id` · path (string) · required — The `id` returned by `POST /v1/catalog/imports`. ##### Example · Response 200 ```json { "data": { "id": "3c9e7a51-2f4b-4d8e-9a16-5b7c0d2e4f81", "status": "partial", "mode": "delta", "source": "url", "format": "jsonl", "url": "https://shop.example.invalid/export/products.jsonl", "received": 38412, "written": 38408, "rejected": 4, "warnings": 12, "switched_off": 0, "chunks_total": 77, "chunks_done": 77, "error": null, "snapshot": null, "created_at": "2026-10-31T09:15:00.000Z", "started_at": "2026-10-31T09:15:41.000Z", "finished_at": "2026-10-31T09:19:02.000Z", "links": { "self": "https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/catalog/imports/3c9e7a51-2f4b-4d8e-9a16-5b7c0d2e4f81", "errors": "https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/catalog/imports/3c9e7a51-2f4b-4d8e-9a16-5b7c0d2e4f81/errors" } }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The import. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `404` `IMPORTAZIONE_SCONOSCIUTA`: no import with this id for the tenant and the environment of the key. — Error codes: `IMPORTAZIONE_SCONOSCIUTA` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `GET /v1/catalog/imports/{import_id}/errors` `operationId`: `getCatalogImportErrors` **The rejected rows (or the warnings) of an import, row by row** Each row says where (`index` of the JSON item, from 0, or `row` of the file, with the header on row 1), which `sku`, the code and the field. The rows are those of the chunks already written: once the import is finished (`complete: true`) the list is whole. `type=warnings` for the warnings (rows written with something to know). Scope: `catalog:read` ##### Parameters - `import_id` · path (string) · required — The `id` of the import. - `type` · query (string) — `errors` (default) or `warnings`. - `limit` · query (integer) — From 1 to 1000 (default 500). - `cursor` · query (string) — The `next_cursor` of the previous page. ##### Example · Response 200 ```json { "data": [ { "index": 1204, "row": null, "id": "EXAMPLE-OLIVE-OIL-1L", "code": "PREZZO_NON_VALIDO", "field": "price", "message": "`price` deve essere un numero >= 0." }, { "index": 20877, "row": null, "id": "EXAMPLE-SPAGHETTI-500", "code": "SKU_RIPETUTO_NEL_LOTTO", "field": "sku", "message": "Questo `sku` e' gia' in un elemento precedente della stessa importazione: vale il primo." }, { "index": 31002, "row": null, "id": null, "code": "ELEMENTO_NON_JSON", "field": null, "message": "La riga non e' JSON: Unexpected end of JSON input" }, { "index": 36511, "row": null, "id": "EXAMPLE-RICE-1KG", "code": "PEZZO_NON_SCRITTO", "field": null, "message": "Il pezzo non si e' potuto scrivere dopo 5 tentativi: connessione chiusa. Rimanda queste righe." } ], "next_cursor": null, "complete": true, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The page of rows, with `next_cursor` when there is more and `complete` when the import is finished. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `400` Invalid request: `code` says which field or header, `param` where. — Error codes: `PARAMETRO_NON_VALIDO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `404` `IMPORTAZIONE_SCONOSCIUTA`: no import with this id for the tenant and the environment of the key. — Error codes: `IMPORTAZIONE_SCONOSCIUTA` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `PUT /v1/inventory` `operationId`: `putInventory` **Update prices, stock and offers, in batches** Touches ONLY the fields present in each item (`price`, `net_price`, `stock_qty`, `available` or `is_online`, the strikethrough price `list_price` and the offer `offer_price`, `offer_start`, `offer_end`, `offer_min_qty`, `offer_label`, `null` to remove it): whatever is not named stays as it was. An SKU that does not exist is a rejected item, not a half-created product. With `store_code` the item applies to THAT store (`GET /v1/stores`) and carries only `price`, `stock_qty`, `available` or `is_online`, `list_price`, `offer_price`, `offer_start`, `offer_end` (otherwise `CAMPO_NON_PER_PUNTO_VENDITA`): the shop-wide row is not touched, and whatever the store does not declare stays the shop's. A code that is not an active store is a rejected item (`PUNTO_VENDITA_SCONOSCIUTO`). Scope: `catalog:write` ##### Parameters - `Idempotency-Key` · header (string) · required — A key chosen by the caller. The same key with the same body returns the same response without running again; with a different body it is a 409. ##### Example · Request body ```json { "inventory": [ { "sku": "EXAMPLE-SPAGHETTI-500", "price": 1.19, "stock_qty": 120 }, { "sku": "EXAMPLE-MILK-1L", "available": false } ] } ``` ##### Example · Response 200 ```json { "received": 2, "written": 2, "rejected": 0, "errors": [], "warnings": [], "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` Batch outcome. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `idempotent-replayed` - `400` Invalid body, or a batch over 500 items. — Error codes: `CORPO_NON_JSON`, `IDEMPOTENCY_KEY_MANCANTE`, `IDEMPOTENCY_KEY_TROPPO_LUNGA`, `CORPO_NON_VALIDO`, `LOTTO_VUOTO`, `LOTTO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `409` `Idempotency-Key` already used for a different request, or a request still in progress. — Error codes: `IDEMPOTENCY_KEY_RIUSATA`, `RICHIESTA_IN_CORSO` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `413` Body over the allowed limit (1 MiB). — Error codes: `CORPO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `PUT /v1/customers` `operationId`: `putCustomers` **Sync customers, in batches** Upsert by `external_ref`, the identifier the customer has in your system. Scope: `customers:write` ##### Parameters - `Idempotency-Key` · header (string) · required — A key chosen by the caller. The same key with the same body returns the same response without running again; with a different body it is a 409. ##### Example · Request body ```json { "customers": [ { "external_ref": "example-customer-001", "display_name": "Giulia Esempio", "email": "giulia@example.invalid", "phone": "+390000000001", "street": "Via delle Prove", "house_number": "1", "city": "Olbia", "postal_code": "07026", "language": "it" } ] } ``` ##### Example · Response 200 ```json { "received": 1, "written": 1, "rejected": 0, "errors": [], "warnings": [], "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` Batch outcome. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `idempotent-replayed` - `400` Invalid body, or a batch over 500 items. — Error codes: `CORPO_NON_JSON`, `IDEMPOTENCY_KEY_MANCANTE`, `IDEMPOTENCY_KEY_TROPPO_LUNGA`, `CORPO_NON_VALIDO`, `LOTTO_VUOTO`, `LOTTO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `409` `Idempotency-Key` already used for a different request, or a request still in progress. — Error codes: `IDEMPOTENCY_KEY_RIUSATA`, `RICHIESTA_IN_CORSO` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `413` Body over the allowed limit (1 MiB). — Error codes: `CORPO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `PUT /v1/order_history` `operationId`: `putOrderHistory` **Load the shop's order history, in batches** One row per order line, upsert by `order_ref` + `sku`: an optional field the row does not carry stays as it was. The customer is identified by E.164 phone (`phone`) or by their `customer_ref` (the `external_ref` of `PUT /v1/customers`). From this the assistant learns each customer's "usual": the products, the quantities of the last purchase, the last order. History is matched to a customer only when the channel guarantees the phone number (WhatsApp): in the web chat the customer types the number, and it opens nobody's history. Only for shops that live on GroceryAI (`409 STORICO_SOLO_NEGOZI_NATIVI` for shops that read history from their own connector). Scope: `history:write` ##### Parameters - `Idempotency-Key` · header (string) · required — A key chosen by the caller. The same key with the same body returns the same response without running again; with a different body it is a 409. ##### Example · Request body ```json { "order_history": [ { "order_ref": "EXAMPLE-ORDER-0001", "sku": "EXAMPLE-SPAGHETTI-500", "title": "Spaghetti di semola 500 g", "quantity": 2, "unit_price": 1.29, "customer_ref": "example-customer-001", "order_date": "2026-10-20", "status": "delivered" }, { "order_ref": "EXAMPLE-ORDER-0001", "sku": "EXAMPLE-MILK-1L", "title": "Latte intero 1 l", "quantity": 1, "unit_price": 1.49, "customer_ref": "example-customer-001", "order_date": "2026-10-20", "status": "delivered" } ] } ``` ##### Example · Response 200 ```json { "received": 2, "written": 2, "rejected": 0, "errors": [], "warnings": [], "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` Batch outcome: how many received, how many written, which were rejected and why. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `idempotent-replayed` - `400` Invalid body, or a batch over 500 items. — Error codes: `CORPO_NON_JSON`, `IDEMPOTENCY_KEY_MANCANTE`, `IDEMPOTENCY_KEY_TROPPO_LUNGA`, `CORPO_NON_VALIDO`, `LOTTO_VUOTO`, `LOTTO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `409` The shop does not read its history from GroceryAI. — Error codes: `IDEMPOTENCY_KEY_RIUSATA`, `RICHIESTA_IN_CORSO`, `STORICO_SOLO_NEGOZI_NATIVI` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `413` Body over the allowed limit (1 MiB). — Error codes: `CORPO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `GET /v1/stores` `operationId`: `getStores` **Read the shop's stores** The list of stores (`store_code`, `name`, `city`, `address`, `timezone`, `is_active`), with `principal` (the shop's own store: it serves locations no zone covers), the zones each one serves and a preview of its catalog: `products.sellable` (products sellable there), `own_price` (those with a store-specific price), `not_sold_here` (those not sold there). A shop with a single store reads zero: its store is implicit. Scope: `catalog:read` ##### Example · Response 200 ```json { "data": { "environment": "test", "catalog_products": 1240, "stores": [ { "store_code": "OLB-01", "name": "Bottega Esempio Centro", "city": "Olbia", "address": "Via delle Prove 1", "timezone": "Europe/Rome", "is_active": true, "principal": true, "zones": [], "products": { "sellable": 1240, "own_price": 0, "not_sold_here": 0 } } ] }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The stores, with a catalog preview for each. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `PUT /v1/stores` `operationId`: `putStores` **Write the shop's stores** The body `{stores: [...]}` is the COMPLETE list: a store that is not named is switched off (never deleted). Each item: `store_code` (letters, digits, `_ . -`, up to 64), `name`, `city`, optional `address` and `timezone` (IANA; absent = the shop's), `is_active`. The first store is the shop's own. A store that serves an active delivery zone cannot be switched off (`409 PUNTO_VENDITA_CON_ZONE`): move the zone first. Zones choose their store in the portal (Delivery page, the zone's `store_code`); per-store prices arrive with `PUT /v1/inventory` and `store_code`. Scope: `catalog:write` ##### Parameters - `Idempotency-Key` · header (string) · required — A key chosen by the caller. The same key with the same body returns the same response without running again; with a different body it is a 409. ##### Example · Request body ```json { "stores": [ { "store_code": "OLB-01", "name": "Bottega Esempio Centro", "city": "Olbia", "address": "Via delle Prove 1", "timezone": "Europe/Rome", "is_active": true } ] } ``` ##### Example · Response 200 ```json { "data": { "environment": "test", "catalog_products": 1240, "stores": [ { "store_code": "OLB-01", "name": "Bottega Esempio Centro", "city": "Olbia", "address": "Via delle Prove 1", "timezone": "Europe/Rome", "is_active": true, "principal": true, "zones": [], "products": { "sellable": 1240, "own_price": 0, "not_sold_here": 0 } } ] }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The stores written, in the shape of `GET /v1/stores`. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `idempotent-replayed` - `400` A malformed field, a repeated code, a time zone that is not IANA. — Error codes: `CORPO_NON_JSON`, `IDEMPOTENCY_KEY_MANCANTE`, `IDEMPOTENCY_KEY_TROPPO_LUNGA`, `CORPO_NON_VALIDO`, `CAMPO_OBBLIGATORIO`, `VALORE_NON_AMMESSO` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE`, `TENANT_NON_DELLA_CHIAMATA` — Headers: `x-request-id`, `x-core-version` - `409` `PUNTO_VENDITA_CON_ZONE`. — Error codes: `IDEMPOTENCY_KEY_RIUSATA`, `RICHIESTA_IN_CORSO`, `PUNTO_VENDITA_CON_ZONE` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `413` Body over the allowed limit (1 MiB). — Error codes: `CORPO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE`, `DIPENDENZA_NON_DISPONIBILE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `GET /v1/rules` `operationId`: `getRules` **Read the shop's rules** The rules document the assistant applies: minimum order, payment methods, delivery fee and free-delivery threshold per zone, bank transfer details, prepayment, cash only with own delivery, discounts (welcome, welcome back, loyalty tiers, excluded on offers), friend codes, heavy-goods extras, order edit window, checkout upsell, cart reminder, delivery slot on send; plus the `version` to start from when writing it. Only for shops created in the portal (`409 REGOLE_SOLO_NEGOZI_DEL_PORTALE`). Scope: `rules:read` ##### Example · Response 200 ```json { "data": { "version": 4, "currency": "EUR", "min_order_amount": "25.00", "payment_methods": [ "cash", "card_pos" ], "payment_methods_source": "shop", "zones": [ { "zone_slug": "centro", "is_active": true, "delivery_cost": "3.90", "free_threshold": "60.00" } ], "bank_transfer": null, "bank_transfer_ready": false, "prepaid_flow": "none", "cash_requires_own_delivery": false, "discounts": null, "friend_codes": null, "heavy_extras": null, "order_edit_window_hours": null, "checkout_upsell": null, "cart_reminder": true, "slot_on_send": "propose", "matches_version": null, "updated_at": "2026-10-31T09:15:00Z", "updated_by": "api_key:1201" }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The rules document, with `version`. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `409` `REGOLE_SOLO_NEGOZI_DEL_PORTALE`. — Error codes: `REGOLE_SOLO_NEGOZI_DEL_PORTALE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `PUT /v1/rules` `operationId`: `putRules` **Write the shop's rules, versioned** The whole document of `GET /v1/rules` with `based_on_version` (the version you read): `min_order_amount`, `payment_methods` and `zones` are required, the commercial rules optional (absent = they stay as they are). Every write that changes something creates a version, like the portal; an outdated `based_on_version` is `409 VERSIONE_CAMBIATA`. Field errors are all collected in `errors: [{field, code, message}]`, with the message in the `?lang=` language (it, en, es, fr, de, pt). Rules are one per shop: only a key of the environment the shop runs in can write them (`409 AMBIENTE_DEL_NEGOZIO`). Scope: `rules:write` ##### Parameters - `lang` · query (string) — The language of error messages (it, en, es, fr, de, pt; en by default). - `Idempotency-Key` · header (string) · required — A key chosen by the caller. The same key with the same body returns the same response without running again; with a different body it is a 409. ##### Example · Request body ```json { "based_on_version": 3, "min_order_amount": "25.00", "payment_methods": [ "cash", "card_pos" ], "zones": [ { "zone_slug": "centro", "delivery_cost": "3.90", "free_threshold": "60.00" } ], "cart_reminder": true, "slot_on_send": "propose" } ``` ##### Example · Response 200 ```json { "data": { "version": 4, "currency": "EUR", "min_order_amount": "25.00", "payment_methods": [ "cash", "card_pos" ], "payment_methods_source": "shop", "zones": [ { "zone_slug": "centro", "is_active": true, "delivery_cost": "3.90", "free_threshold": "60.00" } ], "bank_transfer": null, "bank_transfer_ready": false, "prepaid_flow": "none", "cash_requires_own_delivery": false, "discounts": null, "friend_codes": null, "heavy_extras": null, "order_edit_window_hours": null, "checkout_upsell": null, "cart_reminder": true, "slot_on_send": "propose", "matches_version": null, "updated_at": "2026-10-31T09:15:00Z", "updated_by": "api_key:1201", "changed": true }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The rules document after the write, with `version` and `changed`. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `idempotent-replayed` - `400` A field out of bounds: the first one in the envelope, all of them in `errors`. — Error codes: `CORPO_NON_JSON`, `IDEMPOTENCY_KEY_MANCANTE`, `IDEMPOTENCY_KEY_TROPPO_LUNGA`, `CORPO_NON_VALIDO`, `CAMPO_OBBLIGATORIO`, `VALORE_NON_AMMESSO`, `IMPORTO_NON_VALIDO`, `METODO_DI_PAGAMENTO_NON_AMMESSO`, `NESSUN_METODO`, `ZONA_NON_VALIDA`, `ZONA_SCONOSCIUTA`, `SOGLIA_SOTTO_IL_COSTO`, `REGOLA_SCONOSCIUTA`, `TESTO_TROPPO_LUNGO`, `IBAN_NON_VALIDO`, `BIC_NON_VALIDO`, `PERCENTUALE_NON_VALIDA`, `GIORNI_NON_VALIDI`, `GRADINI_NON_IN_ORDINE`, `CODICE_AMICO_NON_VALIDO`, `VALORE_RIPETUTO`, `TROPPI_ELEMENTI`, `TERMINE_NON_VALIDO`, `EXTRA_SENZA_CRITERIO`, `NUMERO_NON_VALIDO` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `409` `VERSIONE_CAMBIATA`, `AMBIENTE_DEL_NEGOZIO`, `COORDINATE_BANCARIE_ASSENTI` or `REGOLE_SOLO_NEGOZI_DEL_PORTALE`. — Error codes: `IDEMPOTENCY_KEY_RIUSATA`, `RICHIESTA_IN_CORSO`, `VERSIONE_CAMBIATA`, `AMBIENTE_DEL_NEGOZIO`, `COORDINATE_BANCARIE_ASSENTI`, `REGOLE_SOLO_NEGOZI_DEL_PORTALE` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `413` Body over the allowed limit (1 MiB). — Error codes: `CORPO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `POST /v1/rules/preview` `operationId`: `previewRules` **Preview what the customer will read with these rules (writes nothing)** The same body as `PUT /v1/rules` (`based_on_version` optional) plus `example_subtotal` and `lang`: the blocks the assistant would render (delivery per zone, totals, summary, minimum order) and `commerce` (each tier's discount, the friend code, the heavy-goods extra, the welcome discount that is not shown if the phrase states a different percentage), rendered by the assistant's renderer with the shop's language pack. Scope: `rules:read` ##### Example · Request body ```json { "min_order_amount": "25.00", "payment_methods": [ "cash", "card_pos" ], "zones": [ { "zone_slug": "centro", "delivery_cost": "3.90", "free_threshold": "60.00" } ], "example_subtotal": "42.00", "lang": "en" } ``` ##### Example · Response 200 ```json { "data": { "zones": [ { "zone_slug": "centro", "blocks": [ "Delivery to centro costs €3.90, free over €60.00." ] } ], "min_order": "The minimum order is €25.00.", "commerce": { "discounts": null, "friend_codes": null, "heavy_extras": null }, "missing_keys": [], "fallbacks": [] }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The preview. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `400` A field out of bounds (as in `PUT /v1/rules`). — Error codes: `CORPO_NON_JSON`, `CORPO_NON_VALIDO`, `CAMPO_OBBLIGATORIO`, `VALORE_NON_AMMESSO`, `IMPORTO_NON_VALIDO`, `METODO_DI_PAGAMENTO_NON_AMMESSO`, `NESSUN_METODO`, `ZONA_NON_VALIDA`, `ZONA_SCONOSCIUTA`, `SOGLIA_SOTTO_IL_COSTO`, `REGOLA_SCONOSCIUTA`, `TESTO_TROPPO_LUNGO`, `IBAN_NON_VALIDO`, `BIC_NON_VALIDO`, `PERCENTUALE_NON_VALIDA`, `GIORNI_NON_VALIDI`, `GRADINI_NON_IN_ORDINE`, `CODICE_AMICO_NON_VALIDO`, `VALORE_RIPETUTO`, `TROPPI_ELEMENTI`, `TERMINE_NON_VALIDO`, `EXTRA_SENZA_CRITERIO`, `NUMERO_NON_VALIDO`, `LINGUA_NON_VALIDA` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `409` `Idempotency-Key` already used for a different request, or a request still in progress. — Error codes: `COORDINATE_BANCARIE_ASSENTI`, `PACCHETTO_ASSENTE`, `REGOLE_SOLO_NEGOZI_DEL_PORTALE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `413` Body over the allowed limit (1 MiB). — Error codes: `CORPO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `GET /v1/store_texts` `operationId`: `getStoreTexts` **Read the shop's texts and site settings** The template phrases of the language pack that the shop can rewrite (with the original phrase), the assistant's hours, the departments with their emoji, the basic weekly shopping list and, in the `site` block, the site paths (categories, FAQ, offers, delivery rates). Scope: `texts:read` ##### Example · Response 200 ```json { "data": { "default_lang": "it", "languages": [ "it", "en" ], "phrases": [ { "key": "greeting", "base": "Ciao! Sono l'assistente del negozio.", "lang": "it", "text": "Ciao! Sono l'assistente di Bottega Esempio.", "customized": true } ], "assistant_hours": null, "departments": [], "weekly_shop_base_list": [ "latte", "pane", "uova", "frutta" ], "site": { "origin": "https://shop.example.invalid", "faq_path": "/faq", "offers_path": "/offerte", "category_paths": [], "delivery_rates_path": null } }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The texts and site settings. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `409` `REGOLE_SOLO_NEGOZI_DEL_PORTALE`. — Error codes: `REGOLE_SOLO_NEGOZI_DEL_PORTALE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `PUT /v1/store_texts` `operationId`: `putStoreTexts` **Write the shop's texts and site settings** Only the fields to change: `phrases: [{lang, key, text|null}]` (a phrase from the closed list, keeping the original phrase's placeholders and without links; `null` reverts to the original phrase), `assistant_hours`, `departments`, `weekly_shop_base_list`, `site: {category_paths, faq_path, offers_path, delivery_rates_path}`. Errors collected in `errors`, in the `?lang=` language. Scope: `texts:write` ##### Parameters - `lang` · query (string) — The language of error messages (it, en, es, fr, de, pt; en by default). - `Idempotency-Key` · header (string) · required — A key chosen by the caller. The same key with the same body returns the same response without running again; with a different body it is a 409. ##### Example · Request body ```json { "weekly_shop_base_list": [ "latte", "pane", "uova", "frutta" ] } ``` ##### Example · Response 200 ```json { "data": { "default_lang": "it", "languages": [ "it", "en" ], "phrases": [ { "key": "greeting", "base": "Ciao! Sono l'assistente del negozio.", "lang": "it", "text": "Ciao! Sono l'assistente di Bottega Esempio.", "customized": true } ], "assistant_hours": null, "departments": [], "weekly_shop_base_list": [ "latte", "pane", "uova", "frutta" ], "site": { "origin": "https://shop.example.invalid", "faq_path": "/faq", "offers_path": "/offerte", "category_paths": [], "delivery_rates_path": null }, "changed": true }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The texts and site settings after the write, with `changed`. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `idempotent-replayed` - `400` A field out of bounds: the first one in the envelope, all of them in `errors`. — Error codes: `CORPO_NON_JSON`, `IDEMPOTENCY_KEY_MANCANTE`, `IDEMPOTENCY_KEY_TROPPO_LUNGA`, `CORPO_NON_VALIDO`, `VALORE_NON_AMMESSO`, `REGOLA_SCONOSCIUTA`, `TROPPI_ELEMENTI`, `FRASE_NON_MODIFICABILE`, `SEGNAPOSTO_DIVERSI`, `LINK_NELLA_FRASE`, `TESTO_TROPPO_LUNGO`, `ORARI_NON_VALIDI`, `VALORE_RIPETUTO`, `TERMINE_NON_VALIDO`, `PERCORSO_NON_VALIDO` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `409` `AMBIENTE_DEL_NEGOZIO`, `PACCHETTO_ASSENTE` or `REGOLE_SOLO_NEGOZI_DEL_PORTALE`. — Error codes: `IDEMPOTENCY_KEY_RIUSATA`, `RICHIESTA_IN_CORSO`, `AMBIENTE_DEL_NEGOZIO`, `PACCHETTO_ASSENTE`, `REGOLE_SOLO_NEGOZI_DEL_PORTALE` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `413` Body over the allowed limit (1 MiB). — Error codes: `CORPO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `GET /v1/customers/{external_ref}` `operationId`: `getCustomer` **Read a customer** An `external_ref` of another account answers 404, not 403: whether someone else's record exists is not information to give out. Scope: `customers:read` ##### Parameters - `external_ref` · path (string) · required — The customer's identifier in your system. ##### Example · Response 200 ```json { "data": { "external_ref": "example-customer-001", "display_name": "Giulia Esempio", "email": "giulia@example.invalid", "phone": "+390000000001", "address": { "street": "Via delle Prove", "house_number": "1", "city": "Olbia", "postal_code": "07026" }, "attributes": { "language": "it" } }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The customer. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `404` Does not exist (or does not belong to this account). — Error codes: `NON_TROVATO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `GET /v1/orders` `operationId`: `getOrders` **Orders to take over (pull)** The alternative to webhooks for those who do not want an inbound endpoint: read `status=new` and confirm with the ack. Reads the platform's event log (outbox), filtered by the key's environment: a `test` key sees test orders, a `live` key the real ones. Scope: `orders:read` ##### Parameters - `status` · query (string) — `new` (default) or `acked`. - `limit` · query (integer) — From 1 to 200 (default 50). ##### Example · Response 200 ```json { "data": [ { "event_id": "8a4e2c10-5b3f-4d9a-b1c7-0e6f2a9d3b58", "order_id": "ORD-20261031-0042", "type": "order.confirmed", "payload": { "schema_version": 2, "order": { "id": "ORD-20261031-0042", "status": "confirmed", "lines": [ { "sku": "EXAMPLE-SPAGHETTI-500", "name": "Spaghetti di semola 500 g", "brand": "Esempio", "qty": 2, "unit": "pz", "unit_price": 1.29, "out_of_catalog": false }, { "sku": null, "name": "Basilico fresco", "brand": null, "qty": 1, "unit": null, "unit_price": null, "out_of_catalog": true } ], "totals": { "subtotal": 2.58, "discounts": 0, "delivery": 3.9, "extras": 0, "total": 6.48 }, "delivery": { "startISO": "2026-11-01T08:00:00.000Z", "endISO": "2026-11-01T10:00:00.000Z", "label": "domenica 1 novembre, 9:00-11:00" }, "customer": { "chatId": "web:7d0c2b9e", "channel": "web", "fullName": "Giulia Esempio", "address": "Via delle Prove 1", "city": "Olbia", "zip": "07026", "phone": null, "email": null, "notes": null, "missing_fields": [ "phone", "email" ] }, "notes": "Citofono Esempio", "currency": "EUR" } }, "occurred_at": "2026-10-31T09:10:00Z", "created_at": "2026-10-31T09:10:01Z", "stato": "in_attesa", "consegnato_at": null } ], "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The orders, oldest first. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `400` Invalid request: `code` says which field or header, `param` where. — Error codes: `PARAMETRO_NON_VALIDO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` `OUTBOX_ASSENTE`: the event log is not in service on this instance yet. — Error codes: `DB_URL_ASSENTE`, `OUTBOX_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `POST /v1/orders/{order_id}/ack` `operationId`: `ackOrder` **Acknowledge that you took over an order** From then on the order no longer appears in `status=new`. Acknowledging the same order twice is not an error: it returns the same response. Scope: `orders:write` ##### Parameters - `order_id` · path (string) · required — The order identifier. - `Idempotency-Key` · header (string) · required — A key chosen by the caller. The same key with the same body returns the same response without running again; with a different body it is a 409. ##### Example · Request body ```json {} ``` ##### Example · Response 200 ```json { "data": { "order_id": "ORD-20261031-0042", "status": "acked" }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` Acknowledged. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `idempotent-replayed` - `400` Invalid request: `code` says which field or header, `param` where. — Error codes: `CORPO_NON_JSON`, `IDEMPOTENCY_KEY_MANCANTE`, `IDEMPOTENCY_KEY_TROPPO_LUNGA` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `404` No order with that identifier for this account. — Error codes: `NON_TROVATO` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `409` `Idempotency-Key` already used for a different request, or a request still in progress. — Error codes: `IDEMPOTENCY_KEY_RIUSATA`, `RICHIESTA_IN_CORSO` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `413` Body over the allowed limit (1 MiB). — Error codes: `CORPO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` `OUTBOX_ASSENTE`: the event log is not in service on this instance yet. — Error codes: `DB_URL_ASSENTE`, `OUTBOX_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `POST /v1/orders/{order_id}/status` `operationId`: `reportOrderStatus` **Report where an order stands or how it went: progress and outcome** The shop says how the order went after taking it over: `delivered` (`delivered_amount` optional; absent = in full), `substituted` (delivered with substitutions; `delivered_amount` required), `not_delivered`, `returned` (returned after delivery; `delivered_amount` = what is kept, even 0). It can be reported more than once: the last report counts, and all are recorded with who made them (the key) and when. An order with no report stays as it was sent. Before the outcome the same call reports PROGRESS, which does not count for billing: `preparing`, `ready`, `out_for_delivery` and `delayed` (with the expected window `eta`, optional), `rescheduled` (with the new window `eta`, required); `reason` (a code) with `delayed`, `rescheduled` and `not_delivered`; `tracking_url` on a declared tracking domain. After an outcome progress is no longer recorded (`409`). Every recorded report becomes the `order.updated` event; the same status reported again answers `duplicate: true` without a second event. With an agent key `not_delivered` and `returned` wait for a person's approval (`202`); progress does not. Scope: `orders:write` ##### Parameters - `order_id` · path (string) · required — The order identifier (`order.id` of the `order.confirmed` event). - `Idempotency-Key` · header (string) · required — A key chosen by the caller. The same key with the same body returns the same response without running again; with a different body it is a 409. ##### Example · Request body ```json { "status": "substituted", "delivered_amount": 5.98, "note": "Latte intero sostituito con latte parzialmente scremato." } ``` ##### Example · Response 200 ```json { "data": { "order_id": "ORD-20261031-0042", "status": "substituted", "delivered_amount": 5.98, "source": "api", "reported_at": "2026-10-31T09:15:00Z", "received_at": "2026-10-31T09:15:00Z", "duplicate": false, "kind": "outcome" }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` Recorded. `duplicate` is true when the same report had already arrived. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `idempotent-replayed` - `202` Agent key, `not_delivered` or `returned`: waiting for a person's approval. Nothing has changed. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `idempotent-replayed` - `400` Invalid body: `code` says which field. — Error codes: `CORPO_NON_JSON`, `IDEMPOTENCY_KEY_MANCANTE`, `IDEMPOTENCY_KEY_TROPPO_LUNGA`, `CORPO_NON_VALIDO`, `STATO_NON_VALIDO`, `IMPORTO_NON_VALIDO`, `IMPORTO_MANCANTE`, `IMPORTO_INCOERENTE`, `DATA_NON_VALIDA`, `NOTA_TROPPO_LUNGA`, `ETA_MANCANTE`, `ETA_NON_AMMESSA`, `MOTIVO_NON_VALIDO`, `URL_NON_AMMESSO` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `404` No order with that identifier for this account and environment. — Error codes: `NON_TROVATO`, `APPROVAZIONE_SCONOSCIUTA` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `409` `TRANSIZIONE_NON_AMMESSA`: the order already has an outcome and progress is no longer recorded. — Error codes: `IDEMPOTENCY_KEY_RIUSATA`, `RICHIESTA_IN_CORSO`, `TRANSIZIONE_NON_AMMESSA`, `APPROVAZIONE_IN_ATTESA`, `APPROVAZIONE_RIFIUTATA`, `APPROVAZIONE_SCADUTA`, `APPROVAZIONE_GIA_USATA`, `APPROVAZIONE_DIVERSA` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `413` Body over the allowed limit (1 MiB). — Error codes: `CORPO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` `REGISTRO_ASSENTE`: the order register is not in service on this instance yet. — Error codes: `DB_URL_ASSENTE`, `REGISTRO_ASSENTE`, `APPROVAZIONI_ASSENTI` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `GET /v1/support_requests` `operationId`: `getSupportRequests` **Customer support requests to take over (pull)** A chat customer asked for a person, made a complaint or wants to change an order already sent: the request travels the same way as orders. Read `status=new` and confirm with the ack. Filtered by the key's environment, like orders. Scope: `orders:read` ##### Parameters - `status` · query (string) — `new` (default) or `acked`. - `limit` · query (integer) — From 1 to 200 (default 50). ##### Example · Response 200 ```json { "data": [ { "support_id": "support:web:7d0c2b9e:1", "event_id": "0c7b3e91-2f4a-4b6d-8e15-9a3c7d2f4e60", "type": "support.requested", "payload": { "schema_version": 1, "support_request": { "id": "support:web:7d0c2b9e:1", "kind": "modify_order", "outcome": "nuova", "customer_message": "Posso aggiungere del latte all'ordine di domani?", "lang": "it", "channel": "web", "order_code": "ORD-20261031-0042", "customer": { "chatId": "web:7d0c2b9e", "channel": "web", "fullName": "Giulia Esempio", "address": "Via delle Prove 1", "city": "Olbia", "zip": "07026", "phone": null, "email": null, "notes": null, "missing_fields": [ "phone", "email" ] } } }, "occurred_at": "2026-10-31T09:12:00Z", "created_at": "2026-10-31T09:12:01Z", "stato": "in_attesa", "consegnato_at": null } ], "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The requests, oldest first. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `400` Invalid request: `code` says which field or header, `param` where. — Error codes: `PARAMETRO_NON_VALIDO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` `OUTBOX_ASSENTE`: the event log is not in service on this instance yet. — Error codes: `DB_URL_ASSENTE`, `OUTBOX_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `POST /v1/support_requests/{support_id}/ack` `operationId`: `ackSupportRequest` **Acknowledge that you took over a support request** From then on the request no longer appears in `status=new`. Acknowledging the same request twice is not an error: it returns the same response. Scope: `orders:write` ##### Parameters - `support_id` · path (string) · required — The request identifier (`support_request.id`). - `Idempotency-Key` · header (string) · required — A key chosen by the caller. The same key with the same body returns the same response without running again; with a different body it is a 409. ##### Example · Request body ```json {} ``` ##### Example · Response 200 ```json { "data": { "support_id": "support:web:7d0c2b9e:1", "status": "acked" }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` Acknowledged. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `idempotent-replayed` - `400` Invalid request: `code` says which field or header, `param` where. — Error codes: `CORPO_NON_JSON`, `IDEMPOTENCY_KEY_MANCANTE`, `IDEMPOTENCY_KEY_TROPPO_LUNGA` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `404` No request with that identifier for this account. — Error codes: `NON_TROVATO` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `409` `Idempotency-Key` already used for a different request, or a request still in progress. — Error codes: `IDEMPOTENCY_KEY_RIUSATA`, `RICHIESTA_IN_CORSO` — Headers: `x-request-id`, `x-core-version`, `idempotent-replayed`, `ratelimit-policy`, `ratelimit` - `413` Body over the allowed limit (1 MiB). — Error codes: `CORPO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` `OUTBOX_ASSENTE`: the event log is not in service on this instance yet. — Error codes: `DB_URL_ASSENTE`, `OUTBOX_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `POST /v1/chat_identity_tokens` `operationId`: `createChatIdentityToken` **Open the website chat for one of your signed-in customers: a short-lived, single-use token** When the customer has signed in to your website, your server requests a token for them (`customer_ref` = their `external_ref` from `PUT /v1/customers`) and passes it to the page; the widget sends it to `core-chat /session` as `identity_token`. From then on the chat is THEIRS: the same cart and the same conversation from one visit to the next, and their history (`PUT /v1/order_history` and orders placed in chat), that is the "usual" as on WhatsApp. The token is valid for your shop and the key's environment, for at most `expires_in` seconds (300 if omitted, between 30 and 600), and ONCE only: never put it in a page a cache could serve to someone else. It is shown only in this response (our database keeps only its hash), so the route does not use `Idempotency-Key`: a repeated call mints another token, with no other effect. Without a token, or with one that does not pass, the chat stays anonymous and `/session` says why (`identity`). `chat_id` is the customer's chat identity, always the same: it is the `customer.chatId` of the orders and support requests that come from their chat. Only for shops that live on GroceryAI. Scope: `chat:write` ##### Example · Request body ```json { "customer_ref": "example-customer-001", "expires_in": 300 } ``` ##### Example · Response 200 ```json { "data": { "identity_token": "gai_cid_test_8Qm2ZpR4vT7xLc9NbF3kHs6WdJ1yAe5UoGi0XtKq", "expires_at": "2026-10-31T09:20:00Z", "chat_id": "cv_4f9a2c7e1b3d5f6a8c0e2b4d6f8a1c3e", "customer_ref": "example-customer-001" }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The token, its expiry, the customer's chat identity. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `400` Invalid body: `code` says which field. — Error codes: `CORPO_NON_JSON`, `CORPO_NON_VALIDO`, `CUSTOMER_REF_NON_VALIDO`, `DURATA_NON_VALIDA` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO`, `AMBITO_MANCANTE` — Headers: `x-request-id`, `x-core-version` - `404` `CLIENTE_SCONOSCIUTO`: no customer with that `customer_ref` for the shop and the key's environment. — Error codes: `CLIENTE_SCONOSCIUTO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `409` The shop does not use GroceryAI for its customers' identity. — Error codes: `IDENTITA_SOLO_NEGOZI_NATIVI` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `413` Body over the allowed limit (1 MiB). — Error codes: `CORPO_TROPPO_GRANDE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` `IDENTITA_NON_IN_SERVIZIO`: the identity token is not in service on this instance yet. — Error codes: `DB_URL_ASSENTE`, `IDENTITA_NON_IN_SERVIZIO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `GET /v1/approvals/{approval_id}` `operationId`: `getApproval` **The status of an approval requested by an agent key** An agent key calling a destructive operation receives `202` with an approval: a person at the shop approves or rejects it in the portal. This operation says where it stands: `pending` (waiting), `approved` (send the same request again with `GroceryAI-Approval-Id`), `rejected`, `consumed` (already used) or `expired` (72 hours without use). Only the key that requested it can see it. Scope: any valid secret key, no particular scope needed. ##### Parameters - `approval_id` · path (string) · required — The approval id (`data.id` of the `202` response). ##### Example · Response 200 ```json { "data": { "object": "approval", "id": "a0000000-0000-4000-8000-000000000001", "status": "pending", "operation_id": "deleteProduct", "method": "DELETE", "path": "/v1/products/EXAMPLE-MILK-1L", "environment": "test", "created_at": "2026-11-05T10:00:00.000Z", "expires_at": "2026-11-08T10:00:00.000Z", "decided_at": null, "consumed_at": null }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The approval. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO` — Headers: `x-request-id`, `x-core-version` - `404` `APPROVAZIONE_SCONOSCIUTA`: no approval with this id for this key. — Error codes: `APPROVAZIONE_SCONOSCIUTA` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` - `503` `APPROVAZIONI_ASSENTI`: approvals are not in service on this instance yet. — Error codes: `DB_URL_ASSENTE`, `APPROVAZIONI_ASSENTI` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit` #### `GET /v1/_deprecation_probe` `operationId`: `getDeprecationProbe` **Test route: the headers of a deprecated operation** Not a feature of the API: it exists so that integrators can see, with a `gai_test_…` key, the headers they would receive from a deprecated operation (`Deprecation`, RFC 9745; `Sunset`, RFC 8594; `Link` with `rel="deprecation"`) and test their own code that reads them. It is deprecated by construction, with a distant `Sunset`, and is never retired. It does not touch the shop's data. With a `gai_live_…` key it returns `404 ROTTA_SCONOSCIUTA`. **Deprecated** · Retired no earlier than 2099-12-31 · Test route: deprecated by construction, never retired. Scope: any valid secret key, no particular scope needed. ##### Example · Response 200 ```json { "data": { "probe": true, "deprecated_at": "2026-11-01T00:00:00Z", "sunset_at": "2099-12-31T23:59:59Z", "replacement": null, "link": "https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/openapi.json" }, "request_id": "6f1c9a2e-4b7d-4e0a-9c3f-2d8b5e7a1c40" } ``` ##### Responses - `200` The dates and the page of the test deprecation, equal to the response headers. — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `deprecation`, `sunset`, `link` - `401` Key missing, malformed, unknown, revoked or expired. — Error codes: `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SOMMA_ERRATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` — Headers: `x-request-id`, `x-core-version` - `403` The key lacks the required scope, or the account is not active. — Error codes: `TENANT_SOSPESO`, `IP_NON_AMMESSO` — Headers: `x-request-id`, `x-core-version`, `deprecation`, `sunset`, `link` - `404` `ROTTA_SCONOSCIUTA`: the key belongs to the `live` environment, where the test route does not exist. — Error codes: `ROTTA_SCONOSCIUTA` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `deprecation`, `sunset`, `link` - `429` Request limit exceeded: the store plan's rate (or the key's own per-minute cap, if it has one). `Retry-After` says how many seconds to wait. — Error codes: `LIMITE_RICHIESTE` — Headers: `x-request-id`, `x-core-version`, `retry-after`, `ratelimit-policy`, `ratelimit`, `deprecation`, `sunset`, `link` - `500` Internal error: the `request_id` identifies the call in our logs. — Error codes: `ERRORE_INTERNO` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `deprecation`, `sunset`, `link` - `503` Service unavailable on this instance: `code` says which part is missing. Retry later. — Error codes: `DB_URL_ASSENTE` — Headers: `x-request-id`, `x-core-version`, `ratelimit-policy`, `ratelimit`, `deprecation`, `sunset`, `link` #### Routing errors, on every endpoint - `404 ROTTA_SCONOSCIUTA` — No route for that method and path. - `405 METODO_NON_AMMESSO` — The path exists, but not for that method (a 404 would send you looking for a URL that does exist). #### Response headers - `x-request-id` (string) — The identifier of THIS call: equal to `request_id` in the body, except on replay (`idempotent-replayed: true`), where the body is the original call's and carries its `request_id`. - `x-core-version` (string) — The platform version that answered. - `retry-after` (integer) — Seconds to wait before retrying: until the next token of the plan's bucket, or until the end of the minute if the key's own cap refused the request. Always equal to the `t` parameter of the refusing policy in the `RateLimit` header of the same response. - `ratelimit-policy` (string) — This key's rate-limit policy, in the form of the IETF draft `draft-ietf-httpapi-ratelimit-headers` (version -11, §3). The limit comes from the store's plan and is counted with a bucket: `"key";q=;w=1;burst=`, where `q` is the sustained rate, `w` a one-second window and `burst` how many requests in a row pass when the bucket is full (an extra parameter the draft allows, §3.1 and appendix C). If the key has its own per-minute cap, lower than the plan, the list carries a second item `"key-minute";q=;w=60` (a calendar minute). Before per-plan limits the form was `"key";q=;w=60`. It is on every response of a keyed route except 401 and 403, which come before counting (like a 404 or 405 for a path that does not exist); unkeyed routes (`/v1/openapi.json`, `/v1/errors`, `/v1/status`) do not carry it. - `ratelimit` (string) — What is left, in the form of the IETF draft `draft-ietf-httpapi-ratelimit-headers` (version -11, §4): `"key";r=;t=`. `r` is how many requests this key may make right now, in a row, this one already counted (the tokens in the bucket); `t` the seconds to the next token (1 for a rate of at least one request per second). With the key's own per-minute cap there is a second item `"key-minute";r=;t=`. It comes from the same count that decides the `429`: with `r=0` the next request before `t` seconds gets `429` with `Retry-After` equal to `t`. A client that reads it slows down before getting there (for example: with a low `r`, it spreads the remaining requests over the `t` seconds). A positive `r` is not a guarantee (the draft, §8.3). - `cache-control` (string) — How long a cache may keep the response without asking again: `public, max-age=300` for the documentation, `public, max-age=30` for the service status; `no-store` on an error. - `etag` (string) — The content fingerprint (sha256 of the bytes served). Send it back in `If-None-Match` to get `304` if nothing changed. - `access-control-allow-origin` (string) — Always `*`: the documentation can also be read from a browser or a tool running in a web page. - `access-control-expose-headers` (string) — The headers a web page can read: `etag, x-request-id, x-core-version`. - `deprecation` (string) — RFC 9745: the operation is deprecated from the given date, in seconds since the epoch after `@` (for example `@1793491200`). It keeps working as before until the `Sunset`. - `sunset` (string) — RFC 8594: from this date (HTTP-date, for example `Sat, 01 Jan 2028 00:00:00 GMT`) the operation may stop responding. It is never earlier than 12 months after the `Deprecation` date. - `link` (string) — RFC 9745 §3: `
; rel="deprecation"`, the page that says what to use instead (this document: the operation carries `x-deprecation`). - `location` (string) — The address of the status of the accepted resource (`data.links.self`): read it with `GET` until it is finished. It is there also when the answer is replayed with the same `Idempotency-Key`. - `idempotent-replayed` (string) — `true` when the response is the replay of a call already executed with the same `Idempotency-Key`: same status, same body, same `request_id` as the first time, and no new execution. ### Webhook events #### `order.confirmed` A customer confirmed an order in the shop's chat. Sent once per order (`resource_id` = the order identifier) to every endpoint subscribed to `order.confirmed`; the same order can also be pulled with `GET /v1/orders`. ##### Headers - `webhook-id` · header (string) · required — The message identifier: the event `id`, the same on every attempt and on every redelivery. It is the key to drop duplicates with. - `webhook-timestamp` · header (string) · required — Unix seconds of the instant of the ATTEMPT (not of the fact): it changes on every retry. Reject a delivery more than 300 seconds away from your own clock. - `webhook-signature` · header (string) · required — One or two signatures separated by a space, each `v1,`: HMAC-SHA256 of `..` keyed with the bytes of the endpoint's secret (`whsec_`: the base64-decoded value). During a secret rotation there are two signatures, with the new secret and with the old one: one matching is enough. Verify it with the official Standard Webhooks library. - `user-agent` · header (string) · required — Always `GroceryAI-Core-Events/2`. ##### Event body ```json { "id": "8a4e2c10-5b3f-4d9a-b1c7-0e6f2a9d3b58", "type": "order.confirmed", "environment": "test", "timestamp": "2026-10-31T09:10:00Z", "occurred_at": "2026-10-31T09:10:00Z", "resource_id": "ORD-20261031-0042", "attempt": 1, "data": { "schema_version": 2, "order": { "id": "ORD-20261031-0042", "status": "confirmed", "lines": [ { "sku": "EXAMPLE-SPAGHETTI-500", "name": "Spaghetti di semola 500 g", "brand": "Esempio", "qty": 2, "unit": "pz", "unit_price": 1.29, "out_of_catalog": false }, { "sku": null, "name": "Basilico fresco", "brand": null, "qty": 1, "unit": null, "unit_price": null, "out_of_catalog": true } ], "totals": { "subtotal": 2.58, "discounts": 0, "delivery": 3.9, "extras": 0, "total": 6.48 }, "delivery": { "startISO": "2026-11-01T08:00:00.000Z", "endISO": "2026-11-01T10:00:00.000Z", "label": "domenica 1 novembre, 9:00-11:00" }, "customer": { "chatId": "web:7d0c2b9e", "channel": "web", "fullName": "Giulia Esempio", "address": "Via delle Prove 1", "city": "Olbia", "zip": "07026", "phone": null, "email": null, "notes": null, "missing_fields": [ "phone", "email" ] }, "notes": "Citofono Esempio", "currency": "EUR" } } } ``` #### `support.requested` A chat customer asks for a person, makes a complaint or wants to change an order already sent. Sent to every endpoint subscribed to `support.requested`; the same request can also be pulled with `GET /v1/support_requests`. ##### Headers - `webhook-id` · header (string) · required — The message identifier: the event `id`, the same on every attempt and on every redelivery. It is the key to drop duplicates with. - `webhook-timestamp` · header (string) · required — Unix seconds of the instant of the ATTEMPT (not of the fact): it changes on every retry. Reject a delivery more than 300 seconds away from your own clock. - `webhook-signature` · header (string) · required — One or two signatures separated by a space, each `v1,`: HMAC-SHA256 of `..` keyed with the bytes of the endpoint's secret (`whsec_`: the base64-decoded value). During a secret rotation there are two signatures, with the new secret and with the old one: one matching is enough. Verify it with the official Standard Webhooks library. - `user-agent` · header (string) · required — Always `GroceryAI-Core-Events/2`. ##### Event body ```json { "id": "0c7b3e91-2f4a-4b6d-8e15-9a3c7d2f4e60", "type": "support.requested", "environment": "test", "timestamp": "2026-10-31T09:12:00Z", "occurred_at": "2026-10-31T09:12:00Z", "resource_id": "support:web:7d0c2b9e:1", "attempt": 1, "data": { "schema_version": 1, "support_request": { "id": "support:web:7d0c2b9e:1", "kind": "modify_order", "outcome": "nuova", "customer_message": "Posso aggiungere del latte all'ordine di domani?", "lang": "it", "channel": "web", "order_code": "ORD-20261031-0042", "customer": { "chatId": "web:7d0c2b9e", "channel": "web", "fullName": "Giulia Esempio", "address": "Via delle Prove 1", "city": "Olbia", "zip": "07026", "phone": null, "email": null, "notes": null, "missing_fields": [ "phone", "email" ] } } } } ``` #### `order.updated` The shop reported where an order stands (`POST /v1/orders/{order_id}/status`): progress (preparing, ready, out for delivery, delayed, rescheduled) or an outcome (delivered, with substitutions, not delivered, returned). Sent once per report to every endpoint subscribed to `order.updated`; the same status reported again is not sent twice, and progress older than the last one reported is not sent. The order is `data.order.id`. Not available via pull. ##### Headers - `webhook-id` · header (string) · required — The message identifier: the event `id`, the same on every attempt and on every redelivery. It is the key to drop duplicates with. - `webhook-timestamp` · header (string) · required — Unix seconds of the instant of the ATTEMPT (not of the fact): it changes on every retry. Reject a delivery more than 300 seconds away from your own clock. - `webhook-signature` · header (string) · required — One or two signatures separated by a space, each `v1,`: HMAC-SHA256 of `..` keyed with the bytes of the endpoint's secret (`whsec_`: the base64-decoded value). During a secret rotation there are two signatures, with the new secret and with the old one: one matching is enough. Verify it with the official Standard Webhooks library. - `user-agent` · header (string) · required — Always `GroceryAI-Core-Events/2`. ##### Event body ```json { "id": "5d1f3a7c-2b9e-4c6d-8a0f-1e3b5c7d9f20", "type": "order.updated", "environment": "test", "timestamp": "2026-10-31T16:05:00+00:00", "occurred_at": "2026-10-31T16:05:00+00:00", "resource_id": "7b2e9c41-6a3d-4f8e-9b1c-2d4e6f8a0c13", "attempt": 1, "data": { "schema_version": 1, "order": { "id": "ORD-20261031-0042", "event_id": "7b2e9c41-6a3d-4f8e-9b1c-2d4e6f8a0c13", "status": "out_for_delivery", "kind": "progress", "reported_at": "2026-10-31T16:05:00+00:00", "eta": { "start": "2026-10-31T17:00:00+00:00", "end": "2026-10-31T18:00:00+00:00" }, "tracking_url": "https://tracking.example-carrier.com/t/ORD-20261031-0042" } } } ``` #### `catalog_import.completed` A catalog import (`POST /v1/catalog/imports`) has finished, well or badly (`data.import.status`): it arrives once per import at every endpoint subscribed to `catalog_import.completed`. It is the counterpart of Shopify's `bulk_operations/finish`: as there, a webhook delivery can go missing, and the status stays readable with `GET /v1/catalog/imports/{import_id}`. It cannot be pulled. ##### Headers - `webhook-id` · header (string) · required — The message identifier: the event `id`, the same on every attempt and on every redelivery. It is the key to drop duplicates with. - `webhook-timestamp` · header (string) · required — Unix seconds of the instant of the ATTEMPT (not of the fact): it changes on every retry. Reject a delivery more than 300 seconds away from your own clock. - `webhook-signature` · header (string) · required — One or two signatures separated by a space, each `v1,`: HMAC-SHA256 of `..` keyed with the bytes of the endpoint's secret (`whsec_`: the base64-decoded value). During a secret rotation there are two signatures, with the new secret and with the old one: one matching is enough. Verify it with the official Standard Webhooks library. - `user-agent` · header (string) · required — Always `GroceryAI-Core-Events/2`. ##### Event body ```json { "id": "9b2d4f60-1a3c-4e5f-8a7b-0c1d2e3f4a5b", "type": "catalog_import.completed", "environment": "test", "timestamp": "2026-10-31T09:19:02.000Z", "occurred_at": "2026-10-31T09:19:02.000Z", "resource_id": "3c9e7a51-2f4b-4d8e-9a16-5b7c0d2e4f81", "attempt": 1, "data": { "schema_version": 1, "import": { "id": "3c9e7a51-2f4b-4d8e-9a16-5b7c0d2e4f81", "status": "partial", "mode": "delta", "source": "url", "format": "jsonl", "received": 38412, "written": 38408, "rejected": 4, "warnings": 12, "switched_off": 0, "error": null, "finished_at": "2026-10-31T09:19:02.000Z", "links": { "self": "https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/catalog/imports/3c9e7a51-2f4b-4d8e-9a16-5b7c0d2e4f81", "errors": "https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api/v1/catalog/imports/3c9e7a51-2f4b-4d8e-9a16-5b7c0d2e4f81/errors" } } } } ``` #### `webhook.ping` The test event of the portal's "send a test event" button: a single delivery to the endpoint being tested, signed like the others. Cannot be pulled. ##### Headers - `webhook-id` · header (string) · required — The message identifier: the event `id`, the same on every attempt and on every redelivery. It is the key to drop duplicates with. - `webhook-timestamp` · header (string) · required — Unix seconds of the instant of the ATTEMPT (not of the fact): it changes on every retry. Reject a delivery more than 300 seconds away from your own clock. - `webhook-signature` · header (string) · required — One or two signatures separated by a space, each `v1,`: HMAC-SHA256 of `..` keyed with the bytes of the endpoint's secret (`whsec_`: the base64-decoded value). During a secret rotation there are two signatures, with the new secret and with the old one: one matching is enough. Verify it with the official Standard Webhooks library. - `user-agent` · header (string) · required — Always `GroceryAI-Core-Events/2`. ##### Event body ```json { "id": "e2d4f6a8-1b3c-4d5e-8f70-9a1b2c3d4e5f", "type": "webhook.ping", "environment": "test", "timestamp": "2026-10-31T09:00:00Z", "occurred_at": "2026-10-31T09:00:00Z", "resource_id": null, "attempt": 1, "data": { "test": true, "endpoint_id": 42 } } ``` #### Event delivery - Retries, in seconds after the previous attempt: 60, 300, 1800, 7200, 18000, 36000, 50400, 72000, 86400 - Maximum attempts: 10 - Time to respond: 15000 ms - Signature: `v1,` + base64(HMAC-SHA256(bytes of the `whsec_` secret, `${webhook-id}.${webhook-timestamp}.${raw body}`)); two signatures separated by a space during a rotation - Format: [Standard Webhooks 1.0.0](https://www.standardwebhooks.com) - Each delay is varied by up to 10 % so that endpoints that failed together are not retried in the same second. - Reject a delivery whose `webhook-timestamp` is more than 300 seconds away from your clock. - A `410 Gone` answer deactivates the endpoint (the portal's list of endpoints says `disabled_reason: http_410`); every other `4xx` is retried. Signature verification examples: - Signature verification with the official Standard Webhooks library (Node) (`verify-standardwebhooks.mjs`) - Signature verification with the official Standard Webhooks library (Python) (`verify_standardwebhooks.py`) - Signature verification with no dependency (Node) (`verify-signature.mjs`) - Signature verification with no dependency (Python) (`verify_signature.py`) ### Tested examples #### Signature verification with the official Standard Webhooks library (Node) (`verify-standardwebhooks.mjs`) ```javascript // Receive GroceryAI webhooks with the OFFICIAL Standard Webhooks library. Node 18+. // // npm install standardwebhooks // GAI_WEBHOOK_SECRET=whsec_... node verify-standardwebhooks.mjs # http://localhost:8080/webhooks // // The library checks webhook-id, webhook-timestamp (300 seconds tolerance) and webhook-signature (one or two `v1,` // signatures: two while a secret rotation is in progress). Pass the RAW body and the secret as the portal showed it. // Specification: https://www.standardwebhooks.com import http from 'node:http'; import { fileURLToPath } from 'node:url'; import { Webhook } from 'standardwebhooks'; /** Verify one delivery: the parsed event, or null when it is forged, altered or stale. */ export const verifyDelivery = (rawBody, headers, secret) => { try { return new Webhook(secret).verify(rawBody, headers); } catch { return null; } }; if (process.argv[1] === fileURLToPath(import.meta.url)) { const wh = new Webhook(process.env.GAI_WEBHOOK_SECRET); // "whsec_..." const seen = new Set(); // in production: a table with a unique key on webhook-id http.createServer((req, res) => { if (req.method !== 'POST' || req.url !== '/webhooks') { res.writeHead(404).end(); return; } const chunks = []; req.on('data', (c) => chunks.push(c)); req.on('end', () => { let event; try { event = wh.verify(Buffer.concat(chunks).toString('utf8'), req.headers); } catch { res.writeHead(400).end(); return; } res.writeHead(200).end('ok'); // within 15 seconds, then work if (seen.has(req.headers['webhook-id'])) return; seen.add(req.headers['webhook-id']); console.log(event.type, event.environment, event.resource_id); }); }).listen(Number(process.env.PORT ?? 8080)); } ``` #### Signature verification with the official Standard Webhooks library (Python) (`verify_standardwebhooks.py`) ```python """Receive GroceryAI webhooks with the OFFICIAL Standard Webhooks library. Python 3.8+. pip install standardwebhooks flask GAI_WEBHOOK_SECRET=whsec_... flask --app verify_standardwebhooks run --port 8080 The library checks webhook-id, webhook-timestamp (300 seconds tolerance) and webhook-signature (one or two `v1,` signatures: two while a secret rotation is in progress). Pass the RAW body and the secret as the portal showed it. Specification: https://www.standardwebhooks.com """ import os from standardwebhooks.webhooks import Webhook, WebhookVerificationError def verify_delivery(raw_body, headers, secret): """Return the parsed event, or None when the delivery is forged, altered or stale.""" try: return Webhook(secret).verify(raw_body, dict(headers)) except WebhookVerificationError: return None try: from flask import Flask, request app = Flask(__name__) seen = set() # in production: a table with a unique key on webhook-id @app.post("/webhooks") def webhooks(): event = verify_delivery(request.get_data(as_text=True), request.headers, os.environ["GAI_WEBHOOK_SECRET"]) if event is None: return "", 400 if request.headers["webhook-id"] not in seen: seen.add(request.headers["webhook-id"]) print(event["type"], event["environment"], event["resource_id"]) return "ok", 200 # within 15 seconds, then work except ImportError: # the verification above works without Flask app = None ``` #### Signature verification with no dependency (Node) (`verify-signature.mjs`) ```javascript // Verify a GroceryAI webhook delivery (Standard Webhooks 1.0.0) with NO dependency. Node 18+. // // GAI_WEBHOOK_SECRET=whsec_... node verify-signature.mjs # a minimal receiver on http://localhost:8080/webhooks // // Prefer the official library (`npm install standardwebhooks`, see verify-standardwebhooks.mjs): this file does exactly // what it does, for a runtime where you cannot add a dependency. Specification: https://www.standardwebhooks.com // // Every delivery is a POST with a JSON body and these headers: // webhook-id the message id = the event id (the same on every attempt: use it to drop duplicates) // webhook-timestamp Unix seconds of this attempt (it changes on every retry) // webhook-signature "v1," HMAC-SHA256 of `${webhook-id}.${webhook-timestamp}.${raw body}`; during a secret // rotation two of them, separated by a space: one matching is enough // // The secret is the endpoint's signing secret exactly as the portal showed it: "whsec_" + base64. The HMAC key is the // base64-DECODED bytes, not the string. Verify on the RAW bytes of the body: parsing and re-serialising the JSON changes them. import crypto from 'node:crypto'; import http from 'node:http'; import { fileURLToPath } from 'node:url'; /** The tolerance of the official libraries: five minutes covers clock drift and slow networks. */ export const TOLERANCE_SECONDS = 300; const header = (headers, name) => { for (const [k, v] of Object.entries(headers)) if (k.toLowerCase() === name) return Array.isArray(v) ? v[0] : v; return undefined; }; /** * @param {Buffer|string} rawBody the request body exactly as received * @param {Record} headers the request headers (any case) * @param {string} secret the endpoint's signing secret, "whsec_..." included * @returns {{ ok: true } | { ok: false, reason: 'bad_secret' | 'missing_headers' | 'bad_timestamp' | 'timestamp_out_of_tolerance' | 'signature_mismatch' }} */ export function verifyGroceryAiSignature(rawBody, headers, secret, { toleranceSeconds = TOLERANCE_SECONDS, now = Date.now() } = {}) { if (typeof secret !== 'string' || !secret.startsWith('whsec_')) return { ok: false, reason: 'bad_secret' }; const key = Buffer.from(secret.slice('whsec_'.length), 'base64'); if (key.length === 0) return { ok: false, reason: 'bad_secret' }; const id = header(headers, 'webhook-id'); const timestamp = header(headers, 'webhook-timestamp'); const signatures = header(headers, 'webhook-signature'); if (!id || !timestamp || !signatures) return { ok: false, reason: 'missing_headers' }; if (!/^\d+$/.test(timestamp)) return { ok: false, reason: 'bad_timestamp' }; // The timestamp is inside the signed string: an old delivery replayed later fails here, even with a valid signature. if (Math.abs(Math.floor(now / 1000) - Number(timestamp)) > toleranceSeconds) return { ok: false, reason: 'timestamp_out_of_tolerance' }; const expected = Buffer.from(crypto.createHmac('sha256', key).update(`${id}.${timestamp}.`).update(rawBody).digest('base64')); for (const versioned of String(signatures).split(' ')) { const [version, value] = versioned.split(','); if (version !== 'v1' || value === undefined) continue; const given = Buffer.from(value); if (given.length === expected.length && crypto.timingSafeEqual(given, expected)) return { ok: true }; } return { ok: false, reason: 'signature_mismatch' }; } // A minimal receiver: verify, drop duplicates, answer 2xx fast, work afterwards. if (process.argv[1] === fileURLToPath(import.meta.url)) { const secret = process.env.GAI_WEBHOOK_SECRET; if (!secret) { console.error('set GAI_WEBHOOK_SECRET'); process.exit(1); } const seen = new Set(); // in production: a table with a unique key on webhook-id http.createServer((req, res) => { if (req.method !== 'POST' || req.url !== '/webhooks') { res.writeHead(404).end(); return; } const chunks = []; req.on('data', (c) => chunks.push(c)); req.on('end', () => { const raw = Buffer.concat(chunks); const check = verifyGroceryAiSignature(raw, req.headers, secret); if (!check.ok) { res.writeHead(400).end(check.reason); return; } const event = JSON.parse(raw.toString('utf8')); res.writeHead(200).end('ok'); // within 15 seconds, or the attempt counts as failed if (seen.has(req.headers['webhook-id'])) return; seen.add(req.headers['webhook-id']); if (event.type === 'order.confirmed') console.log('order', event.data.order.id, event.environment); else if (event.type === 'support.requested') console.log('support request', event.data.support_request.id, event.data.support_request.kind); else if (event.type === 'webhook.ping') console.log('ping for endpoint', event.data.endpoint_id); }); }).listen(Number(process.env.PORT ?? 8080)); } ``` #### Signature verification with no dependency (Python) (`verify_signature.py`) ```python """Verify a GroceryAI webhook delivery (Standard Webhooks 1.0.0) with NO dependency. Python 3.8+, standard library only. Prefer the official library (`pip install standardwebhooks`, see verify_standardwebhooks.py): this file does exactly what it does, for a runtime where you cannot add a dependency. Specification: https://www.standardwebhooks.com Every delivery is a POST with a JSON body and these headers: webhook-id the message id = the event id (the same on every attempt: use it to drop duplicates) webhook-timestamp Unix seconds of this attempt (it changes on every retry) webhook-signature "v1," HMAC-SHA256 of f"{webhook-id}.{webhook-timestamp}.{raw body}"; during a secret rotation two of them, separated by a space: one matching is enough The secret is the endpoint's signing secret exactly as the portal showed it: "whsec_" + base64. The HMAC key is the base64-DECODED bytes, not the string. Verify on the RAW bytes of the body: parsing and re-serialising the JSON changes them. With Flask, for example: @app.post("/webhooks") def webhooks(): ok, reason = verify_signature(request.get_data(), request.headers, os.environ["GAI_WEBHOOK_SECRET"]) if not ok: return reason, 400 event = request.get_json() # drop duplicates by request.headers["webhook-id"], answer within 15 seconds, work afterwards return "ok", 200 """ import base64 import binascii import hashlib import hmac import time # The tolerance of the official libraries: five minutes covers clock drift and slow networks. TOLERANCE_SECONDS = 300 def verify_signature(raw_body, headers, secret, tolerance_seconds=TOLERANCE_SECONDS, now=None): """Return (True, "ok") or (False, reason). reason is one of: bad_secret, missing_headers, bad_timestamp, timestamp_out_of_tolerance, signature_mismatch. raw_body: bytes exactly as received; headers: any mapping (any case); secret: "whsec_..." included. """ if not isinstance(secret, str) or not secret.startswith("whsec_"): return False, "bad_secret" try: key = base64.b64decode(secret[len("whsec_"):], validate=True) except (binascii.Error, ValueError): return False, "bad_secret" if not key: return False, "bad_secret" lowered = {str(k).lower(): v for k, v in dict(headers).items()} msg_id = lowered.get("webhook-id") timestamp = lowered.get("webhook-timestamp") signatures = lowered.get("webhook-signature") if not msg_id or not timestamp or not signatures: return False, "missing_headers" if not str(timestamp).isdigit(): return False, "bad_timestamp" current = int(time.time()) if now is None else int(now) # The timestamp is inside the signed string: an old delivery replayed later fails here, even with a valid signature. if abs(current - int(timestamp)) > tolerance_seconds: return False, "timestamp_out_of_tolerance" if isinstance(raw_body, str): raw_body = raw_body.encode("utf-8") signed = str(msg_id).encode("utf-8") + b"." + str(timestamp).encode("ascii") + b"." + raw_body expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode("ascii") for versioned in str(signatures).split(" "): version, _, value = versioned.partition(",") if version == "v1" and hmac.compare_digest(value, expected): return True, "ok" return False, "signature_mismatch" ``` #### Pull and acknowledge (Node) (`pull-orders.mjs`) ```javascript // Take orders and support requests by pull, then acknowledge them. Node 18+, no dependencies. // // GAI_API_KEY=gai_test_... node pull-orders.mjs // // The key needs `orders:read` (to list) and `orders:write` (to acknowledge). Its environment decides what you see: // a `test` key sees test orders only, a `live` key real ones only. An item stays in `status=new` until you acknowledge // it, so a crash between "saved" and "acknowledged" only means you will see it again: store by id, idempotently. import { fileURLToPath } from 'node:url'; const BASE = process.env.GAI_API_BASE ?? 'https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-api'; const KEY = process.env.GAI_API_KEY; const call = async (method, path, idempotencyKey) => { // `x-region` runs the platform next to its database (Frankfurt): optional, it only saves latency. const headers = { authorization: `Bearer ${KEY}`, 'x-region': 'eu-central-1' }; if (idempotencyKey) headers['idempotency-key'] = idempotencyKey; const res = await fetch(`${BASE}${path}`, { method, headers }); const body = await res.json(); if (res.status === 429) { const wait = Number(res.headers.get('retry-after') ?? '60'); await new Promise((r) => setTimeout(r, wait * 1000)); return call(method, path, idempotencyKey); } if (!res.ok) throw new Error(`${method} ${path}: ${res.status} ${body.error?.code} (request_id ${body.request_id})`); return body; }; /** Your side: save the item. Must be idempotent on the id (the same item can come twice). */ const save = async (kind, id, payload) => { console.log(`saved ${kind} ${id}`, kind === 'order' ? `${payload.order.lines.length} lines` : payload.support_request.kind); }; export const pullOnce = async () => { let handled = 0; const done = new Set(); for (const [kind, list, idField, ack] of [ ['order', '/v1/orders', 'order_id', (id) => `/v1/orders/${encodeURIComponent(id)}/ack`], ['support request', '/v1/support_requests', 'support_id', (id) => `/v1/support_requests/${encodeURIComponent(id)}/ack`], ]) { // Oldest first, up to 200 per call; acknowledging is what moves the queue forward. for (;;) { const page = await call('GET', `${list}?status=new&limit=50`); if (page.data.length === 0) break; for (const item of page.data) { // An item acknowledged in this run must not come back: if it does, stop instead of looping. if (done.has(item.event_id)) throw new Error(`${kind} ${item[idField]} is still new after its ack`); done.add(item.event_id); await save(kind, item[idField], item.payload); // Acknowledging twice is not an error; the idempotency key makes a retried call harmless. await call('POST', ack(item[idField]), `ack-${item.event_id}`); handled++; } } } return handled; }; if (process.argv[1] === fileURLToPath(import.meta.url)) { if (!KEY) { console.error('set GAI_API_KEY'); process.exit(1); } pullOnce().then((n) => console.log(`done: ${n} acknowledged`)).catch((e) => { console.error(e.message); process.exit(1); }); } ``` ## GroceryAI MCP server · read-only, test environment - HTML: https://groceryai.ai/developers/mcp · Back to the API reference: https://groceryai.ai/developers A remote [Model Context Protocol](https://modelcontextprotocol.io) server that lets an AI agent (Claude Code, Claude Desktop or claude.ai, Cursor, or any MCP client) read **the test environment of your shop**: how many products you have, the products themselves, the state of the catalog, the test orders waiting to be taken over, your stores. It never writes. The numbers come from the same code that serves the REST API (`GET /v1/...`), so the agent and your code always see the same thing. Italian version: [`mcp.md`](https://groceryai.ai/it/sviluppatori/mcp). ### Address ``` https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-mcp ``` - Transport: **Streamable HTTP**, one `POST` per JSON-RPC request, JSON responses. No sessions, no SSE stream (`GET` and `DELETE` answer `405`). - Protocol versions: **`2026-07-28`** (the current revision: stateless, `server/discover`, `MCP-Protocol-Version`, `Mcp-Method` and `Mcp-Name` headers) and the earlier `2025-11-25`, `2025-06-18`, `2025-03-26` (`initialize` handshake). Clients pick automatically; today's clients mostly speak `2025-11-25`. - Protected resource metadata ([RFC 9728](https://datatracker.ietf.org/doc/html/rfc9728)), no key needed: `GET https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-mcp/.well-known/oauth-protected-resource`. A request without a key gets `401` with `WWW-Authenticate: Bearer resource_metadata="…", scope="catalog:read orders:read"`. ### The key Use a **secret test key** of your shop, `gai_test_…`, sent as `Authorization: Bearer gai_test_…` on every request. Create it in the portal under **Developers** with the scopes of the tools you want: | scope | tools | |---|---| | `catalog:read` | `count_products`, `list_products`, `get_catalog_status`, `list_stores` | | `orders:read` | `list_orders` | - **Live keys (`gai_live_…`) are refused** (`CHIAVE_LIVE_NON_AMMESSA`): this server serves only the test environment. For live data use the REST API from your own code. - **Publishable keys (`gai_pk_…`) are refused** (`CHIAVE_PUBBLICABILE_NON_AMMESSA`): they have no scopes. - A tool whose scope the key lacks answers `403` with `WWW-Authenticate: Bearer error="insufficient_scope", scope="…"` (`AMBITO_MANCANTE`). Scopes are never implied: `catalog:write` does not include `catalog:read`. - Keep the key in an environment variable (here `GROCERYAI_TEST_KEY`), never in a file you commit. Revoke it in the portal when you no longer need it. There is no OAuth sign-in yet: the key is a token you already have, like a Stripe agent key. The metadata document therefore lists no `authorization_servers`; a client that finds no key does not start an OAuth flow, it reports the `401`. ### Add it to your agent **Claude Code** (one command; the shell puts the key from your environment into the configuration): ```bash claude mcp add --transport http groceryai https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-mcp \ --header "Authorization: Bearer $GROCERYAI_TEST_KEY" ``` To share it with a project without writing the key anywhere, put this in `.mcp.json` at the project root (Claude Code expands `${GROCERYAI_TEST_KEY}` from the environment of whoever opens the project): ```json { "mcpServers": { "groceryai": { "type": "http", "url": "https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-mcp", "headers": { "Authorization": "Bearer ${GROCERYAI_TEST_KEY}" } } } } ``` **Claude Desktop and claude.ai**: Customize > Connectors > Add > Add custom connector; URL as above; Authentication **No sign in**; under **Request headers** add `Authorization` with value `Bearer gai_test_…`. The connector is called from Anthropic's cloud, so the address must be reachable from the internet (it is). **Cursor**: in `~/.cursor/mcp.json` (all projects) or `.cursor/mcp.json` (one project): ```json { "mcpServers": { "groceryai": { "url": "https://qgdwytendnvkldxmbvpu.supabase.co/functions/v1/core-mcp", "headers": { "Authorization": "Bearer ${env:GROCERYAI_TEST_KEY}" } } } } ``` Then ask: «how many products do I have?». The agent calls `count_products`. ### Tools All tools are read-only (`readOnlyHint: true`), listed in alphabetical order, and each one runs a `GET` of the REST API with the same key, scope and environment. | tool | what it returns | arguments | REST equivalent | |---|---|---|---| | `count_products` | `{environment, products, available}` | none | `GET /v1/catalog/freshness` (`products`, `available`); equals paging `GET /v1/products` to the end | | `get_catalog_status` | `{freshness, feed}`: last update, age, declared cadence, `stale`, the scheduled feed and its last run | none | `GET /v1/catalog/freshness` + `GET /v1/catalog/feed` | | `list_orders` | `{orders}`, oldest first | `status` (`new` default, `acked`), `limit` (1-200, default 50) | `GET /v1/orders` | | `list_products` | `{products, next_cursor}`, ordered by `sku` | `sku`, `gtin`, `limit` (1-200, default 50), `cursor`, `store_code` | `GET /v1/products` | | `list_stores` | `{stores}` | none | `GET /v1/stores` | Every result carries the data twice, as `structuredContent` and as JSON text in `content`. A wrong argument (unknown name, out of range, not in the list) or an error of the route (for example `PUNTO_VENDITA_SCONOSCIUTO` for an unknown `store_code`) comes back as a tool result with `isError: true` and the message, so the agent can correct itself; the error of a route is the same envelope as the REST API (`error.code`, `error.doc_url`, `request_id`). Product titles and descriptions are your shop's data: an agent should treat them as data, not as instructions. ### Limits - **The per-minute ceiling equivalent to the store's plan** (the plan's per-second rate times 60: 300 per minute for a store on trial, which uses `test` keys; the key's own cap if lower), on the same per-minute counter as the REST API: here the limit stays a one-minute window, without the REST API's bucket. Every `POST` counts once, also `initialize`, `tools/list` and `server/discover`; a tool that reads two routes still counts once. Over the limit: `429` with `Retry-After`. - **What is left**: every response to a `POST` with a valid key carries the same two headers as the REST API (IETF draft `draft-ietf-httpapi-ratelimit-headers`, version -11), computed from the same count that decides the `429`: `RateLimit-Policy: "key";q=;w=60` and `RateLimit: "key";r=;t=`. With `r=0` the next `POST` before `t` seconds receives `429`, with `r=0` and a `Retry-After` **equal** to `t`: a client that reads them slows down first. Error responses that come after the count carry them too (a body that is not JSON, the `403 insufficient_scope` of a tool, the `202` of a notification); the metadata (`/.well-known/oauth-protected-resource`), the `403` of an origin that is not allowed and the refusals of the key (`401`, a live, publishable or revoked key) come before the count and do **not** carry them. - Body up to 1 MiB; one JSON-RPC request per `POST` (no batches). - Only the test environment, only reads. Writing tools and OAuth 2.1 sign-in will come in a later version. - Requests that carry an `Origin` header are refused (`403`) unless the origin is explicitly allowed: the server is meant for agents, not for web pages. - Every authenticated request is recorded in the API audit log of your account (`route` `mcp:tools/call:`, status, duration), like REST calls. ### Errors JSON-RPC errors carry `error.data.code` (stable, the same codes as the REST API where they exist) and, where the code has a page, `error.data.doc_url`. | HTTP | `error.code` | `error.data.code` | when | |---|---|---|---| | 401 | -32001 | `CHIAVE_ASSENTE`, `CHIAVE_MALFORMATA`, `CHIAVE_SCONOSCIUTA`, `CHIAVE_REVOCATA`, `CHIAVE_SCADUTA`, `CHIAVE_INCOERENTE` | the key | | 401 | -32001 | `CHIAVE_LIVE_NON_AMMESSA`, `CHIAVE_PUBBLICABILE_NON_AMMESSA` | a key this server does not serve | | 403 | -32003 | `AMBITO_MANCANTE` (`required_scopes`), `TENANT_SOSPESO` | the scope, the account | | 403 | -32005 | `ORIGINE_NON_AMMESSA` | an `Origin` that is not allowed | | 429 | -32004 | `LIMITE_RICHIESTE` (`retry_after`) | the rate limit | | 400 | -32020 | | `MCP-Protocol-Version`, `Mcp-Method` or `Mcp-Name` do not match the body (`2026-07-28`) | | 400 | -32022 | | protocol version not served; `error.data.supported` lists the served ones | | 404 | -32601 | | method not served (`2026-07-28`) | ### Tested examples Both examples are run against the server by `tests/mcp/esempi.mjs` (on a synthetic shop of 437 products). With `curl`, one stateless request in the current revision: ```bash curl -sS "$GROCERYAI_MCP_URL" \ -H "Authorization: Bearer $GROCERYAI_TEST_KEY" \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -H "MCP-Protocol-Version: 2026-07-28" \ -H "Mcp-Method: tools/call" \ -H "Mcp-Name: count_products" \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"count_products","arguments":{},"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28"}}}' ``` The answer: `{"jsonrpc":"2.0","id":1,"result":{"resultType":"complete","content":[{"type":"text","text":"…"}],"structuredContent":{"environment":"test","products":437,"available":291},"isError":false,"_meta":{…}}}`. With the official TypeScript SDK (`npm install @modelcontextprotocol/sdk`): ```js import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'; const client = new Client({ name: 'my-integration', version: '1.0.0' }); await client.connect(new StreamableHTTPClientTransport(new URL(process.env.GROCERYAI_MCP_URL), { requestInit: { headers: { Authorization: `Bearer ${process.env.GROCERYAI_TEST_KEY}` } }, })); const result = await client.callTool({ name: 'count_products', arguments: {} }); console.log(JSON.stringify(result.structuredContent)); await client.close(); ``` It prints `{"environment":"test","products":437,"available":291}` on the synthetic shop; on yours, your numbers. ## GroceryAI API changelog · GroceryAI > Every change to the public contract of the GroceryAI API (/v1) and of its events, day by day since 7 September 2026: compatible, breaking or documentation only, with its source. - HTML: https://groceryai.ai/developers/changelog · Back to the API reference: https://groceryai.ai/developers ### GroceryAI API · changelog Every change to the public contract of the API (`/v1`) and of the events it sends, day by day since 7 September 2026. The rules on what is compatible and on deprecation are in the guide, section 10 («Versions and deprecation»). - **Compatible**: an integration written against the previous contract keeps working without changes (a new operation, a new optional field, a new response field, a new error code, a new event type). Ignore what you do not know. - **Breaking**: an integration written correctly against the previous contract may stop working, or behave differently. - **Documentation**: the document describes better what the API already did; no behaviour changed. **Before 1 November 2026 there was no versioning policy**, and some breaking changes were made inside `/v1` while the API had no integrator in production: they are listed below as **Breaking**, so that nothing is hidden. In the platform's own register (`core.api_audit`, read on 1 November 2026) the only `live` calls ever made are 17 calls of 7 September 2026, from three keys of a test account revoked the same day; no `live` key is active and no webhook endpoint is registered. From 1 November 2026 a breaking change no longer happens inside `/v1`: it comes with a new path version or through a deprecation with at least 12 months of notice (`Deprecation` and `Sunset` headers on every response). The date is the day the change was written into the published specification (`docs/openapi.json`) or, for a change of behaviour, into the code; the release that answers you is in the `x-core-version` header, and «live from» names the first release that carried it where the platform's records say so. Each entry cites its source in the history of the platform (commit). This file is checked against the history of the specification by `tests/api/registro-contro-storia.mjs`: every operation and event type that ever appeared in the specification has its entry on the day it appeared. #### 2026-11-09 - **Compatible** · new operation `POST /v1/catalog/imports`: the whole catalog in one call, **asynchronously**. Up to 50,000 products in the body (`products`: the same items as `PUT /v1/products`, GS1 codes included), a CSV in the body (`Content-Type: text/csv`, the columns of the portal file, `mode` in the query), or the `url` of a file (`format`: `json`, `jsonl`, `csv`, `xlsx`, `google_merchant_xml`, `google_merchant_tsv`). The body can be up to 16 MiB on this operation only (1 MiB everywhere else, unchanged). The answer is an immediate `202` with the import (`status: queued`) and a `Location` header; the import is written afterwards in chunks of 500 with the same rules as `PUT /v1/products` (merge by `sku`) or as the portal file, and with `mode: snapshot` it withdraws at the end the active products it does not carry, behind the 90 % gate (with an agent key, `mode: snapshot` waits for a person's approval). At most 5 unfinished imports per environment (`409 IMPORTAZIONI_IN_CORSO`). New error code `IMPORTAZIONI_IN_CORSO` (`409`). Live from the database migration `20261109100000` and the release of `core-api` and `core-events` that carries it. Source: corsia MASSIVO-1. - **Compatible** · new operations `GET /v1/catalog/imports` (the imports of the environment, most recent first, cursor pagination), `GET /v1/catalog/imports/{import_id}` (the status: `queued`, `running`, `succeeded`, `partial`, `failed`, with the counts while it works) and `GET /v1/catalog/imports/{import_id}/errors` (the rejected rows, or the warnings with `type=warnings`, row by row, with `index` of the JSON item or `row` of the file). New error code `IMPORTAZIONE_SCONOSCIUTA` (`404`). Source: corsia MASSIVO-1. - **Compatible** · new event type `catalog_import.completed` (`schema_version` 1): once per import, whatever its outcome (`data.import.status`), to every webhook endpoint subscribed to it, signed like every other event. `resource_id` is the import id. Not available via pull: the status stays readable with `GET /v1/catalog/imports/{import_id}`. The portal accepts `catalog_import.completed` among the event types of an endpoint. Source: corsia MASSIVO-1. - **Documentation** · the pages of `CORPO_TROPPO_GRANDE` and `LOTTO_TROPPO_GRANDE` name the two limits (1 MiB and 500 items per call; 16 MiB and 50,000 items for `POST /v1/catalog/imports`). Source: corsia MASSIVO-1. - **Compatible** · `GET /v1/status`: every component's `availability` may carry two new fields, `month` (the current calendar month in UTC, so far) and `previous_month` (the closed one, `null` if the component was not measured yet), with the rule of the service commitments (`docs/api/impegni-di-servizio.en.md`): `measured_minutes`, `outage_minutes`, `degraded_minutes`, `downtime_minutes` (`outage` and `degraded` together), `availability_percent`, `objective_percent` and `objective_met`. The `30d` and `90d` windows are unchanged. The fields appear once the release that carries them and the database migration `20261109060000` are live; until then they are absent, never estimated. Source: corsia IMPEGNI-1 (commit `bcc4c28b`). - **Compatible** · **Limits per plan, with bursts absorbed.** The request limit of a key no longer is the same 120 per minute for everyone, counted in fixed one-minute windows: it comes from the store's plan and is counted with a bucket per key (guide, §4, «Limits per plan»): trial 5 requests per second with a burst of 120; `small` 25 per second (burst 250), `mid` 50 (burst 500), `enterprise` 100 (burst 1000) for `live` keys; `test` keys lower (10 to 25 per second). No plan goes below the previous ceiling (2 per second sustained, 120 in a row). A request the bucket refuses does not use up tokens. A key minted with `rate_limit_per_min` keeps it as its own cap, when lower than the plan; a key minted without it now follows the plan instead of 120 per minute. Headers: `RateLimit-Policy` becomes `"key";q=;w=1;burst=` (still «`q` requests in `w` seconds», draft -11 §3; `burst` is an extra parameter, §3.1) and `RateLimit` `"key";r=;t=`; a key with its own cap adds a `"key-minute"` item to both lists. `Retry-After` stays equal to the `t` of the policy that refused. A client that reads `q` together with `w`, as the draft says, needs no change; one that assumed `w=60` reads the new window from `w`. The MCP server keeps one-minute windows, on the plan's equivalent per-minute ceiling. Source: branch `corsia/LIMITI-PIANO-1` (`src/api/limiti.ts`, migration `20261109070000_limiti_piano1_limiti_per_piano.sql`). #### 2026-11-06 - **Compatible** · `POST /v1/orders/{order_id}/status` also reports the order's **progress**, before the outcome: five new values of `status` (`preparing`, `ready`, `out_for_delivery`, `delayed`, `rescheduled`) and three new optional fields (`eta` with `start` and `end`, the expected or agreed window, required with `rescheduled`; `reason`, a code among `stock`, `capacity`, `traffic`, `weather`, `customer_request`, `shop_request`, `failed_attempt`, `other`, with `delayed`, `rescheduled` and `not_delivered`; `tracking_url`, `https` on a tracking domain declared for the shop). Progress never counts for billing: the last outcome still decides, exactly as before. No value accepted before is refused now. The response carries a new field `kind` (`outcome` or `progress`), echoes `eta`, `reason` and `tracking_url` when sent, and `superseded: true` for progress older than the last one reported. New error codes: `ETA_MANCANTE`, `ETA_NON_AMMESSA`, `MOTIVO_NON_VALIDO`, `URL_NON_AMMESSO` (`400`), `TRANSIZIONE_NON_AMMESSA` (`409`: progress after an outcome). Guide, section 7-bis. Live from the release that carries it and from the database migration `20261106160000` (until then a progress value answers `503 REGISTRO_ASSENTE`). Source: corsia P163-A. - **Compatible** · new event type `order.updated` (`schema_version` 1): one delivery per recorded report (progress or outcome) to every webhook endpoint subscribed to it, signed like every other event (Standard Webhooks). `resource_id` is the identifier of the report (`data.order.event_id`); the order is `data.order.id`. The same status reported again is not sent twice; progress older than the last one is not sent. No customer data and no amounts in the body. Not available via pull. The portal accepts `order.updated` among the event types of an endpoint. Source: corsia P163-A. #### 2026-11-05 - **Compatible** · rate-limit headers in the form of the IETF draft `draft-ietf-httpapi-ratelimit-headers` (version -11): every response of a keyed route, except `401`, `403` and the `404`/`405` of a path that does not exist, carries `RateLimit-Policy: "key";q=;w=60` and `RateLimit: "key";r=;t=`, from the same count that decides the `429`; the `429` carries `r=0` and a `Retry-After` equal to `t`. The routes without a key do not carry them. Same limits as before (120 per minute per key unless set differently). Guide, section 4. Source: corsia LIMITI-API-1. - **Compatible** · the MCP server (`core-mcp`) carries the same `RateLimit-Policy` and `RateLimit` headers on every response that follows the count of the key (also its error responses after the count and the `429`, whose `Retry-After` equals `t`); the metadata, an origin that is not allowed and the refusals of the key come before the count and do not carry them. Same limit and same counter as before. `docs/api/mcp.en.md`, «Limits». Source: corsia LIMITI-API-2. - **Compatible** · SDKs (TypeScript and Python, the hand-written client): when a response says `r=0`, the client waits `t` seconds before its next request instead of being refused with `429`; a missing or unreadable header changes nothing. On by default, off with `throttle: false` / `throttle=False`; the retry on `429` after `Retry-After` is unchanged. `docs/api/sdk.md`. Source: corsia LIMITI-API-2. - **Compatible** · new operation `GET /v1/status`, without a key: the status of each component of the service (`assistant`, `web_chat`, `api`, `events`, `portal`, `mcp`) as `operational`, `degraded`, `outage` or `unknown`, from the same rules as the alarms that measure the service every minute; the availability of the last 30 and 90 days on measured minutes only; the latest incidents. `Cache-Control: public, max-age=30`, `ETag` and `304`. New error code `503 STATO_NON_MISURABILE` (the status cannot be read: unknown, not operational). Source: corsia STATO-PUBBLICO-1. - **Compatible** · `GET /v1/status`: the `mcp` component is now measured by its own probe (until now it was always `unknown`), and the availability of every component counts from when its own probe started, not from the start of the alarms' history: `mcp` from 5 November 2026, the others from 24 October 2026. A component whose probe has not completed a round yet is `unknown`. Same fields, same schema. Source: corsia STATO-MCP-1. - **Compatible** · new key format with a checksum: new keys look like `gai_live_ab12cd34_` followed by 38 characters (32 random, then a 6-character checksum: CRC32 of everything before it, in base 62). Keys created before keep working without changes. A key in the new format whose checksum is wrong is refused before any lookup with the new error code `401 CHIAVE_SOMMA_ERRATA`. Source: corsia KEYS-2. - **Compatible** · optional IP allowlist per secret key (set in the portal): a request from an address outside the list, or whose origin address is unknown, is refused with the new error code `403 IP_NON_AMMESSO` on every route with a key. Keys without a list behave as before. Source: corsia KEYS-2. - **Compatible** · agent keys and human approval: a secret key marked as an agent key in the portal receives `202` with an approval on the destructive operations (`DELETE /v1/products/{sku}`; `POST /v1/products/snapshots/{snapshot_id}/commit` without `dry_run`; `POST /v1/orders/{order_id}/status` with `not_delivered` or `returned`), and nothing changes until a person approves it in the portal; then the same request sent again with the header `GroceryAI-Approval-Id` runs once. New operation `GET /v1/approvals/{approval_id}`; new error codes `APPROVAZIONE_SCONOSCIUTA`, `APPROVAZIONE_IN_ATTESA`, `APPROVAZIONE_RIFIUTATA`, `APPROVAZIONE_SCADUTA`, `APPROVAZIONE_GIA_USATA`, `APPROVAZIONE_DIVERSA`, `APPROVAZIONI_ASSENTI`. Keys that are not agent keys behave as before. Source: corsia KEYS-2. - **Compatible** · food information of Article 14 of Regulation (EU) 1169/2011 in the catalog: new optional product fields `allergens` and `may_contain` (the 14 allergens of Annex II as contract codes, or their GS1 `AllergenTypeCode`; `none` in `allergens` declares none of them), `ingredients`, `nutrition_basis` (`100g`/`100ml`) with `energy_kj`, `energy_kcal`, `fat_g`, `saturated_fat_g`, `carbohydrate_g`, `sugars_g`, `protein_g`, `salt_g`, `fibre_g`, `storage_conditions`, `usage_instructions`, `food_business_operator`, `origin`, `alcohol_percent`, `food_info_url`; same fields in the portal file, its templates and the feed. New error code `INFORMAZIONI_ALIMENTARI_INCOERENTI` and new warnings `ENERGIA_NON_COERENTE`, `NUTRIZIONE_INCOMPLETA`. Items without these fields behave as before. Source: corsia CAT-1169-1. #### 2026-11-01 - **Compatible** · new test route `GET /v1/_deprecation_probe` (`gai_test_…` keys only; `404 ROTTA_SCONOSCIUTA` with a live key): it carries the `Deprecation` (RFC 9745), `Sunset` (RFC 8594) and `Link: rel="deprecation"` headers of a deprecated operation, so you can test the code that reads them. It is deprecated by construction and is never retired. From today a deprecated operation carries `deprecated: true` and `x-deprecation` in the specification and the three headers on every response once the route is known (not on a `401`). No real operation is deprecated. Source: corsia VER-1, `e7238d40`. - **Compatible** · `GET /v1/products`: `next_cursor` is present only when another page really exists (on a last page that happens to be full it is now `null`; before, it was set on every full page and the next call came back empty). Following `next_cursor` until `null` returns the same products. Live from `core-api` v23. Source: `96118f03`, `c4fcfa0d` (SANDBOX-2). #### 2026-10-31 - **Breaking** · webhooks follow **Standard Webhooks 1.0.0**: the headers `webhook-id` (the event id, the same on every retry), `webhook-timestamp` (Unix seconds of the attempt) and `webhook-signature: v1,` over `..` (two signatures during a secret rotation) replace the five `x-gai-*` headers; the event type and the attempt stay in the body (`type`, `attempt`). Verify with the official `standardwebhooks` library. No endpoint was registered when the format changed. Live from `core-events` v20. Source: `525691396`, `7cc675668`, merged in `4b0a71225` (HOOK-STD-1). - **Breaking** · the signing secret is `whsec_` and the HMAC key is the decoded bytes (before: `whsec_` and 64 hexadecimal characters, used whole). Source: `525691396` (HOOK-STD-1). - **Breaking** · how your receiver's answer is read: `410 Gone` **disables the endpoint** (no more deliveries until it is created again); redirects are not followed; `Retry-After` lengthens the wait (at most 24 hours); every other 4xx/5xx is retried. Source: `525691396` (HOOK-STD-1). - **Compatible** · longer retries and more time to answer: ten attempts over about three days (immediately, then 1 min, 5 min, 30 min, 2 h, 5 h, 10 h, 14 h, 20 h, 24 h, with ±10 % jitter) instead of six in about 8.5 hours; 15 seconds to answer instead of 10. Source: `525691396` (HOOK-STD-1). - **Compatible** · every event body carries the new field `timestamp` (equal to `occurred_at`). Source: `7cc675668` (HOOK-STD-1). - **Compatible** · secret rotation from the portal, with two valid signatures for an overlap of up to 72 hours (a portal route, not `/v1`). Source: `b40a428eb` (HOOK-STD-1). - **Compatible** · new operations `GET /v1/errors` and `GET /v1/errors/{code}`: the catalog of error codes, readable without a key; every error response carries the new field `error.doc_url`, the page of its code. Live from `core-api` v21. Source: `f85bb86f`, merged in `2cfb89f3` (DOCS-AGENTI-1). - **Compatible** · `GET /v1/openapi.json` is readable **without a key**, with `ETag`, `Cache-Control: public, max-age=300`, `304` on `If-None-Match` and `Access-Control-Allow-Origin: *`. Live from `core-api` v21. Source: `f85bb86f` (DOCS-AGENTI-1). - **Documentation** · the specification is published in English, with a tested request and response example for every operation and event; the `limit` bounds (1 to 200) already enforced by the code are written in the schemas; `AGENTS.md`, the integration prompt and the quickstart. Source: `f85bb86f` (DOCS-AGENTI-1). - **Compatible** · `PUT /v1/customers` also accepts the field names of the customer model (`customer_ref` as an alternative to `external_ref`, `full_name`, `street`, `house_number`, `city`, `postal_code`, `floor`, `intercom`, `delivery_notes`, `language`, `exemption`); a field of neither list is not written and the response says so in `warnings` (`CAMPO_SCONOSCIUTO`). Live from `core-api` v19. Source: `81f58e6d`, merged in `db852976` (VALID-1). - **Breaking** · `PUT /v1/customers`: the phone must be international E.164 (`TELEFONO_NON_E164`; before, any text was accepted) and is stored as `+` and digits; new rejections `CAMPO_IN_DUE_POSTI`, `VALORE_NON_AMMESSO`, `TESTO_TROPPO_LUNGO`. Live from `core-api` v19. Source: `81f58e6d` (VALID-1). #### 2026-10-30 - **Breaking** · `PUT /v1/products` became a **merge**: on a product that already exists only the fields the item names are updated, `attributes` are merged and a key set to `null` is removed (before, an item with only the price cleared the other fields). Live from `core-api` v16. Source: `c3be5b5e2`, `5f57be07` (DATA-C2). - **Breaking** · the catalog contract fields (`min_order_qty`, `min_order_unit`, `sold_by_weight`, `avg_piece_weight_kg`, `items_per_pack`, `pack_only`, `stock_managed`, `unit_price`, `gross_weight_kg`, `tare_kg`, `list_price`, `subcategory`, `vat_rate`, `diet_tags`, the `offer_*` fields) are typed fields of the product and are validated **also when they arrive inside `attributes`**, where before they entered unchecked; new item codes `NUMERO_NON_VALIDO`, `UNITA_NON_AMMESSA`, `DATA_NON_VALIDA`, `BOOLEANO_NON_VALIDO`, `VALORE_NON_AMMESSO`, `DATE_INVERTITE`, `CAMPO_IN_DUE_POSTI`. Source: `c3be5b5e2` (DATA-C2). - **Compatible** · the batch responses of products, inventory and customers carry the new field `warnings` (the item is written, but something in it will not be used, for example `OFFERTA_NON_SCONTATA`). Source: `5f57be07` (DATA-C2). - **Breaking** · `PUT /v1/inventory`: an item with `store_code` is rejected (`PUNTO_VENDITA_SCONOSCIUTO`) unless the shop has that point of sale; before, `store_code` was ignored and the price applied to the whole shop. Source: `c3be5b5e2` (DATA-C2). - **Compatible** · `PUT /v1/inventory` also accepts the strike-through `list_price`, the offer fields (`offer_price`, `offer_start`, `offer_end`, `offer_min_qty`, `offer_label`; `null` removes) and `is_online`. Source: `5f57be07` (DATA-C2). - **Compatible** · new operations for the catalog lifecycle: `DELETE /v1/products/{sku}` (withdraw a product: it is switched off, not deleted; sending it again puts it back on sale), `POST /v1/products/snapshots` and `POST /v1/products/snapshots/{snapshot_id}/commit` (a full snapshot that switches off what it does not contain, with a 90 % gate; optional `snapshot_id` in `PUT /v1/products`), `GET /v1/catalog/freshness`, `GET /v1/catalog/feed`, `PUT /v1/catalog/feed` and `POST /v1/catalog/feed/run` (a scheduled catalog feed). Live from `core-api` v16; the freshness read answered `500` on v16 and works from v17. Source: `5f57be07`, `359226607` (DATA-C2, API-TX1). - **Compatible** · new operation `PUT /v1/order_history` with the new scope `history:write` (shops that live on GroceryAI only). Source: `201de93f`, merged in `50b4b304` (DATA-C3). - **Compatible** · new operation `POST /v1/chat_identity_tokens` (scope `chat:write`, secret key): opens the site chat to a customer signed in on your site. Source: `a1d2e892`, merged in `e36ff354` (WEB-ID-1). - **Compatible** · new operations `GET /v1/rules`, `PUT /v1/rules`, `POST /v1/rules/preview`, `GET /v1/store_texts` and `PUT /v1/store_texts` with the new scopes `rules:read`, `rules:write`, `texts:read`, `texts:write`; their error envelope may carry a list `errors` next to `error`. Live from `core-api` v17. Source: `cf3546b0`, merged in `853b5293` (DATA-C4). - **Compatible** · new operations `GET /v1/stores` and `PUT /v1/stores` (points of sale; the `PUT` is the whole list); `PUT /v1/inventory` accepts a declared `store_code`; optional `store_code` parameter in `GET /v1/products`. Live from `core-api` v18. Source: `8db0588e`, merged in `3eaac8ed` (DATA-C6). #### 2026-10-27 - **Compatible** · new field `order.currency` (ISO 4217) in the orders of shops that live on GroceryAI. Live from `core-chat` v66 and `core-events` v16. Source: `b28ae23a` (COMM-4B). #### 2026-10-26 - **Compatible** · in the order event, `order.customer.phone` and `email` are filled when the customer gave them in the chat (fields that already existed and could be `null`). Source: `e1c7a56d7` (ORD-6). #### 2026-10-23 - **Breaking** · `Idempotency-Key` is scoped to the shop **and the environment** (before, the same key used first with a `test` key and then with a `live` one replayed the test response in live without writing) and **expires after 24 hours** (before, never). Live from `core-api` v14. Source: `8327216b` (SEC-2). - **Compatible** · new scope `chat:write` (opening chat sessions from your server with the secret key). Source: `8327216b` (SEC-2). #### 2026-10-22 - **Breaking** · the meaning of `delivered_amount` in `POST /v1/orders/{order_id}/status` changed: from «the value of the goods, without delivery or extras» to «the total the customer paid for what was delivered, delivery and extras included». The route accepts the same body; what the shop must send changed. Source: `05f4c844` (BILL-2). #### 2026-10-21 - **Compatible** · new operation `POST /v1/orders/{order_id}/status`: the shop reports what happened to an order (delivered, substituted, not delivered, returned). Live from `core-api` v13. Source: `aaf3773d`, merged in `098d60ef` (BILL-1). #### 2026-10-13 - **Documentation** · the specification describes the events sent to your endpoint, `order.confirmed`, `support.requested` and `webhook.ping` (section `webhooks`), the shapes of every response, the error codes per status and the headers; `info.version` stays `1.0.0`. The guides for integrators are published. Source: `6d4643a5`, `0e3b08c69` (PORTAL-D10). - **Compatible** · a failure between the reservation of an `Idempotency-Key` and the handler no longer leaves the key stuck (before: `500`, then `409 RICHIESTA_IN_CORSO` forever; now the retry replays the `500`). Live from `core-api` v8. Source: `d6c9e326b` (PORTAL-D10). #### 2026-10-12 - **Compatible** · new operations `GET /v1/support_requests` and `POST /v1/support_requests/{support_id}/ack`: customer support requests in pull, with acknowledgement; new event type `support.requested`. Live from `core-api` v7. Source: `6d34ddcf` (P232). #### 2026-10-11 - **Compatible** · the order event `order.confirmed` reaches version 2 (`schema_version: 2`): `order.customer` carries `channel`, `fullName`, `address`, `city`, `zip`, `phone`, `email`, `notes`, `missing_fields`; no field removed. Source: `cafb061b0` (ORD-1), `51547f1a9` (ORD-3). #### 2026-10-07 - **Compatible** · a second kind of key, the publishable `gai_pk__…`, without scopes: on `/v1` it opens nothing (`403 AMBITO_MANCANTE`); a key whose name and record disagree on its kind gets `401 CHIAVE_INCOERENTE`. Source: `c0cb23b9a` (W1). #### 2026-09-14 - **Breaking** · `PUT /v1/products`: a price in a currency other than the shop's is a rejected item (before, any ISO 4217 code was accepted). Source: `32173ff30` (D4). - **Compatible** · new header `x-core-version` on every response (the release that answered). Source: `9d1d53bff` (P29). #### 2026-09-07 - **Compatible** · first published contract: `GET /v1/openapi.json`, `PUT /v1/products`, `GET /v1/products`, `PUT /v1/inventory`, `PUT /v1/customers`, `GET /v1/customers/{external_ref}`, `GET /v1/orders` and `POST /v1/orders/{order_id}/ack`; API keys per account with environment (`test`, `live`) and scopes, rate limit with `Retry-After`, batches of up to 500 items validated one by one, `Idempotency-Key` on writes, `request_id` on every response, one error format. Source: `18453327` (D1). - **Compatible** · signed webhooks (`x-gai-signature: sha256=`, HMAC-SHA256 of timestamp and body) with retries. Source: `78ce7e5fd` (D2). - **Breaking, reverted the same day** · `GET /v1/orders` and `POST /v1/orders/{order_id}/ack` answered `409` to `test` keys; the same day the `409` became a filter: a `test` key sees the test orders, a `live` key the real ones, and every event carries `environment`. Source: `c78c8e11`, `def35b43` (D1, D3).