Skip to content

List a variant's inventory history

GET
/stores/{storeRef}/products/{productId}/variants/{variantId}/inventory-history
curl --request GET \
--url 'https://apibase.ecomweb.app/api/v1/stores/example/products/1/variants/1/inventory-history?limit=50' \
--header 'x-api-key: <x-api-key>'

Returns the variant’s stock adjustments, newest first, each with the quantity changed and the stock before and after.

Required scopes: read:products

productId
required
integer

The product ID.

variantId
required
integer

The variant ID.

storeRef
required
string

The store’s ref, as returned by GET /stores.

limit
integer
default: 50 <= 200

Maximum number of adjustments to return. Defaults to 50 and is capped at 200.

Media typeapplication/json
Array<object>
object
transaction_type
required

Kind of change: deduct, restore, reserve, release or adjustment.

string
Allowed values: deduct restore reserve release adjustment
reason
required

Why the stock changed, such as manual_adjustment or order_placed.

string
Allowed values: order_placed order_cancelled order_refunded manual_adjustment damaged returned
id

Adjustment ID.

number
variant_id
required

ID of the variant.

number
quantity
required

Number of units changed (always positive).

number
previous_inventory
required

Stock before the change.

number
new_inventory
required

Stock after the change.

number
reference_id

ID of the related record, such as an order, or null.

number
nullable
reference_type

Type of the related record, or null.

string
nullable
notes

Free-text note, or null.

string
nullable
created_by

Who made the change, or null for the system.

string
nullable
created_at

When the change happened, as an ISO 8601 timestamp.

string

Example

[
{
"transaction_type": "deduct",
"reason": "order_placed"
}
]

The key is missing, invalid, revoked or expired.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

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.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}

The resource does not exist in this store.

Media typeapplication/json
One of:
object
statusCode
required

The HTTP status code.

number
message
required

What went wrong; validation failures list one message per problem.

One of:
string
error

The HTTP status text, such as Bad Request.

string

Example generated

{
"statusCode": 1,
"message": [
"example"
],
"error": "example"
}