List stock levels
const url = 'https://apibase.ecomweb.app/api/v1/stores/example/inventory/levels?limit=20&offset=0&sort_by=product_name&sort_order=asc&filters=%5B%7B%22field%22%3A%22available%22%2C%22operator%22%3A%22lte%22%2C%22values%22%3A%5B%220%22%5D%7D%5D';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/levels?limit=20&offset=0&sort_by=product_name&sort_order=asc&filters=%5B%7B%22field%22%3A%22available%22%2C%22operator%22%3A%22lte%22%2C%22values%22%3A%5B%220%22%5D%7D%5D' \ --header 'x-api-key: <x-api-key>'Returns a page of stock levels, one row per variant, with the quantity in each stock state. Use limit and offset to page, search to match product name or SKU and sort_by to order the rows. filters takes a JSON array of {field, operator, values} clauses, for example available at most 0 to find sold-out variants.
Required scopes: read:inventory
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The store’s ref, as returned by GET /stores.
Query Parameters
Section titled “Query Parameters”Maximum number of rows to return, 1 to 100. Ignored by the export.
Number of rows to skip. Ignored by the export.
Matches product name or SKU
Field to sort by.
Sort direction.
Example
[{"field":"available","operator":"lte","values":["0"]}]List-view filters: a JSON array of {field, operator, values}.
Responses
Section titled “Responses”object
object
What happens when stock runs out: deny stops sales, continue keeps selling.
Variant ID.
ID of the product the variant belongs to.
Product name.
Product image URL, or null.
The variant’s option values joined with /, or null for a product without options.
Stock keeping unit, or null.
ID of the location that holds the stock.
Whether stock is tracked for the variant.
Units that can be sold now.
Units reserved by orders that are not yet fulfilled.
Units set aside as damaged.
Units set aside for quality control.
Units held back as safety stock.
Units set aside for another reason.
Total of damaged, quality control, safety stock and other.
Units physically held: available, committed and unavailable together.
Units expected from open purchase orders.
When the level last changed, as an ISO 8601 timestamp.
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": [ { "inventory_policy": "deny" } ]}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"}