List Stock Levels
GET /v1/nextrestaurant/locations/{locationId}/stock-levels
What is on hand at a location
Needs inventory:read and the Inventory app. Ordered by stock item id.
Request
GET https://your-site.example/api/index.php/v1/nextrestaurant/locations/{locationId}/stock-levels?low=<string>&limit=<integer>&cursor=<string>
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
locationId |
integer |
path |
Yes | (min 1) |
low |
string |
query |
No | true = only levels at or below their reorder point. One of true, false. |
limit |
integer |
query |
No | Page size. Above 100 is clamped to 100; meta.limit says what was used. (min 1, max 100) Defaults to 25. |
cursor |
string |
query |
No | The meta.next_cursor of the previous page. Opaque; do not build one. |
Responses
200 — One page.
{
"data": [
{
"stock_item_id": 1,
"location_id": 1,
"sku": "string",
"title": "string",
"unit": "kg",
"quantity": 1.5,
"par_level": 1.5,
"reorder_point": 1.5,
"low": true,
"is_86": true,
"last_counted_at": "string",
"updated_at": "string"
}
],
"meta": {
"limit": 1,
"next_cursor": "string"
}
}
| Field | Type | Meaning |
|---|---|---|
data[].stock_item_id |
integer |
|
data[].location_id |
integer |
|
data[].sku |
string|null |
|
data[].title |
string |
|
data[].unit |
string|null |
|
data[].quantity |
number |
|
data[].par_level |
number|null |
|
data[].reorder_point |
number|null |
|
data[].low |
boolean |
At or below the reorder point. |
data[].is_86 |
boolean |
|
data[].last_counted_at |
string|null |
|
data[].updated_at |
string|null |
|
meta.limit |
integer |
The page size used. |
meta.next_cursor |
string|null |
Pass as cursor for the next page; null on the last page. |
Errors
| Status | Code | When |
|---|---|---|
400 |
INVALID_CURSOR: use meta.next_cursor exactly as given. |
|
401 |
INVALID_TOKEN |
The token is missing, wrong, or none has been generated. |
403 |
INSUFFICIENT_SCOPE |
This API key does not have the permission this request needs. |
403 |
MODULE_DISABLED |
This module is disabled. |
403 |
API_DISABLED |
API is disabled |
404 |
UNKNOWN_LOCATION |
No such published location. |
429 |
RATE_LIMITED |
Too many requests. RATE_LIMITED with a Retry-After header: this key used its budget for the minute, or this address sent 20 bad tokens in 5 minutes. Nothing ran, so the request is safe to retry after the wait. |
Examples
curl
curl -s "https://your-site.example/api/index.php/v1/nextrestaurant/locations/1/stock-levels" \
-H "Authorization: Bearer $API_TOKEN"
PHP
<?php
$ch = curl_init('https://your-site.example/api/index.php/v1/nextrestaurant/locations/1/stock-levels?low=<string>&limit=<integer>&cursor=<string>');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('API_TOKEN'),
],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
JavaScript
const API_TOKEN = process.env.API_TOKEN;
const response = await fetch("https://your-site.example/api/index.php/v1/nextrestaurant/locations/1/stock-levels?low=<string>&limit=<integer>&cursor=<string>", {
headers: {
"Authorization": `Bearer ${API_TOKEN}`,
},
});
const data = await response.json();