Stock count lines
What a count found: expected and counted quantity per item and lot, the variance, the adjustment applied and the location on-hand after posting.
Stock count lines
Objects
StocktakeLine
idintegerrequiredID of the record, unique among records of its kind in the store.
stocktake_idintegerrequiredStock count ID (/v1/stocktakes).
variant_idinteger or nullrequiredProduct variant ID (/v1/variants). null — the item was erased from the catalog before stock count lines started holding it (November 2026); such a line has no quantities.
lot_idinteger or nullrequiredLot ID (/v1/lots); null for the lot-less axis. At a location with bins an item has a line per bin and lot — their sum is the location figure.
expectedstring or nullrequiredBook quantity of the axis at the time of counting, as a decimal string in the variant unit — the base of the variance. null for a blind count while it is a draft.
countedstring or nullrequiredQuantity counted on the axis; null — not counted yet, and posting leaves such a line alone.
variancestring or nullrequiredVariance: counted minus expected. null while the line is not counted or the book quantity is hidden.
adjustmentstring or nullrequiredAdjustment applied by posting, signed. It may differ from variance: sales between counting and posting and packed pieces held by orders are not in it. null before posting.
on_hand_afterstring or nullrequiredPhysical on-hand of the item at the location right after posting — the same for all lines of the item. null before posting and for a skipped line.
skip_reasonstring or nullrequiredWhy posting skipped a counted line: variant_deleted — the item was deleted; not_tracked — stock tracking was switched off for the item. null — the line was not skipped.
- Values:
variant_deletednot_trackednull
created_atstring (date-time)requiredWhen the record was created.
updated_atstring (date-time)requiredWhen the record last changed.
Endpoints
Stock count lines: expected, counted, variance and adjustment, changed since a given moment
get/stocktake-lines
Scope: inventory:read
Parameters
Query
limitintegerPage size: up to 250 records; 50 by default.
- Minimum:
- 1
- Maximum:
- 250
cursorstringOpaque 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})$
include_deletedbooleantrue — also return deleted records: archived ones with deleted_at set, and records erased from the database as tombstones {id, deleted_at} in the continuation by the sync cursor. Turn it on for a sync.
stocktake_idintegerOnly lines of this stock count.
- Minimum:
- 1
variant_idintegerOnly lines of this variant.
- Minimum:
- 1
Responses
200Success
application/json
Records of the page.
deletedarray of objectrequiredRecords erased from the database since the cursor, as tombstones: only with include_deleted=true in the continuation by the sync cursor.
Fields · 2
idintegerrequiredID of the erased record.
deleted_atstring (date-time)requiredWhen the record was erased.
next_cursorstring or nullrequiredCursor of the next page; null on the last page.
has_morebooleanrequiredtrue when there is a next page.
sync_cursorstring or nullrequiredOn 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-AuthenticatestringrequiredAuthentication 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-AuthenticatestringAuthentication 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-AfterintegerrequiredSeconds to wait before retrying.
- Minimum:
- 0
application/problem+json
Returns RateLimitProblem
503The store is temporarily unavailable
Headers
Retry-AfterintegerSeconds 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
curl "https://api.saleya.app/v1/stocktake-lines" \
-H "Authorization: Bearer $SALEYA_API_TOKEN"{
"data": [
{
"id": 0,
"stocktake_id": 0,
"variant_id": 0,
"lot_id": 0,
"expected": "string",
"counted": "string",
"variance": "string",
"adjustment": "string",
"on_hand_after": "string",
"skip_reason": "variant_deleted",
"created_at": "2026-01-15T12:00:00Z",
"updated_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 count line
get/stocktake-lines/{stocktake_line}
Scope: inventory:read
Parameters
Path
stocktake_lineintegerrequiredStock count line ID.
Responses
200Success
application/json
Returns StocktakeLine
401The token is missing, invalid, expired or revoked
Headers
WWW-AuthenticatestringrequiredAuthentication 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-AuthenticatestringAuthentication 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-AfterintegerrequiredSeconds to wait before retrying.
- Minimum:
- 0
application/problem+json
Returns RateLimitProblem
503The store is temporarily unavailable
Headers
Retry-AfterintegerSeconds 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
curl "https://api.saleya.app/v1/stocktake-lines/{stocktake_line}" \
-H "Authorization: Bearer $SALEYA_API_TOKEN"{
"id": 0,
"stocktake_id": 0,
"variant_id": 0,
"lot_id": 0,
"expected": "string",
"counted": "string",
"variance": "string",
"adjustment": "string",
"on_hand_after": "string",
"skip_reason": "variant_deleted",
"created_at": "2026-01-15T12:00:00Z",
"updated_at": "2026-01-15T12:00:00Z"
}