Stock. 18 operations.
18 of them work. Each needs a bearer token with its scope. All operations.
Operations
POST/api/v1/stock/damagestock.damagestock.write
GET/api/v1/stock/levels/{sku}stock.levelsstock.read
GET/api/v1/stock/locations/{key}/levelsstock.location-levelsstock.read
Parameters
keypath | string |
keypath | string |
afterquery | stringThe SKU to go on after: the page's next; none for the first page. |
limitquery | integerHow many levels, at most 1000; 500 when left out. |
Answer
Errors: 401, 403, 404, 405, 422, 429
curl -X GET -H "Authorization: Bearer $TOKEN" https://yourshop.example/api/v1/stock/locations/{key}/levels
GET/api/v1/stock/locationsstock.locationsstock.read
GET/api/v1/stock/lowstock.lowstock.read
Parameters
limitquery | integerThe most variants in the page: 1 to 200. |
afterquery | stringThe cursor of the page: the next of the page before; the first page when left out. The variants follow it. |
Answer
Errors: 401, 403, 405, 422, 429
curl -X GET -H "Authorization: Bearer $TOKEN" https://yourshop.example/api/v1/stock/low
GET/api/v1/stock/movementsstock.movementsstock.read
Parameters
skuquery | stringOnly the movements of this variant. |
locationquery | stringOnly the movements at this stock location. |
reasonquery | stringOnly the movements of this reason. |
limitquery | integerThe most movements in the page: 1 to 200; 50 when left out. |
beforequery | integerThe id of a movement: the page holds the movements before it. |
fromquery | stringOnly the movements from this date or time (a date in the store time zone, or a time with its offset). |
toquery | stringOnly the movements up to this date or time (a date in the store time zone, or a time with its offset). |
Answer
Errors: 401, 403, 405, 422, 429
curl -X GET -H "Authorization: Bearer $TOKEN" https://yourshop.example/api/v1/stock/movements
POST/api/v1/stock/receiptsstock.receivestock.write
GET/api/v1/stock/reportstock.reportstock.read
Parameters
skuquery | stringOnly this variant. |
locationquery | stringOnly this stock location. |
fromquery | stringThe start of the period (a date in the store time zone, or a time with its offset). |
toquery | stringThe end of the period (a date in the store time zone, or a time with its offset). |
limitquery | integerThe most rows in the page: 1 to 200. |
afterquery | stringThe cursor of the page: the next of the page before; the first page when left out. The rows follow it. |
Answer
Errors: 401, 403, 405, 422, 429
curl -X GET -H "Authorization: Bearer $TOKEN" https://yourshop.example/api/v1/stock/report
POST/api/v1/stock/locationsstock.save-locationstock.write
POST/api/v1/stock/salesstock.sellstock.write
POST/api/v1/stock/levels/{sku}/reorderstock.set-reorderstock.write
GET/api/v1/stock/takes/{id}stock.takestock.read
POST/api/v1/stock/takes/{id}/abandonstock.take-abandonstock.write
POST/api/v1/stock/takes/{id}/applystock.take-applystock.write
POST/api/v1/stock/takes/{id}/countstock.take-countstock.write
POST/api/v1/stock/takesstock.take-openstock.write
GET/api/v1/stock/takesstock.takesstock.read
Schemas 28
DamageRequest
DamageRequest writes Quantity of the variant SKU off its level at the stock location Location, main when none is named, as damaged, with a note of at most 200 characters. The level is never made negative.
location | string |
note | string |
quantityrequired | integer |
skurequired | string |
LocationRequest
LocationRequest adds the location Key, or sets the name, position and flags of the one that has it. main cannot be made offline or inactive.
activerequired | boolean |
closes_on | string |
keyrequired | string |
namerequired | string |
opens_on | string |
positionrequired | integer |
sells_onlinerequired | boolean |
LowStockItem
LowStockItem is a variant that is low at a location: its level there, OnHand (owed stock is below 0), is at or below its reorder level.
locationrequired | string |
on_handrequired | integer |
option_valuesrequired | array of string |
productrequired | string |
reorder_levelrequired | integer |
skurequired | string |
PlaceLevel
PlaceLevel is a variant's level at a stock place: below 0 is owed stock, as a sale at the till may take.
on_handrequired | integer |
skurequired | string |
PlaceLevels
PlaceLevels are one stock place's levels: its key and name, the level of each live variant that tracks its stock, SKU order, and Next, the SKU to go on after ("" on the last page).
levelsrequired | array of PlaceLevel |
locationrequired | string |
namerequired | string |
nextrequired | string |
ReceiptRequest
ReceiptRequest adds the goods of the lines at the stock location Location, main when none is named, with a reference of at most 100 characters, such as a supplier's name or an invoice number, kept for search.
linesrequired | array of StockLine |
location | string |
reference | string |
ReorderRequest
ReorderRequest keeps Level as the reorder level of a variant at the stock location Location, main when none is named: a whole number from 0 to 1000000, 0 switching the check off there; null clears it, which takes the store's default again. The body must carry level, a null included.
levelrequired | integer |
location | string |
SellRequest
SellRequest takes the lines of a sale made outside the shop, such as at a counter or a market stall, off the stock location Location, main when none is named, with an outside reference of one line and at most 100 characters, such as a till's receipt number. It makes no order, no invoice and no hold. The quantity of a line is a whole number of 1 or more: a refund of such a sale is a return, not a negative sale.
linesrequired | array of StockLine |
location | string |
reference | string |
StockLevel
StockLevel is a variant's stock at one location.
locationrequired | string |
lowrequired | boolean |
namerequired | string |
on_handrequired | integer |
reorder_keptrequired | boolean |
reorder_levelrequired | integer |
sells_onlinerequired | boolean |
StockLine
StockLine is a quantity of a variant: a line of a transfer or of a receipt. The quantity is a whole number of 1 or more.
quantityrequired | integer |
skurequired | string |
StockLocation
StockLocation is a place that holds stock. Key is a slug the owner chooses and cannot change; Position orders the locations; a location that sells online feeds the online pool; an inactive one takes no sale. From contract version 6.
activerequired | boolean |
closes_onrequired | string |
keyrequired | string |
namerequired | string |
opens_onrequired | string |
positionrequired | integer |
sells_at_tillrequired | boolean |
sells_onlinerequired | boolean |
StockLocations
StockLocations are the store's stock locations in the order of their position. Enabled is false while the store keeps one location, main (store.yaml's stock.locations is off); a screen then shows no location.
blind_countsrequired | boolean |
enabledrequired | boolean |
locationsrequired | array of StockLocation |
StockLow
StockLow is a page of the variants that are low, in the order the variants were made and then the locations were, and Total how many there are in all, which the Home's restock item shows.
itemsrequired | array of LowStockItem |
nextrequired | string |
totalrequired | integer |
StockMovement
StockMovement is one row of the stock ledger: Delta is signed, After the level at that location after it, Reason one of opening, sale, refund, return, count, transfer, received, damaged and manual, Actor who made it (user:<id>, integration:<id>, system or pos:<id>), and RefKind and RefID the thing it came from (an order, a transfer, a stock-take).
actorrequired | string |
afterrequired | integer |
atrequired | string (date-time) |
deltarequired | integer |
idrequired | integer |
locationrequired | string |
noterequired | string |
reasonrequired | string |
ref_idrequired | integer |
ref_kindrequired | string |
skurequired | string |
StockMovements
StockMovements are the ledger's rows that match a filter, newest first. Next is the cursor of the next page (the id to pass as before), 0 when this is the last.
movementsrequired | array of StockMovement |
nextrequired | integer |
StockReceipt
StockReceipt is goods received: its number, which the movements name (ref_kind receipt), and what came in.
actorrequired | string |
atrequired | string (date-time) |
idrequired | integer |
linesrequired | array of StockLine |
locationrequired | string |
referencerequired | string |
StockReport
StockReport is a page of the stock report, and Total how many rows it has in all; Next is the cursor of the next page, to pass as after, "" for the last. Sale and refund movements of the online locations agree with the orders (a movement of an order has ref_kind order); a stock.sell is a sale movement too, of ref_kind pos.
nextrequired | string |
rowsrequired | array of StockReportRow |
totalrequired | integer |
StockReportRow
StockReportRow is the stock of one variant at one location over a period: the level it opened the period with, the quantity that came in and went out by reason (a movement that adds is in, one that takes is out, so a reason that does both, such as a count, is in both; a reason with none is left out), the level it closed with (Opening + In - Out), how many sale movements it had, and the level now. It gives numbers, not money.
closingrequired | integer |
inrequired | map of integer |
locationrequired | string |
on_handrequired | integer |
openingrequired | integer |
outrequired | map of integer |
salesrequired | integer |
skurequired | string |
trackedrequired | boolean |
StockSale
StockSale is a sale outside the shop, made: Actor is the caller (user:<id> or integration:<id>).
actorrequired | string |
atrequired | string (date-time) |
linesrequired | array of StockSaleLine |
locationrequired | string |
referencerequired | string |
StockSaleLine
StockSaleLine is a line of a sale made: the quantity taken, and the level left at the location.
levelrequired | integer |
quantityrequired | integer |
skurequired | string |
StockTake
StockTake is a counting session at one location. Status is open, applied or abandoned; ClosedAt is null while it is open. Lines are in the order the variants were first entered, and empty in a list, where LineCount says how many there are.
closed_atrequired | string (date-time) |
idrequired | integer |
line_countrequired | integer |
linesrequired | array of StockTakeLine |
locationrequired | string |
opened_atrequired | string (date-time) |
opened_byrequired | string |
statusrequired | string |
StockTakeLine
StockTakeLine is a variant the owner counted: Expected is the physical stock when it was entered (the level, or 0 when the level is below 0, because owed stock is not on the shelf), Counted what the owner counted, and Clamped says that applying could not write the whole difference, so that a level was not made negative and owed stock was not removed.
clampedrequired | boolean |
countedrequired | integer |
expectedrequired | integer |
skurequired | string |
StockTakes
StockTakes are the stock-takes, newest first.
takesrequired | array of StockTake |
StockTransfer
StockTransfer is a transfer made: its number, which the movements name (ref_kind transfer), and what it moved.
actorrequired | string |
atrequired | string (date-time) |
fromrequired | string |
idrequired | integer |
linesrequired | array of StockLine |
noterequired | string |
torequired | string |
TakeCountRequest
TakeCountRequest enters the count of the variant SKU in a stock-take: a whole number of 0 or more. The body must carry both fields: a count left out would read as 0.
countedrequired | integer |
skurequired | string |
TakeOpenRequest
TakeOpenRequest opens a stock-take at the location Location, main when none is named.
location | string |
TransferRequest
TransferRequest moves the lines from the stock location From to the stock location To in one step, with a note of at most 200 characters. Every field but Note is required; a request with more than 200 lines, or with a variant on two lines, is invalid.
fromrequired | string |
linesrequired | array of StockLine |
note | string |
torequired | string |
VariantLevels
VariantLevels are the levels of one tracked variant: at each location that holds or held it, the online pool (the sum of the online levels, which is what the buyer's level reads) and the stock available to sell now.
availablerequired | integer |
levelsrequired | array of StockLevel |
poolrequired | integer |
skurequired | string |
Made from engine/internal/openapi/openapi.json at commit 6c4cbd921. The contract-only operations come from the engine’s stub file, engine/internal/ops.