Inventory Materials
Returns material-inventory rows across every warehouse on the tenant, cursor-paginated.
Query
search(optional) — case-insensitive substring match on the material name.warehouse_id(optional) — restrict to a single warehouse.status(optional) — restrict to batches in a given status (in_stock,reserved,shipped, etc.).cursor(optional) — opaque cursor from the previous response'spagination.cursor; omit for the first page.take(optional) — page size; defaults to25, capped at100.
Response
Each row carries the batch's identity (id, inventory_key), location (warehouse_id, warehouse_name, warehouse_status, warehouse_purpose, division_id, cell_name), material identity (material_name, material_external_id, category, subcategory, actual_price_per_unit, uom), quantity + status (quantity, material_status), and provenance (production_key, task_key, number_of_actions, comment).
Follow pagination.cursor for the next page; pagination.hasNextPage = false signals the end of the stream.
Case-insensitive substring match on material name.
Filter by warehouse UUID.
Filter by batch status.
Cursor from a previous response for the next page. Omit for the first page.
Page size. Defaults to 25.
25Tenant id (uuid v4)
Returned when the rate limit is exceeded
GET /api/v1/public/inventory/materials HTTP/1.1
Host: api-stage.hesh.tech
x-api-key: YOUR_API_KEY
Accept: */*
{
"pagination": {
"hasNextPage": true,
"cursor": "text"
}
}Creates one receipt document and one batch per line item — a single request adds N rows to the same warehouse. Every batch gets a freshly generated inventory_key (server-side; you don't supply it). Decimal quantities are allowed for materials.
Body
warehouse_id— destination warehouse. Required.division_id— destination division. Required when the warehouse'sstorage_typeis notdefault; ignored otherwise. Applied to every item in the request.comment— attached to the receipt document.materials[]— each item:material_id— material id.quantity— positive number, decimals allowed.actual_purchase_price— optional per-unit purchase price recorded on the receipt.production_key— optional. When present, the batch is linked to that workflow as its source (400if the key is unknown).
Response
Returns { document_id, data: [...] } — document_id is the receipt document that groups the batches, data mirrors each request line with the created id + generated inventory_key.
Tenant id (uuid v4)
Destination warehouse id.
Destination division id. Required for warehouses whose storage_type is not "default".
Free-form comment attached to the receipt document.
Id of the receipt document that groups the created batches.
Returned when the rate limit is exceeded
POST /api/v1/public/inventory/materials HTTP/1.1
Host: api-stage.hesh.tech
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 257
{
"warehouse_id": "123e4567-e89b-12d3-a456-426614174000",
"division_id": "123e4567-e89b-12d3-a456-426614174000",
"comment": "text",
"materials": [
{
"material_id": "123e4567-e89b-12d3-a456-426614174000",
"quantity": 1,
"actual_purchase_price": 1,
"production_key": "text"
}
]
}{
"document_id": "123e4567-e89b-12d3-a456-426614174000",
"data": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"inventory_key": "text",
"material_id": "123e4567-e89b-12d3-a456-426614174000",
"quantity": 1,
"status": "pending",
"warehouse_id": "123e4567-e89b-12d3-a456-426614174000",
"division_id": "123e4567-e89b-12d3-a456-426614174000"
}
]
}Returns every batch row that carries the given inventory_key (internal batch_number). Multiple rows can share an inventory_key after splits — e.g. a partial transfer creates a child row in the destination warehouse but the parent row keeps the same key. The response is a flat array (no pagination), typically 1–3 entries.
Each entry surfaces the row's id, inventory_key, material_id, material_name, quantity, uom, status, warehouse_id, and division_id.
Tenant id (uuid v4)
Internal batch id.
Batch number — the public "inventory_key".
Current on-hand quantity.
Measurement unit name.
Returned when the rate limit is exceeded
GET /api/v1/public/inventory/materials/{key} HTTP/1.1
Host: api-stage.hesh.tech
x-api-key: YOUR_API_KEY
Accept: */*
[
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"inventory_key": "text",
"material_id": "123e4567-e89b-12d3-a456-426614174000",
"material_name": "text",
"quantity": 1,
"uom": "text",
"status": "pending",
"warehouse_id": "123e4567-e89b-12d3-a456-426614174000",
"division_id": "123e4567-e89b-12d3-a456-426614174000"
}
]Moves stock from the batch's current location to a destination warehouse (and optionally division). Creates one change-log document per request, capturing source, destination, quantity, and comment. Decimal quantities are allowed.
Behavior
Partial moves (
quantity < batch.current qty) split the row: the source batch keeps the remainder, a new child batch is created at the destination with the transferred quantity. The child inherits the parent'sinventory_key.Full moves (
quantity === batch.current qty) change the batch'swarehouse_idin-place — no split.Rejected when
quantity <= 0orquantity > batch.current qty.
inventory_key disambiguation
The public inventory_key maps to the internal batch_number. In rare cases (post-split scenarios) multiple batches can share the same inventory_key. This endpoint requires inventory_key to resolve to exactly one batch with status in_stock:
Zero matches →
404.Multiple matches →
400with a message listing candidate batches.
Body
comment— attached to the change-log document.materials[]— each item:inventory_key,quantity, destinationwarehouse_id, optionalcell_id(destination division).
Response
{ message, document_id }. Follow document_id on a future changelog endpoint to inspect the per-batch effects.
Tenant id (uuid v4)
Free-form comment attached to the change-log document.
Human-readable confirmation message.
Id of the change-log document created by this operation.
Returned when the rate limit is exceeded
POST /api/v1/public/inventory/materials/move HTTP/1.1
Host: api-stage.hesh.tech
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 173
{
"comment": "text",
"materials": [
{
"inventory_key": "text",
"quantity": 1,
"warehouse_id": "123e4567-e89b-12d3-a456-426614174000",
"cell_id": "123e4567-e89b-12d3-a456-426614174000"
}
]
}{
"message": "text",
"document_id": "123e4567-e89b-12d3-a456-426614174000"
}Writes stock off from an in-stock batch. Creates one change-log document per request. Decimal quantities are allowed.
Behavior
Only batches with status
in_stockcan be written off. Batches alreadyshipped/written_offare rejected with400.Partial write-offs (
quantity < batch.current qty) split the row: the source keeps the remainder, a new child batch is created carrying the written-off quantity and moved into thewritten_offstate.Full write-offs (
quantity === batch.current qty) flip the batch's status in-place.Optional
production_key/task_keyattribute the write-off. Rules:If
task_keyis provided withoutproduction_key, the workflow is auto-populated from the task.If both are provided, the task must belong to the resolved production (
400on mismatch).Unknown
production_keyortask_key→400.
inventory_key disambiguation
The public inventory_key maps to the internal batch_number. In rare cases (post-split scenarios) multiple batches can share the same inventory_key. This endpoint requires inventory_key to resolve to exactly one batch with status in_stock:
Zero matches →
404.Multiple matches →
400with a message listing candidate batches.
Body
comment— attached to the change-log document.materials[]— each item:inventory_key,quantity, optionalproduction_key, optionaltask_key.
Response
{ message, document_id }.
Tenant id (uuid v4)
Free-form comment attached to the change-log document.
Human-readable confirmation message.
Id of the change-log document created by this operation.
Returned when the rate limit is exceeded
POST /api/v1/public/inventory/materials/write-off HTTP/1.1
Host: api-stage.hesh.tech
x-api-key: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 112
{
"comment": "text",
"materials": [
{
"inventory_key": "text",
"quantity": 1,
"production_key": "text",
"task_key": "text"
}
]
}{
"message": "text",
"document_id": "123e4567-e89b-12d3-a456-426614174000"
}Last updated

