Valikko

This page exists in one language only. Some pages here are English, some Swedish.

Public Intake API

Use this API to submit source data to Stockisto's ingestion pipeline. It is a separate credential class from the tenant read and write API, and every batch lands in a staging store before anything reaches live data.

Get the right key

A StockistoAdmin issues an intake key for one tenant. The key carries the isolated api:intake scope and travels in the X-API-Key header. A tenant Developers key with api:read or api:write cannot call this API, and an intake key cannot call the tenant read or write endpoints.

At issuance the StockistoAdmin binds the key to one source: scraper, delegated or crowd. The envelope's source and every record-level provenance.source must match that binding. The key is shown once; keep it in your server-side secret store. A key may carry an expiry date, and a revoked or expired key answers 401 like an unknown one.

Submit a batch

Use the v1 envelope. Replace only the angle-bracket placeholders. The example uses scraper; use the source bound to your own key.

submit request

curl -X POST https://api.test.stockisto.com/api/public/v1/intake/batches \
  -H "X-API-Key: <YOUR_INTAKE_KEY>" \
  -H "Content-Type: application/json" \
  --data '{
    "contractVersion": "1.0",
    "source": "scraper",
    "idempotencyKey": "<UNIQUE_BATCH_KEY>",
    "records": [
      {
        "kind": "retailer-company",
        "naturalKey": "<UNIQUE_RETAILER_KEY>",
        "payload": { "name": "<RETAILER_NAME>" }
      }
    ]
  }'

A new batch returns 202 Accepted with the batch id and a status link. A retry with the same idempotencyKey from the same key returns 200 with the existing batch and stages nothing again.

Envelope fields

FieldRule
contractVersionRequired, must be 1.0.
sourceRequired, must equal the key's bound source.
idempotencyKeyRequired, up to 200 characters, unique per tenant.
descriptionOptional, up to 500 characters.
metadataOptional JSON object stored on the batch, for example { "country": "SE" }.
records1 to 50,000 entries.
records[].kindRequired. supplier-company, retailer-company, installer-company and retailer-stock have appliers today; other kinds stay staged.
records[].naturalKeyRequired for those four kinds, up to 512 characters. A row of one of those kinds without a key is rejected per record; the batch still goes through.
records[].payloadRequired JSON object, up to 256 KB.
records[].provenanceOptional: source (must match the key), fetchedAt (UTC; a future time is rejected), confidence (0 to 1), sourceRef (up to 1024 characters).

A record that fails validation is rejected on its own and listed under the batch's validationErrors. The rest of the batch continues. The whole batch is refused only when the envelope is invalid or every record fails.

Read a batch back

GET /api/public/v1/intake/batches/<BATCH_ID>

GET /api/public/v1/intake/batches lists the batches this key submitted. A batch submitted by another key is reported as unknown, even when it belongs to the same tenant.

Batch statuses: received, validated, staged, in_review, applied, partially_applied, rejected.

The review gate

Batches from scraper, delegated and crowd sources stop at in_review until a Stockisto operator approves them, unless the operator has granted your tenant and source an auto-apply trust flag. A batch whose changes would remove an unusually large share of live rows is always held for review. Read status, not the record count, to know whether a batch reached live data.

Optionally, the StockistoAdmin registers an https callback URL with your key. When a batch reaches applied, partially_applied or rejected, a signed import.completed delivery is sent there.

Operations

OperationPurpose
POST /api/public/v1/intake/batchesSubmit one v1 envelope.
GET /api/public/v1/intake/batchesList batches submitted by this key.
GET /api/public/v1/intake/batches/<BATCH_ID>Read one batch's status with the submitting key.

Limits

LimitValue
Request body64 MB
Records per batch50,000
Payload per record256 KB
Requests per key30 per minute
Batches per key per UTC day200 by default; set at issuance, up to 10,000
Records per key per UTC day500,000 by default; set at issuance, up to 10,000,000

A rate-limit refusal returns 429 with Retry-After. A daily-quota refusal returns 429 with error: "intake_quota_exceeded" and a quota object that carries the limits, today's usage and resetAt. A retry of a batch you already submitted still answers 200, even when the quota is exhausted.

Diagnose a response

StatusMeaningNext step
200This key already submitted a batch with this idempotencyKey. The existing batch is returned.Nothing; the retry added no volume.
202The batch was accepted and staged.Poll the status link.
400The envelope is invalid.Correct the reported fields and submit a new valid batch.
401The key is missing, invalid, expired or revoked.Ask the StockistoAdmin to issue or rotate the key.
403The source does not match the key, or the credential is not an intake key.Use the bound source and an api:intake key.
404The batch id is unknown to this key. Another key's batch is deliberately indistinguishable from an unknown id.Read the batch with the submitting key.
409The idempotencyKey belongs to another credential.Choose a new idempotency key.
413The body is over 64 MB, or the batch has more than 50,000 records.Split the batch and submit smaller parts.
429The request rate or the daily volume limit is exhausted.Honor Retry-After, or wait for resetAt.

cebf50c · 2026-10-05 22:57