Stock movements

Journal of a location's physical stock: sales, receipts, write-offs, stocktakes, transfers and their reversals. Append-only.

Loading the search index…

Stock movements

Objects

StockMovement

  • idintegerrequired

    ID of the record, unique among records of its kind in the store.

  • variant_idintegerrequired

    Product variant ID (/v1/variants).

  • location_idinteger or nullrequired

    Location of the movement (/v1/locations); null for a movement from the journal before locations, visible only to an app not limited to locations.

  • lot_idinteger or nullrequired

    Lot ID (/v1/lots); null for a product without lots.

  • quantitystringrequired

    Signed change to the location's physical stock, as a decimal string in the variant unit: above zero came in, below zero went out. The sum per variant × location pair is its on_hand.

  • on_hand_afterstring or nullrequired

    Physical stock of the location after the movement — the same as the inventory level on_hand, as a decimal string; null for a movement from the journal before locations.

  • reasonstringrequired

    Movement reason — the full stock list. Group by category instead: a new reason arrives in one of the known columns.

    Values:
    order_reserveorder_releaserestockrefund_restockreturn_restockpos_tab_roundorder_editspoilageshort_pickmanual_adjustshrinkageinternal_usetype_change_writeoffprep_consumption_writeoffunit_mergemeasure_basis_changepiece_reweighpiece_shrinkageexternal_inboundexternal_reconcilereceipt_voidreceipt_correctionsupplier_returnsupplier_return_voidsupplier_return_correctionimport_revertlot_relabelstocktakebin_transferlocation_transfergroup_transfer_outgroup_transfer_ingroup_transfer_returnproduction_consumeproduction_outputproduction_voidrestock_voidspoilage_voidshrinkage_voidinternal_use_voidmanual_adjust_voidshort_pick_void
  • categorystringrequired

    Stock ledger column: sale — sale and its returns; receipt — goods receipt and its reversal; external — import and reconciliation with an external system; production_output and production_consume — production output and consumption; spoilage — spoilage; shrinkage — shrinkage; internal_use — own use; stocktake — stocktake variance; correction — record correction; supplier_return — return to supplier; transfer — relocation and transfer; group_transfer — transfer between stores of the group, at cost; technical — change of stock unit.

    Values:
    salereceiptexternalproduction_outputproduction_consumespoilageshrinkageinternal_usestocktakecorrectionsupplier_returntransfergroup_transfertechnical
  • documentobject or nullrequired

    Primary document of the movement; null for a manual correction, picking or a technical movement.

    Fields · 2
    • typestringrequired

      Document type: goods_receipt — goods receipt (/v1/goods-receipts); stocktake — stock count (/v1/stocktakes); stock_write_off — write-off; production_order — production order; location_transfer — transfer between locations (/v1/location-transfers); group_transfer — transfer between stores of the group, this store's copy; supplier_return — return to supplier (/v1/supplier-returns); order — order (/v1/orders). An order movement inside a document belongs to that document.

      Values:
      goods_receiptstocktakestock_write_offproduction_orderlocation_transfergroup_transfersupplier_returnorder
    • idintegerrequired

      Document ID.

  • write_off_reason_idinteger or nullrequired

    Write-off reason ID (/v1/write-off-reasons); null for other movements.

  • reverses_movement_idinteger or nullrequired

    ID of the movement this one reverses; null for a regular movement.

  • posting_idstring or nullrequired

    Posting: one UUID shared by all movements of one operation; null for a movement before postings.

  • commentstring or nullrequired

    Staff comment on a manual correction; null if there is none.

  • created_atstring (date-time)required

    When the record was created.

Endpoints

Stock movement journal: every change to a location's physical stock

get/stock-movements

Scope: inventory:read

Parameters

Query

  • limitinteger

    Page size: up to 250 records; 50 by default.

    Minimum:
    1
    Maximum:
    250
  • cursorstring

    Opaque cursor: next_cursor of the previous page, or sync_cursor of the last page saved by the previous sync. The list goes in commit order, so the sync cursor later returns only what changed after it.

    Max length:
    4096
  • updated_sincestring (date-time)

    Only records changed after this moment, ISO 8601 with a time zone. A filter for the first sync; continue with the cursor.

    Pattern:
    ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,6})?(Z|[+-]\d{2}:\d{2})$
  • variant_idinteger

    Only movements of this variant.

    Minimum:
    1
  • location_idinteger

    Only movements at this location.

    Minimum:
    1
  • lot_idinteger

    Only movements of this lot.

    Minimum:
    1
  • document_typestring

    Primary document type, together with document_id: only movements whose primary document it is.

    Values:
    goods_receiptstocktakestock_write_offproduction_orderlocation_transfergroup_transfersupplier_returnorder
  • document_idinteger

    Primary document ID, together with document_type.

    Minimum:
    1

Responses

200Success

application/json

  • dataarray of StockMovementrequired

    Records of the page.

  • deletedarray of objectrequired

    Records erased from the database since the cursor, as tombstones: only with include_deleted=true in the continuation by the sync cursor.

    Fields · 2
    • idintegerrequired

      ID of the erased record.

    • deleted_atstring (date-time)required

      When the record was erased.

  • next_cursorstring or nullrequired

    Cursor of the next page; null on the last page.

  • has_morebooleanrequired

    true when there is a next page.

  • sync_cursorstring or nullrequired

    On the last page — the cursor to continue from later: it returns only what changed after this page. null on other pages.

401The token is missing, invalid, expired or revoked

Headers

  • WWW-Authenticatestringrequired

    Authentication scheme (RFC 6750).

    Example:
    Bearer

application/problem+json

Returns Problem

403The plan, the IP address or the token scopes do not allow the request

Headers

  • WWW-Authenticatestring

    Authentication scheme (RFC 6750).

    Example:
    Bearer error="insufficient_scope", scope="locations:read"

application/problem+json

Returns ForbiddenProblem

410The sync cursor is older than the deletion retention period or was issued before the database was restored

application/problem+json

Returns Problem

422A parameter is invalid or unknown

application/problem+json

Returns ValidationProblem

429The rate limit is exhausted

Headers

  • Retry-Afterintegerrequired

    Seconds to wait before retrying.

    Minimum:
    0

application/problem+json

Returns RateLimitProblem

503The store is temporarily unavailable

Headers

  • Retry-Afterinteger

    Seconds to wait before retrying.

    Minimum:
    0

application/problem+json

Returns Problem

Errors of this endpoint

Common errors such as token, access, input validation and rate limit can come from any endpoint; they are listed in the catalog: Errors

Example request
curl "https://api.saleya.app/v1/stock-movements" \
  -H "Authorization: Bearer $SALEYA_API_TOKEN"
Example response · 200
{
  "data": [
    {
      "id": 0,
      "variant_id": 0,
      "location_id": 0,
      "lot_id": 0,
      "quantity": "string",
      "on_hand_after": "string",
      "reason": "order_reserve",
      "category": "sale",
      "document": {
        "type": "goods_receipt",
        "id": 0
      },
      "write_off_reason_id": 0,
      "reverses_movement_id": 0,
      "posting_id": "string",
      "comment": "string",
      "created_at": "2026-01-15T12:00:00Z"
    }
  ],
  "deleted": [
    {
      "id": 0,
      "deleted_at": "2026-01-15T12:00:00Z"
    }
  ],
  "next_cursor": "string",
  "has_more": true,
  "sync_cursor": "string"
}

Stock movement

get/stock-movements/{stock_movement}

Scope: inventory:read

Parameters

Path

  • stock_movementintegerrequired

    Stock movement ID.

Responses

200Success

application/json

Returns StockMovement

401The token is missing, invalid, expired or revoked

Headers

  • WWW-Authenticatestringrequired

    Authentication scheme (RFC 6750).

    Example:
    Bearer

application/problem+json

Returns Problem

403The plan, the IP address or the token scopes do not allow the request

Headers

  • WWW-Authenticatestring

    Authentication scheme (RFC 6750).

    Example:
    Bearer error="insufficient_scope", scope="locations:read"

application/problem+json

Returns ForbiddenProblem

404The object does not exist or is not available to the app

application/problem+json

Returns Problem

422A parameter is invalid or unknown

application/problem+json

Returns ValidationProblem

429The rate limit is exhausted

Headers

  • Retry-Afterintegerrequired

    Seconds to wait before retrying.

    Minimum:
    0

application/problem+json

Returns RateLimitProblem

503The store is temporarily unavailable

Headers

  • Retry-Afterinteger

    Seconds to wait before retrying.

    Minimum:
    0

application/problem+json

Returns Problem

Common errors such as token, access, input validation and rate limit can come from any endpoint; they are listed in the catalog: Errors

Example request
curl "https://api.saleya.app/v1/stock-movements/{stock_movement}" \
  -H "Authorization: Bearer $SALEYA_API_TOKEN"
Example response · 200
{
  "id": 0,
  "variant_id": 0,
  "location_id": 0,
  "lot_id": 0,
  "quantity": "string",
  "on_hand_after": "string",
  "reason": "order_reserve",
  "category": "sale",
  "document": {
    "type": "goods_receipt",
    "id": 0
  },
  "write_off_reason_id": 0,
  "reverses_movement_id": 0,
  "posting_id": "string",
  "comment": "string",
  "created_at": "2026-01-15T12:00:00Z"
}