Stock history of a variant, newest first
GET
/api/v1/workspaces/{workspaceId}/inventory-items/{inventoryItemId}/movements
const url = 'https://api.crossmart.io/api/v1/workspaces/example/inventory-items/example/movements?reason=OPENING_BALANCE&direction=desc&limit=25';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://api.crossmart.io/api/v1/workspaces/example/inventory-items/example/movements?reason=OPENING_BALANCE&direction=desc&limit=25'Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”workspaceId
required
string
inventoryItemId
required
string
Query Parameters
Section titled “Query Parameters”reason
One of RECEIVED, CORRECTION, RETURNED, DAMAGED, LOST, SOLD. The other reasons are recorded by Crossmart.
string
direction
string
cursor
string format: uuid
nextCursor from the previous page
page
number
1-based page number, for tables with page numbers. It wins over cursor.
limit
number
Responses
Section titled “Responses”Media typeapplication/json
object
items
required
Array<object>
object
id
required
string format: uuid
delta
required
Units added (positive) or removed (negative)
number
reason
required
string
quantityAfter
required
Stock on hand right after this movement
number
note
required
string
userName
required
The user who made the change; null for API keys and changes made by Crossmart
string
apiKeyName
required
The API key that made the change, if any
string
createdAt
required
string format: date-time
nextCursor
required
Null on the last page
string
total
required
How many match in all, for page numbers
number
Example
{ "items": [ { "reason": "OPENING_BALANCE" } ]}