Skip to main content

REST API: Production sync and stock movements

Provisional documentation to get changes and deletions of productions and record stock entries and exits.

Provisional documentation. These endpoints are not implemented yet and may change before they are published.

Keep a synchronised copy of productions and record stock entries and exits in a store.

GET  /integration/productions/changes
GET /integration/productions/deletes
POST /integration/stores/movements

Before you start

Base URL: https://app.tspoonlab.com/recipes/api

Headers

  • rememberme · required — Session token returned by login.

  • order · optional — Cost center id (Cost centers). Defaults to the user's active center.

Login — Returns the token as plain text.

curl https://app.tspoonlab.com/recipes/api/login \
-d [email protected] \
-d password=XXXXXXX

Permissions — Productions require permission to view production. Store movements require permission to edit stores.

Dates — Returned in milliseconds since 1970 (epoch). When sending them, milliseconds or full ISO 8601 (2026-10-30T09:00:00.000+01:00) are accepted.

Responses may include fields other than those documented. Use only the documented ones.


Sync productions

Works like the purchase and sales sync: /changes returns the productions created or modified and /deletes the deleted ones. Each one has its own cursor.

  1. First call without cursor: returns every production of the center in changes. To start from a given day, send changedSince.

  2. While hasMore is true, call again with the cursor received.

  3. Save the last cursor. On the next sync, call with it: you will only get what has changed.

GET /integration/productions/changes

Query parameters

  • cursor string · optional — Cursor from the previous call. When sent, changedSince and $filter are ignored.

  • changedSince date · optional — Changes since this day, as YYYY-MM-DD. Cannot be later than today.

  • $filter string · optional — OData filter, same syntax as purchases and sales. It is stored in the cursor: send it only on the first call.

  • rows integer · optional — Productions per page, 1 to 100. Default 100.

$filter fields: dateStarted, dateDone (date), idComponent (id), descr (text), type (number, with eq, ne and in).

Example — Productions finished since 1 January 2026:

curl -G https://app.tspoonlab.com/recipes/api/integration/productions/changes \
-H "rememberme: $TOKEN" \
--data-urlencode '$filter=dateDone ge 2026-01-01'

Response

{
"changes": [
{
"id": "3515834441676562996102020301",
"idProduction": "3515834441676562996102020302",
"dateStarted": 1767258000000,
"dateDone": 1767272400000,
"idComponent": "3515834441676562996102020303",
"descr": "Tomato sauce",
"type": 1,
"createdAt": 1767254400000,
"updatedAt": 1767272400000,
"listUnits": [
{
"idUnit": "3515834441676562996102020304",
"descrUnit": "kg",
"quantity": 20.0,
"quantityReal": 18.5
}
]
}
],
"cursor": "MjAyNi0wMS0wMSAxMzowMDowMC4wfDM1MTU4MzQ0NDE2NzY1NjI5OTYxMDIwMjAzMDE",
"hasMore": false
}

Each production in changes:

  • id string — Identifier of the item production. It is the idProductionComponent of the Productions API.

  • idProduction string — Identifier of the production day it belongs to.

  • dateStarted date — When the production starts. The ingredients leave the store at this moment. null if it has not started.

  • dateDone date — When the production ends. The finished product enters the store at this moment and can be sold. null if it has not finished.

  • idComponent string — Identifier of the product being produced.

  • descr string — Product name.

  • type number — Product type: 1 recipe · 3 dish.

  • createdAt, updatedAt date — Creation and last modification.

  • listUnits array — Quantities per unit.

Each quantity (listUnits):

  • idUnit, descrUnit string — Unit: id and name.

  • quantity number — Planned quantity to produce.

  • quantityReal number — Quantity actually produced. null if not reported.

Keep in mind

  • All productions are returned, including those not started or not finished. The date when the finished product enters the store is dateDone. To get only finished ones, filter on dateDone, for example dateDone ne null.

  • Some productions last a long time (for example, a curing process of several months). Months can pass between dateStarted and dateDone, and the production appears in changes every time it is modified.

  • Starting, finishing or reopening a production is a modification: it appears in changes with the same id. When reopened, dateDone goes back to null.

  • A change in the quantities (listUnits) is also a modification of the production.

  • Production tasks, which do not produce any product, are not returned.

  • Changes from the last 5 minutes arrive on the next call. Each id appears only once per page.

Deleted — Deleted productions are in /integration/productions/deletes.

curl -G https://app.tspoonlab.com/recipes/api/integration/productions/deletes \
-H "rememberme: $TOKEN" \
--data-urlencode cursor=$CURSOR_DELETES
{
"deletes": [
{ "id": "3515834441676562996102020309", "deletedAt": 1767268800000 }
],
"cursor": "djJ8LXwyMDI2LTAxLTAxIDEyOjAwOjAwLjB",
"hasMore": false
}
  • Parameters: cursor, changedSince and rows, as in /changes. $filter is not accepted: it returns every deleted production of the center. Delete the ids you have and ignore the rest.

  • Without cursor or changedSince, it starts with the oldest deletion kept.

  • A reopened production has not been deleted: it appears in /changes.

Errors — An invalid cursor, changedSince or $filter, or rows out of range, returns 400 with code, message and params.


Record store entries and exits

Adds or subtracts product quantities in a store. Each call is one movement with one or more lines. Positive quantities are entries and negative ones are exits. They are recorded as manual stock movements, like an adjustment made in tSpoonLab.

POST /integration/stores/movements

Body

  • externalId string · required — Reference of the movement in your system, up to 128 characters. If the same one is sent again, it is not duplicated (see Retries).

  • idStore string · required — Store (see Stores). Must belong to the active cost center.

  • date date · required — Movement date. Stock is recalculated from this date.

  • comment string · optional — Reason or comment.

  • lines array · required — 1 to 100 lines.

Each line (lines):

  • idComponent string · required — Product or recipe. If it is not in the store yet, it is added.

  • idUnit string · required — Unit of the quantity. Must be a unit of the product.

  • quantity number · required — Positive for an entry and negative for an exit. Cannot be 0.

  • cost number · optional — Cost per unit. Without cost, the current product cost is used.

  • lot string · optional — Lot.

Example

curl -X POST https://app.tspoonlab.com/recipes/api/integration/stores/movements \
-H "rememberme: $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"externalId": "A3-MOV-2026-000123",
"idStore": "3515834441676562996102020101",
"date": "2026-01-15T10:00:00.000+01:00",
"comment": "Adjustment",
"lines": [
{ "idComponent": "3515834441676562996102020303", "idUnit": "3515834441676562996102020304", "quantity": 12.5, "lot": "L260115" },
{ "idComponent": "3515834441676562996102020305", "idUnit": "3515834441676562996102020304", "quantity": -3 }
]
}'

Response

{
"id": "3515834441676562996102020310",
"externalId": "A3-MOV-2026-000123",
"created": true
}
  • id string — Movement identifier in tSpoonLab.

  • externalId string — The reference sent.

  • created boolean — true if it was recorded now and false if it had already been received.

Retries — If you get no response, send the same movement again with the same externalId. If it was already recorded, the response returns the same id with created set to false and it is not added again.

Keep in mind

  • The movement is recorded in full or not at all: if one line is invalid, none is saved.

  • To correct a movement, send another one with the opposite quantity and a new externalId.

  • To move stock between stores or centers, use transfers. To record a production, use the Productions API.

Errors — A missing required field, a store, product or unit that does not exist or does not belong to the center, or a quantity of 0, returns 400 with code, message and params.

Need help? Write to us from the support chat, in the bottom right corner.

Did this answer your question?