Get a variant's stock history
const url = 'https://apibase.ecomweb.app/api/v1/stores/example/inventory/variants/1/history?limit=50&offset=0';const options = {method: 'GET', headers: {'x-api-key': '<x-api-key>'}};
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://apibase.ecomweb.app/api/v1/stores/example/inventory/variants/1/history?limit=50&offset=0' \ --header 'x-api-key: <x-api-key>'Returns a page of the stock adjustments of one variant, newest first. Each entry says who made the change, why, and the order or purchase order behind it, if any. Use limit and offset to page.
Required scopes: read:inventory
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The variant ID.
The store’s ref, as returned by GET /stores.
Query Parameters
Section titled “Query Parameters”Maximum number of entries to return.
Number of entries to skip.
Responses
Section titled “Responses”object
object
Why the stock changed.
The order or purchase order that caused the change, or null.
object
What kind of record it is.
The record’s ID.
A readable label, such as the order code.
Adjustment ID.
When it happened, as an ISO 8601 timestamp.
The note given with the change, or null.
Who made the change.
object
Kind of actor.
Actor ID: a staff user ID or an API key ID. Null for the system.
Display name of the staff member or API key, or null when it cannot be resolved.
The changes to this variant’s stock states.
object
The stock state that changed.
How much it changed by. Negative for a decrease.
The quantity in that state after the change.
object
Total number of items matching the request.
Maximum number of items in this page.
Number of items skipped before this page.
Current page number, starting at 1.
Total number of pages.
Whether a next page exists.
Whether a previous page exists.
Example
{ "data": [ { "reason": "correction", "reference": { "type": "order" }, "actor": { "type": "staff" }, "changes": [ { "state": "available" } ] } ]}The request is malformed or failed validation.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key is missing, invalid, revoked or expired.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The resource does not exist in this store.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}