Skip to content

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

Kind
Write (audited)
Who
Staff: admin, editor
MCP tool
stock_receive

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)

FieldTypeDescription
itemsrequiredobject[]at least 1
partIdstringRecord id (UUID)min length 1, max length 64
partNumberstringmax length 60
quantityrequiredintegermin 1, max 9007199254740991
unitCostCentsintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
reasonstring | nullFor example the supplier and packing slip numbermax length 500

Output (object)

FieldTypeDescription
movementsrequiredobject[]
idrequiredstringRecord id (UUID)min length 1, max length 64
partIdrequiredstringRecord id (UUID)min length 1, max length 64
partNumberrequiredstring
typerequired"receive" | "adjust" | "ship" | "return"
quantityrequiredintegerSigned change: positive adds stock, negative removes itmin -9007199254740991, max 9007199254740991
balanceAfterrequiredintegerStock on hand after this movementmin -9007199254740991, max 9007199254740991
reasonrequiredstring | null
partsOrderIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
ticketIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
unitCostCentsrequiredinteger | nullAmount in integer US cents (zero or more)min 0, max 9007199254740991
actorNamerequiredstring
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
partsrequiredobject[]
idrequiredstringRecord id (UUID)min length 1, max length 64
partNumberrequiredstring
descriptionrequiredstring
categoryrequiredstring | null
unitrequiredstringUnit of measure, for example each, ft, set
priceCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
priceListDaterequiredstring (date)Date of the price list this price comes from
isStalerequiredbooleanTrue when the price is older than the current price list
fitsModelsrequiredstring[]Machine models the part fits
onHandrequiredintegerStock on hand; changes only through stock movementsmin -9007199254740991, max 9007199254740991
reorderPointrequiredintegermin 0, max 9007199254740991
reorderQuantityrequiredintegermin 0, max 9007199254740991
isLowrequiredbooleanTrue when on hand is at or below the reorder point
binLocationrequiredstring | null
recommendedSparerequiredbooleanRecommended to keep on the customer's shelf
activerequiredboolean
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
updatedAtrequiredstring (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

Kind
Write (audited)
Who
Staff: admin, editor
MCP tool
stock_adjust

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)

FieldTypeDescription
partIdstringRecord id (UUID)min length 1, max length 64
partNumberstringmax length 60
deltaintegerSigned change, for example -2min -9007199254740991, max 9007199254740991
countedQuantityintegerWhat is actually on the shelfmin 0, max 9007199254740991
reasonrequiredstringmin length 1, max length 500

Output (object)

FieldTypeDescription
movementrequiredobject | nullNull when the count matched and nothing changed
idrequiredstringRecord id (UUID)min length 1, max length 64
partIdrequiredstringRecord id (UUID)min length 1, max length 64
partNumberrequiredstring
typerequired"receive" | "adjust" | "ship" | "return"
quantityrequiredintegerSigned change: positive adds stock, negative removes itmin -9007199254740991, max 9007199254740991
balanceAfterrequiredintegerStock on hand after this movementmin -9007199254740991, max 9007199254740991
reasonrequiredstring | null
partsOrderIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
ticketIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
unitCostCentsrequiredinteger | nullAmount in integer US cents (zero or more)min 0, max 9007199254740991
actorNamerequiredstring
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
partrequiredobject
idrequiredstringRecord id (UUID)min length 1, max length 64
partNumberrequiredstring
descriptionrequiredstring
categoryrequiredstring | null
unitrequiredstringUnit of measure, for example each, ft, set
priceCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
priceListDaterequiredstring (date)Date of the price list this price comes from
isStalerequiredbooleanTrue when the price is older than the current price list
fitsModelsrequiredstring[]Machine models the part fits
onHandrequiredintegerStock on hand; changes only through stock movementsmin -9007199254740991, max 9007199254740991
reorderPointrequiredintegermin 0, max 9007199254740991
reorderQuantityrequiredintegermin 0, max 9007199254740991
isLowrequiredbooleanTrue when on hand is at or below the reorder point
binLocationrequiredstring | null
recommendedSparerequiredbooleanRecommended to keep on the customer's shelf
activerequiredboolean
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
updatedAtrequiredstring (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

Kind
Read
Who
Staff: admin, editor, viewer
MCP tool
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)

FieldTypeDescription
partIdstringRecord id (UUID)min length 1, max length 64
partNumberstringmax length 60
type"receive" | "adjust" | "ship" | "return"
fromstring (date)Date as YYYY-MM-DD
tostring (date)Date as YYYY-MM-DD
partsOrderIdstringRecord id (UUID)min length 1, max length 64
limitintegerMaximum rows to return (default 50, max 500)default 50, min 1, max 500
offsetintegerRows to skip, for pagingdefault 0, min 0, max 9007199254740991

Output (object)

FieldTypeDescription
itemsrequiredobject[]
idrequiredstringRecord id (UUID)min length 1, max length 64
partIdrequiredstringRecord id (UUID)min length 1, max length 64
partNumberrequiredstring
typerequired"receive" | "adjust" | "ship" | "return"
quantityrequiredintegerSigned change: positive adds stock, negative removes itmin -9007199254740991, max 9007199254740991
balanceAfterrequiredintegerStock on hand after this movementmin -9007199254740991, max 9007199254740991
reasonrequiredstring | null
partsOrderIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
ticketIdrequiredstring | nullRecord id (UUID)min length 1, max length 64
unitCostCentsrequiredinteger | nullAmount in integer US cents (zero or more)min 0, max 9007199254740991
actorNamerequiredstring
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
totalrequiredintegerTotal rows matching the filters, ignoring limit and offsetmin 0, max 9007199254740991
limitrequiredintegermin -9007199254740991, max 9007199254740991
offsetrequiredintegermin -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

Kind
Read
Who
Staff: admin, editor, viewer
MCP tool
stock_low

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)

FieldTypeDescription
limitintegerMaximum rows to return (default 50, max 500)default 50, min 1, max 500
offsetintegerRows to skip, for pagingdefault 0, min 0, max 9007199254740991

Output (object)

FieldTypeDescription
itemsrequiredobject[]
idrequiredstringRecord id (UUID)min length 1, max length 64
partNumberrequiredstring
descriptionrequiredstring
categoryrequiredstring | null
unitrequiredstringUnit of measure, for example each, ft, set
priceCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
priceListDaterequiredstring (date)Date of the price list this price comes from
isStalerequiredbooleanTrue when the price is older than the current price list
fitsModelsrequiredstring[]Machine models the part fits
onHandrequiredintegerStock on hand; changes only through stock movementsmin -9007199254740991, max 9007199254740991
reorderPointrequiredintegermin 0, max 9007199254740991
reorderQuantityrequiredintegermin 0, max 9007199254740991
isLowrequiredbooleanTrue when on hand is at or below the reorder point
binLocationrequiredstring | null
recommendedSparerequiredbooleanRecommended to keep on the customer's shelf
activerequiredboolean
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
updatedAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
shortByrequiredintegerReorder point minus on handmin -9007199254740991, max 9007199254740991
totalrequiredintegerTotal rows matching the filters, ignoring limit and offsetmin 0, max 9007199254740991
limitrequiredintegermin -9007199254740991, max 9007199254740991
offsetrequiredintegermin -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

Kind
Write (audited)
Who
Staff: admin, editor
MCP tool
stock_set_reorder

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)

FieldTypeDescription
partIdstringRecord id (UUID)min length 1, max length 64
partNumberstringmax length 60
reorderPointrequiredintegermin 0, max 9007199254740991
reorderQuantityintegermin 0, max 9007199254740991
binLocationstring | nullmax length 60

Output (object)

FieldTypeDescription
partrequiredobject
idrequiredstringRecord id (UUID)min length 1, max length 64
partNumberrequiredstring
descriptionrequiredstring
categoryrequiredstring | null
unitrequiredstringUnit of measure, for example each, ft, set
priceCentsrequiredintegerAmount in integer US cents (zero or more)min 0, max 9007199254740991
priceListDaterequiredstring (date)Date of the price list this price comes from
isStalerequiredbooleanTrue when the price is older than the current price list
fitsModelsrequiredstring[]Machine models the part fits
onHandrequiredintegerStock on hand; changes only through stock movementsmin -9007199254740991, max 9007199254740991
reorderPointrequiredintegermin 0, max 9007199254740991
reorderQuantityrequiredintegermin 0, max 9007199254740991
isLowrequiredbooleanTrue when on hand is at or below the reorder point
binLocationrequiredstring | null
recommendedSparerequiredbooleanRecommended to keep on the customer's shelf
activerequiredboolean
createdAtrequiredstring (date-time)UTC timestamp, ISO 8601 with Z
updatedAtrequiredstring (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
  }
}