Stock levels and ledger
Generated at build time from packages/core/src/operations/stock.ts. Every operation below isPOST /v1/ops/{name} over HTTP, env.API.invoke(actor, name, input) over RPC, and, when staff may call it, an MCP tool. See the API overview for authentication and errors.
stock.receive
Receive parts into stock
Record parts arriving from a supplier. Adds the quantity to stock on hand and writes a receive row to the stock ledger for each part. Several parts can be received in one call.
Input (object)
| Field | Type | Description |
|---|---|---|
itemsrequired | object[] | at least 1 |
partId | string | Record id (UUID)min length 1, max length 64 |
partNumber | string | max length 60 |
quantityrequired | integer | min 1, max 9007199254740991 |
unitCostCents | integer | Amount in integer US cents (zero or more)min 0, max 9007199254740991 |
reason | string | null | For example the supplier and packing slip numbermax length 500 |
Output (object)
| Field | Type | Description |
|---|---|---|
movementsrequired | object[] | |
idrequired | string | Record id (UUID)min length 1, max length 64 |
partIdrequired | string | Record id (UUID)min length 1, max length 64 |
partNumberrequired | string | |
typerequired | "receive" | "adjust" | "ship" | "return" | |
quantityrequired | integer | Signed change: positive adds stock, negative removes itmin -9007199254740991, max 9007199254740991 |
balanceAfterrequired | integer | Stock on hand after this movementmin -9007199254740991, max 9007199254740991 |
reasonrequired | string | null | |
partsOrderIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
ticketIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
unitCostCentsrequired | integer | null | Amount in integer US cents (zero or more)min 0, max 9007199254740991 |
actorNamerequired | string | |
createdAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
partsrequired | object[] | |
idrequired | string | Record id (UUID)min length 1, max length 64 |
partNumberrequired | string | |
descriptionrequired | string | |
categoryrequired | string | null | |
unitrequired | string | Unit of measure, for example each, ft, set |
priceCentsrequired | integer | Amount in integer US cents (zero or more)min 0, max 9007199254740991 |
priceListDaterequired | string (date) | Date of the price list this price comes from |
isStalerequired | boolean | True when the price is older than the current price list |
fitsModelsrequired | string[] | Machine models the part fits |
onHandrequired | integer | Stock on hand; changes only through stock movementsmin -9007199254740991, max 9007199254740991 |
reorderPointrequired | integer | min 0, max 9007199254740991 |
reorderQuantityrequired | integer | min 0, max 9007199254740991 |
isLowrequired | boolean | True when on hand is at or below the reorder point |
binLocationrequired | string | null | |
recommendedSparerequired | boolean | Recommended to keep on the customer's shelf |
activerequired | boolean | |
createdAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
updatedAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
Example request
curl https://api.cemco.app/v1/ops/stock.receive \
-H "x-api-key: $CEMCO_API_KEY" \
-H "content-type: application/json" \
-d '{"items":[{"quantity":1,"partId":"00000000-0000-4000-8000-000000000000"}]}'
JSON Schema
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"items": {
"minItems": 1,
"type": "array",
"items": {
"type": "object",
"properties": {
"partId": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"partNumber": {
"type": "string",
"maxLength": 60
},
"quantity": {
"type": "integer",
"minimum": 1,
"maximum": 9007199254740991
},
"unitCostCents": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991,
"description": "Amount in integer US cents (zero or more)"
}
},
"required": [
"quantity"
]
}
},
"reason": {
"description": "For example the supplier and packing slip number",
"anyOf": [
{
"type": "string",
"maxLength": 500
},
{
"type": "null"
}
]
}
},
"required": [
"items"
]
},
"output": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"movements": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"partId": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"partNumber": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"receive",
"adjust",
"ship",
"return"
]
},
"quantity": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Signed change: positive adds stock, negative removes it"
},
"balanceAfter": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Stock on hand after this movement"
},
"reason": {
"type": [
"string",
"null"
]
},
"partsOrderId": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
{
"type": "null"
}
]
},
"ticketId": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
{
"type": "null"
}
]
},
"unitCostCents": {
"anyOf": [
{
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991,
"description": "Amount in integer US cents (zero or more)"
},
{
"type": "null"
}
]
},
"actorName": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
}
},
"required": [
"id",
"partId",
"partNumber",
"type",
"quantity",
"balanceAfter",
"reason",
"partsOrderId",
"ticketId",
"unitCostCents",
"actorName",
"createdAt"
],
"additionalProperties": false
}
},
"parts": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"partNumber": {
"type": "string"
},
"description": {
"type": "string"
},
"category": {
"type": [
"string",
"null"
]
},
"unit": {
"type": "string",
"description": "Unit of measure, for example each, ft, set"
},
"priceCents": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991,
"description": "Amount in integer US cents (zero or more)"
},
"priceListDate": {
"type": "string",
"format": "date",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
"description": "Date of the price list this price comes from"
},
"isStale": {
"type": "boolean",
"description": "True when the price is older than the current price list"
},
"fitsModels": {
"type": "array",
"items": {
"type": "string"
},
"description": "Machine models the part fits"
},
"onHand": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Stock on hand; changes only through stock movements"
},
"reorderPoint": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"reorderQuantity": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"isLow": {
"type": "boolean",
"description": "True when on hand is at or below the reorder point"
},
"binLocation": {
"type": [
"string",
"null"
]
},
"recommendedSpare": {
"type": "boolean",
"description": "Recommended to keep on the customer's shelf"
},
"active": {
"type": "boolean"
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
}
},
"required": [
"id",
"partNumber",
"description",
"category",
"unit",
"priceCents",
"priceListDate",
"isStale",
"fitsModels",
"onHand",
"reorderPoint",
"reorderQuantity",
"isLow",
"binLocation",
"recommendedSpare",
"active",
"createdAt",
"updatedAt"
],
"additionalProperties": false
}
}
},
"required": [
"movements",
"parts"
],
"additionalProperties": false
}
}
stock.adjust
Adjust stock on hand
Correct the stock of one part after a count, damage or loss. Give either the counted quantity (countedQuantity) or a signed change (delta). Writes an adjust row to the ledger with the reason, which is required.
Input (object)
| Field | Type | Description |
|---|---|---|
partId | string | Record id (UUID)min length 1, max length 64 |
partNumber | string | max length 60 |
delta | integer | Signed change, for example -2min -9007199254740991, max 9007199254740991 |
countedQuantity | integer | What is actually on the shelfmin 0, max 9007199254740991 |
reasonrequired | string | min length 1, max length 500 |
Output (object)
| Field | Type | Description |
|---|---|---|
movementrequired | object | null | Null when the count matched and nothing changed |
idrequired | string | Record id (UUID)min length 1, max length 64 |
partIdrequired | string | Record id (UUID)min length 1, max length 64 |
partNumberrequired | string | |
typerequired | "receive" | "adjust" | "ship" | "return" | |
quantityrequired | integer | Signed change: positive adds stock, negative removes itmin -9007199254740991, max 9007199254740991 |
balanceAfterrequired | integer | Stock on hand after this movementmin -9007199254740991, max 9007199254740991 |
reasonrequired | string | null | |
partsOrderIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
ticketIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
unitCostCentsrequired | integer | null | Amount in integer US cents (zero or more)min 0, max 9007199254740991 |
actorNamerequired | string | |
createdAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
partrequired | object | |
idrequired | string | Record id (UUID)min length 1, max length 64 |
partNumberrequired | string | |
descriptionrequired | string | |
categoryrequired | string | null | |
unitrequired | string | Unit of measure, for example each, ft, set |
priceCentsrequired | integer | Amount in integer US cents (zero or more)min 0, max 9007199254740991 |
priceListDaterequired | string (date) | Date of the price list this price comes from |
isStalerequired | boolean | True when the price is older than the current price list |
fitsModelsrequired | string[] | Machine models the part fits |
onHandrequired | integer | Stock on hand; changes only through stock movementsmin -9007199254740991, max 9007199254740991 |
reorderPointrequired | integer | min 0, max 9007199254740991 |
reorderQuantityrequired | integer | min 0, max 9007199254740991 |
isLowrequired | boolean | True when on hand is at or below the reorder point |
binLocationrequired | string | null | |
recommendedSparerequired | boolean | Recommended to keep on the customer's shelf |
activerequired | boolean | |
createdAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
updatedAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
Example request
curl https://api.cemco.app/v1/ops/stock.adjust \
-H "x-api-key: $CEMCO_API_KEY" \
-H "content-type: application/json" \
-d '{"reason":"example","partId":"00000000-0000-4000-8000-000000000000","delta":1}'
JSON Schema
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"partId": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"partNumber": {
"type": "string",
"maxLength": 60
},
"delta": {
"description": "Signed change, for example -2",
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"countedQuantity": {
"description": "What is actually on the shelf",
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"reason": {
"type": "string",
"minLength": 1,
"maxLength": 500
}
},
"required": [
"reason"
]
},
"output": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"movement": {
"anyOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"partId": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"partNumber": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"receive",
"adjust",
"ship",
"return"
]
},
"quantity": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Signed change: positive adds stock, negative removes it"
},
"balanceAfter": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Stock on hand after this movement"
},
"reason": {
"type": [
"string",
"null"
]
},
"partsOrderId": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
{
"type": "null"
}
]
},
"ticketId": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
{
"type": "null"
}
]
},
"unitCostCents": {
"anyOf": [
{
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991,
"description": "Amount in integer US cents (zero or more)"
},
{
"type": "null"
}
]
},
"actorName": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
}
},
"required": [
"id",
"partId",
"partNumber",
"type",
"quantity",
"balanceAfter",
"reason",
"partsOrderId",
"ticketId",
"unitCostCents",
"actorName",
"createdAt"
],
"additionalProperties": false
},
{
"type": "null"
}
],
"description": "Null when the count matched and nothing changed"
},
"part": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"partNumber": {
"type": "string"
},
"description": {
"type": "string"
},
"category": {
"type": [
"string",
"null"
]
},
"unit": {
"type": "string",
"description": "Unit of measure, for example each, ft, set"
},
"priceCents": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991,
"description": "Amount in integer US cents (zero or more)"
},
"priceListDate": {
"type": "string",
"format": "date",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
"description": "Date of the price list this price comes from"
},
"isStale": {
"type": "boolean",
"description": "True when the price is older than the current price list"
},
"fitsModels": {
"type": "array",
"items": {
"type": "string"
},
"description": "Machine models the part fits"
},
"onHand": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Stock on hand; changes only through stock movements"
},
"reorderPoint": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"reorderQuantity": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"isLow": {
"type": "boolean",
"description": "True when on hand is at or below the reorder point"
},
"binLocation": {
"type": [
"string",
"null"
]
},
"recommendedSpare": {
"type": "boolean",
"description": "Recommended to keep on the customer's shelf"
},
"active": {
"type": "boolean"
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
}
},
"required": [
"id",
"partNumber",
"description",
"category",
"unit",
"priceCents",
"priceListDate",
"isStale",
"fitsModels",
"onHand",
"reorderPoint",
"reorderQuantity",
"isLow",
"binLocation",
"recommendedSpare",
"active",
"createdAt",
"updatedAt"
],
"additionalProperties": false
}
},
"required": [
"movement",
"part"
],
"additionalProperties": false
}
}
stock.ledger
Read the stock ledger
Stock movements, newest first: every receive, adjustment, shipment and return with the quantity, the balance after it, who did it and why. Filter by part, type or date range.
Input (object)
| Field | Type | Description |
|---|---|---|
partId | string | Record id (UUID)min length 1, max length 64 |
partNumber | string | max length 60 |
type | "receive" | "adjust" | "ship" | "return" | |
from | string (date) | Date as YYYY-MM-DD |
to | string (date) | Date as YYYY-MM-DD |
partsOrderId | string | Record id (UUID)min length 1, max length 64 |
limit | integer | Maximum rows to return (default 50, max 500)default 50, min 1, max 500 |
offset | integer | Rows to skip, for pagingdefault 0, min 0, max 9007199254740991 |
Output (object)
| Field | Type | Description |
|---|---|---|
itemsrequired | object[] | |
idrequired | string | Record id (UUID)min length 1, max length 64 |
partIdrequired | string | Record id (UUID)min length 1, max length 64 |
partNumberrequired | string | |
typerequired | "receive" | "adjust" | "ship" | "return" | |
quantityrequired | integer | Signed change: positive adds stock, negative removes itmin -9007199254740991, max 9007199254740991 |
balanceAfterrequired | integer | Stock on hand after this movementmin -9007199254740991, max 9007199254740991 |
reasonrequired | string | null | |
partsOrderIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
ticketIdrequired | string | null | Record id (UUID)min length 1, max length 64 |
unitCostCentsrequired | integer | null | Amount in integer US cents (zero or more)min 0, max 9007199254740991 |
actorNamerequired | string | |
createdAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
totalrequired | integer | Total rows matching the filters, ignoring limit and offsetmin 0, max 9007199254740991 |
limitrequired | integer | min -9007199254740991, max 9007199254740991 |
offsetrequired | integer | min -9007199254740991, max 9007199254740991 |
Example request
curl https://api.cemco.app/v1/ops/stock.ledger \
-H "x-api-key: $CEMCO_API_KEY" \
-H "content-type: application/json" \
-d '{}'
JSON Schema
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"partId": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"partNumber": {
"type": "string",
"maxLength": 60
},
"type": {
"type": "string",
"enum": [
"receive",
"adjust",
"ship",
"return"
]
},
"from": {
"type": "string",
"format": "date",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
"description": "Date as YYYY-MM-DD"
},
"to": {
"type": "string",
"format": "date",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
"description": "Date as YYYY-MM-DD"
},
"partsOrderId": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"limit": {
"default": 50,
"description": "Maximum rows to return (default 50, max 500)",
"type": "integer",
"minimum": 1,
"maximum": 500
},
"offset": {
"default": 0,
"description": "Rows to skip, for paging",
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
}
},
"output": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"partId": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"partNumber": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"receive",
"adjust",
"ship",
"return"
]
},
"quantity": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Signed change: positive adds stock, negative removes it"
},
"balanceAfter": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Stock on hand after this movement"
},
"reason": {
"type": [
"string",
"null"
]
},
"partsOrderId": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
{
"type": "null"
}
]
},
"ticketId": {
"anyOf": [
{
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
{
"type": "null"
}
]
},
"unitCostCents": {
"anyOf": [
{
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991,
"description": "Amount in integer US cents (zero or more)"
},
{
"type": "null"
}
]
},
"actorName": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
}
},
"required": [
"id",
"partId",
"partNumber",
"type",
"quantity",
"balanceAfter",
"reason",
"partsOrderId",
"ticketId",
"unitCostCents",
"actorName",
"createdAt"
],
"additionalProperties": false
}
},
"total": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991,
"description": "Total rows matching the filters, ignoring limit and offset"
},
"limit": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"offset": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
}
},
"required": [
"items",
"total",
"limit",
"offset"
],
"additionalProperties": false
}
}
stock.low
List low-stock parts
Parts at or below their reorder point, with stock on hand, the reorder point and the suggested reorder quantity. Parts with no reorder point are never listed.
Input (object)
| Field | Type | Description |
|---|---|---|
limit | integer | Maximum rows to return (default 50, max 500)default 50, min 1, max 500 |
offset | integer | Rows to skip, for pagingdefault 0, min 0, max 9007199254740991 |
Output (object)
| Field | Type | Description |
|---|---|---|
itemsrequired | object[] | |
idrequired | string | Record id (UUID)min length 1, max length 64 |
partNumberrequired | string | |
descriptionrequired | string | |
categoryrequired | string | null | |
unitrequired | string | Unit of measure, for example each, ft, set |
priceCentsrequired | integer | Amount in integer US cents (zero or more)min 0, max 9007199254740991 |
priceListDaterequired | string (date) | Date of the price list this price comes from |
isStalerequired | boolean | True when the price is older than the current price list |
fitsModelsrequired | string[] | Machine models the part fits |
onHandrequired | integer | Stock on hand; changes only through stock movementsmin -9007199254740991, max 9007199254740991 |
reorderPointrequired | integer | min 0, max 9007199254740991 |
reorderQuantityrequired | integer | min 0, max 9007199254740991 |
isLowrequired | boolean | True when on hand is at or below the reorder point |
binLocationrequired | string | null | |
recommendedSparerequired | boolean | Recommended to keep on the customer's shelf |
activerequired | boolean | |
createdAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
updatedAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
shortByrequired | integer | Reorder point minus on handmin -9007199254740991, max 9007199254740991 |
totalrequired | integer | Total rows matching the filters, ignoring limit and offsetmin 0, max 9007199254740991 |
limitrequired | integer | min -9007199254740991, max 9007199254740991 |
offsetrequired | integer | min -9007199254740991, max 9007199254740991 |
Example request
curl https://api.cemco.app/v1/ops/stock.low \
-H "x-api-key: $CEMCO_API_KEY" \
-H "content-type: application/json" \
-d '{}'
JSON Schema
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"limit": {
"default": 50,
"description": "Maximum rows to return (default 50, max 500)",
"type": "integer",
"minimum": 1,
"maximum": 500
},
"offset": {
"default": 0,
"description": "Rows to skip, for paging",
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
}
},
"output": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"partNumber": {
"type": "string"
},
"description": {
"type": "string"
},
"category": {
"type": [
"string",
"null"
]
},
"unit": {
"type": "string",
"description": "Unit of measure, for example each, ft, set"
},
"priceCents": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991,
"description": "Amount in integer US cents (zero or more)"
},
"priceListDate": {
"type": "string",
"format": "date",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
"description": "Date of the price list this price comes from"
},
"isStale": {
"type": "boolean",
"description": "True when the price is older than the current price list"
},
"fitsModels": {
"type": "array",
"items": {
"type": "string"
},
"description": "Machine models the part fits"
},
"onHand": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Stock on hand; changes only through stock movements"
},
"reorderPoint": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"reorderQuantity": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"isLow": {
"type": "boolean",
"description": "True when on hand is at or below the reorder point"
},
"binLocation": {
"type": [
"string",
"null"
]
},
"recommendedSpare": {
"type": "boolean",
"description": "Recommended to keep on the customer's shelf"
},
"active": {
"type": "boolean"
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
"shortBy": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Reorder point minus on hand"
}
},
"required": [
"id",
"partNumber",
"description",
"category",
"unit",
"priceCents",
"priceListDate",
"isStale",
"fitsModels",
"onHand",
"reorderPoint",
"reorderQuantity",
"isLow",
"binLocation",
"recommendedSpare",
"active",
"createdAt",
"updatedAt",
"shortBy"
],
"additionalProperties": false
}
},
"total": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991,
"description": "Total rows matching the filters, ignoring limit and offset"
},
"limit": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
},
"offset": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991
}
},
"required": [
"items",
"total",
"limit",
"offset"
],
"additionalProperties": false
}
}
stock.set_reorder
Set a part's reorder point
Set the reorder point and reorder quantity for a part. When stock falls to the reorder point the part shows as low and a low-stock email is sent.
Input (object)
| Field | Type | Description |
|---|---|---|
partId | string | Record id (UUID)min length 1, max length 64 |
partNumber | string | max length 60 |
reorderPointrequired | integer | min 0, max 9007199254740991 |
reorderQuantity | integer | min 0, max 9007199254740991 |
binLocation | string | null | max length 60 |
Output (object)
| Field | Type | Description |
|---|---|---|
partrequired | object | |
idrequired | string | Record id (UUID)min length 1, max length 64 |
partNumberrequired | string | |
descriptionrequired | string | |
categoryrequired | string | null | |
unitrequired | string | Unit of measure, for example each, ft, set |
priceCentsrequired | integer | Amount in integer US cents (zero or more)min 0, max 9007199254740991 |
priceListDaterequired | string (date) | Date of the price list this price comes from |
isStalerequired | boolean | True when the price is older than the current price list |
fitsModelsrequired | string[] | Machine models the part fits |
onHandrequired | integer | Stock on hand; changes only through stock movementsmin -9007199254740991, max 9007199254740991 |
reorderPointrequired | integer | min 0, max 9007199254740991 |
reorderQuantityrequired | integer | min 0, max 9007199254740991 |
isLowrequired | boolean | True when on hand is at or below the reorder point |
binLocationrequired | string | null | |
recommendedSparerequired | boolean | Recommended to keep on the customer's shelf |
activerequired | boolean | |
createdAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
updatedAtrequired | string (date-time) | UTC timestamp, ISO 8601 with Z |
Example request
curl https://api.cemco.app/v1/ops/stock.set_reorder \
-H "x-api-key: $CEMCO_API_KEY" \
-H "content-type: application/json" \
-d '{"reorderPoint":0,"partId":"00000000-0000-4000-8000-000000000000"}'
JSON Schema
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"partId": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"partNumber": {
"type": "string",
"maxLength": 60
},
"reorderPoint": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"reorderQuantity": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"binLocation": {
"anyOf": [
{
"type": "string",
"maxLength": 60
},
{
"type": "null"
}
]
}
},
"required": [
"reorderPoint"
]
},
"output": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"part": {
"type": "object",
"properties": {
"id": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"description": "Record id (UUID)"
},
"partNumber": {
"type": "string"
},
"description": {
"type": "string"
},
"category": {
"type": [
"string",
"null"
]
},
"unit": {
"type": "string",
"description": "Unit of measure, for example each, ft, set"
},
"priceCents": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991,
"description": "Amount in integer US cents (zero or more)"
},
"priceListDate": {
"type": "string",
"format": "date",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$",
"description": "Date of the price list this price comes from"
},
"isStale": {
"type": "boolean",
"description": "True when the price is older than the current price list"
},
"fitsModels": {
"type": "array",
"items": {
"type": "string"
},
"description": "Machine models the part fits"
},
"onHand": {
"type": "integer",
"minimum": -9007199254740991,
"maximum": 9007199254740991,
"description": "Stock on hand; changes only through stock movements"
},
"reorderPoint": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"reorderQuantity": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"isLow": {
"type": "boolean",
"description": "True when on hand is at or below the reorder point"
},
"binLocation": {
"type": [
"string",
"null"
]
},
"recommendedSpare": {
"type": "boolean",
"description": "Recommended to keep on the customer's shelf"
},
"active": {
"type": "boolean"
},
"createdAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
"description": "UTC timestamp, ISO 8601 with Z"
}
},
"required": [
"id",
"partNumber",
"description",
"category",
"unit",
"priceCents",
"priceListDate",
"isStale",
"fitsModels",
"onHand",
"reorderPoint",
"reorderQuantity",
"isLow",
"binLocation",
"recommendedSpare",
"active",
"createdAt",
"updatedAt"
],
"additionalProperties": false
}
},
"required": [
"part"
],
"additionalProperties": false
}
}