Manufacturing
Manufacturing: bills of materials (what a batch of a product takes, its labour and overhead), and production orders whose start takes the components out of stock into work in progress and whose finish receives the goods at their planned cost, with the variances of components, labour and overhead.
| Operation | Summary | Scope | Idempotency-Key |
|---|---|---|---|
GET /v1/bills-of-materials |
List bills of materials | read |
|
POST /v1/bills-of-materials |
Add a bill of materials | draft |
required |
GET /v1/bills-of-materials/{bom_id} |
Get a bill of materials | read |
|
PATCH /v1/bills-of-materials/{bom_id} |
Change a bill of materials | draft |
|
GET /v1/production-orders |
List production orders | read |
|
POST /v1/production-orders |
Plan a production order | draft |
required |
GET /v1/production-orders/{order_id} |
Get a production order | read |
|
POST /v1/production-orders/{order_id}/cancel |
Cancel a production order | draft |
|
POST /v1/production-orders/{order_id}/finish |
Finish a production order | draft |
|
POST /v1/production-orders/{order_id}/start |
Start a production order | draft |
GET /v1/bills-of-materials
List bills of materials
The bills of materials, by entity and product: each component and what a batch takes, its cost and stock today, the labour and overhead, and what one unit costs to make today.
| Required scope | read (admin implies every scope) |
| Operation id | list_boms_v1_bills_of_materials_get |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| query | entity |
string or null | Only this entity's (code or id). |
Example request
curl "$ERP_URL/v1/bills-of-materials" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | array of BomOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"product": "string",
"product_name": "string",
"unit": "string",
"output_quantity": "string",
"labour_hours": "string",
"labour_rate": "string",
"overhead_rate": "string",
"currency": "string",
"material_cost": "string",
"labour_cost": "string",
"overhead_cost": "string",
"unit_cost": "string",
"note": "string",
"active": true,
"lines": [
{
"product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"item": "string",
"item_name": "string",
"unit": "string",
"quantity": "string",
"unit_cost": null,
"on_hand": "string"
}
],
"updated_at": "2026-09-21T09:30:00Z"
}
]
POST /v1/bills-of-materials
Add a bill of materials
Say what a product is made of: its components (stock items, each once) and what one batch
takes of each, how many units a batch makes, the labour hours, what an hour costs and the
overhead per labour hour. The product is kept in stock from now on if it was not, and the
company gets the accounts of production its chart names. Nothing is posted. 409
(bom_exists) when the product has a bill: change that one. Needs an Idempotency-Key.
| Required scope | draft (admin implies every scope) |
| Idempotency-Key | required |
| Operation id | create_bom_v1_bills_of_materials_post |
Request body
application/json (required): BomInput
| Field | Type | Required | Description |
|---|---|---|---|
entity |
string | yes | Code (or id) of the company that makes it. |
product |
string | yes | Code (or id) of the finished product: goods sold per unit. It is kept in stock from now on if it is not yet. |
lines |
array of BomLineInput |
yes | The components and what one batch takes. (min items 1; max items 500) |
output_quantity |
decimal string | How many units of the product one batch makes; default 1. (greater than 0; default "1") |
|
labour_hours |
decimal string or null | Labour hours one batch takes, e.g. 1.5; default 0. (min 0) |
|
labour_rate |
decimal string or null | What an hour of labour costs, in the company's currency; default 0. (min 0) | |
overhead_rate |
decimal string or null | The overhead (machines, rooms, energy) charged per labour hour, in the company's currency; default 0. (min 0) | |
note |
string or null | How it is made. (max length 1000) |
Example request
curl -X POST "$ERP_URL/v1/bills-of-materials" \
-H "Authorization: Bearer $ERP_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"entity": "CH01",
"labour_hours": "0.5",
"labour_rate": "60",
"lines": [
{
"item": "SCANNER",
"quantity": "1"
},
{
"item": "LABELPRN",
"quantity": "1"
},
{
"item": "ROLL-58",
"quantity": "10"
}
],
"overhead_rate": "30",
"product": "KIT-SCAN"
}'
Responses
| Status | Meaning | Body |
|---|---|---|
| 201 | Created | BomOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"product": "string",
"product_name": "string",
"unit": "string",
"output_quantity": "string",
"labour_hours": "string",
"labour_rate": "string",
"overhead_rate": "string",
"currency": "string",
"material_cost": "string",
"labour_cost": "string",
"overhead_cost": "string",
"unit_cost": "string",
"note": "string",
"active": true,
"lines": [
{
"product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"item": "string",
"item_name": "string",
"unit": "string",
"quantity": "string",
"unit_cost": "string",
"on_hand": "string"
}
],
"updated_at": "2026-09-21T09:30:00Z"
}
GET /v1/bills-of-materials/{bom_id}
Get a bill of materials
The bill with its components and what one unit costs to make today.
| Required scope | read (admin implies every scope) |
| Operation id | get_bom_v1_bills_of_materials__bom_id__get |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | bom_id |
string (uuid) | yes | Id of the bill (GET /v1/bills-of-materials). |
Example request
curl "$ERP_URL/v1/bills-of-materials/{bom_id}" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | BomOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"product": "string",
"product_name": "string",
"unit": "string",
"output_quantity": "string",
"labour_hours": "string",
"labour_rate": "string",
"overhead_rate": "string",
"currency": "string",
"material_cost": "string",
"labour_cost": "string",
"overhead_cost": "string",
"unit_cost": "string",
"note": "string",
"active": true,
"lines": [
{
"product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"item": "string",
"item_name": "string",
"unit": "string",
"quantity": "string",
"unit_cost": "string",
"on_hand": "string"
}
],
"updated_at": "2026-09-21T09:30:00Z"
}
PATCH /v1/bills-of-materials/{bom_id}
Change a bill of materials
Change its components (all of them, replacing the bill's), its batch, labour, rates or note, or make it inactive. Orders already planned keep their plan.
| Required scope | draft (admin implies every scope) |
| Idempotency-Key | not used |
| Operation id | update_bom_v1_bills_of_materials__bom_id__patch |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | bom_id |
string (uuid) | yes | Id of the bill (GET /v1/bills-of-materials). |
Request body
application/json (required): BomUpdate
| Field | Type | Required | Description |
|---|---|---|---|
lines |
array of BomLineInput or null |
The components, all of them (they replace the bill's). Orders already planned keep their plan. (min items 1; max items 500) | |
output_quantity |
decimal string or null | Units one batch makes. (greater than 0) | |
labour_hours |
decimal string or null | Labour hours one batch takes, e.g. 1.5; default 0. (min 0) |
|
labour_rate |
decimal string or null | What an hour of labour costs, in the company's currency; default 0. (min 0) | |
overhead_rate |
decimal string or null | The overhead (machines, rooms, energy) charged per labour hour, in the company's currency; default 0. (min 0) | |
note |
string or null | How it is made. (max length 1000) | |
active |
boolean or null | False: no new production orders for the product. |
Example request
curl -X PATCH "$ERP_URL/v1/bills-of-materials/{bom_id}" \
-H "Authorization: Bearer $ERP_KEY" \
-H "Content-Type: application/json" \
-d '{
"labour_hours": "0.75"
}'
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | BomOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"product": "string",
"product_name": "string",
"unit": "string",
"output_quantity": "string",
"labour_hours": "string",
"labour_rate": "string",
"overhead_rate": "string",
"currency": "string",
"material_cost": "string",
"labour_cost": "string",
"overhead_cost": "string",
"unit_cost": "string",
"note": "string",
"active": true,
"lines": [
{
"product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"item": "string",
"item_name": "string",
"unit": "string",
"quantity": "string",
"unit_cost": "string",
"on_hand": "string"
}
],
"updated_at": "2026-09-21T09:30:00Z"
}
GET /v1/production-orders
List production orders
The production orders, latest due first (at most 500): the plan, what was issued, made and what it cost, with the variances once finished.
| Required scope | read (admin implies every scope) |
| Operation id | list_production_orders_v1_production_orders_get |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| query | entity |
string or null | Only this entity's (code or id). | |
| query | status |
"cancelled" | "finished" | "finishing" | "planned" | "started" | "starting" or null |
Only orders in this status. |
Example request
curl "$ERP_URL/v1/production-orders" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | array of ProductionOrderOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"number": "string",
"product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"product": "string",
"product_name": "string",
"unit": "string",
"warehouse": "string",
"quantity": "string",
"due_date": "2026-09-21",
"status": "cancelled",
"note": "string",
"currency": "string",
"labour_hours": "string",
"labour_rate": "string",
"overhead_rate": "string",
"planned_material": "string",
"planned_labour": "string",
"planned_overhead": "string",
"planned_cost": "string",
"started_on": "2026-09-21",
"start_posting": "string",
"material_cost": "string",
"finished_on": "2026-09-21",
"finish_posting": "string",
"produced_quantity": "string",
"actual_labour_hours": "string",
"labour_cost": "string",
"overhead_cost": "string",
"finished_value": "string",
"material_variance": "string",
"labour_variance": "string",
"overhead_variance": "string",
"variance": "string",
"lines": [
{
"product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"item": "string",
"item_name": "string",
"unit": "string",
"planned_quantity": "string",
"planned_unit_cost": "string",
"issued_quantity": null,
"issued_value": null
}
],
"created_by": {},
"created_at": "2026-09-21T09:30:00Z"
}
]
POST /v1/production-orders
Plan a production order
Plan to make a quantity of a product with a bill of materials: the components scaled to
the quantity at their average cost today, the labour and overhead. The plan stays as it is,
so the finish shows how far the order differs from it. Nothing is posted. Needs an
Idempotency-Key.
| Required scope | draft (admin implies every scope) |
| Idempotency-Key | required |
| Operation id | create_production_order_v1_production_orders_post |
Request body
application/json (required): ProductionOrderInput
| Field | Type | Required | Description |
|---|---|---|---|
entity |
string | yes | Code (or id) of the company that makes it. |
product |
string | yes | Code (or id) of the product to make: it has a bill. |
quantity |
decimal string | yes | How many units to make. A quantity in the item's unit, up to six decimals, e.g. 12 or 2.5. (greater than 0) |
warehouse |
string or null | Code (or id) of the warehouse its components leave and its goods arrive in; default the company's default warehouse. | |
due_date |
string (date) or null | When it should be finished; default today. | |
note |
string or null | A note. (max length 1000) |
Example request
curl -X POST "$ERP_URL/v1/production-orders" \
-H "Authorization: Bearer $ERP_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"entity": "CH01",
"product": "KIT-SCAN",
"quantity": "5"
}'
Responses
| Status | Meaning | Body |
|---|---|---|
| 201 | Created | ProductionOrderOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"number": "string",
"product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"product": "string",
"product_name": "string",
"unit": "string",
"warehouse": "string",
"quantity": "string",
"due_date": "2026-09-21",
"status": "cancelled",
"note": "string",
"currency": "string",
"labour_hours": "string",
"labour_rate": "string",
"overhead_rate": "string",
"planned_material": "string",
"planned_labour": "string",
"planned_overhead": "string",
"planned_cost": "string",
"started_on": "2026-09-21",
"start_posting": "string",
"material_cost": "string",
"finished_on": "2026-09-21",
"finish_posting": "string",
"produced_quantity": "string",
"actual_labour_hours": "string",
"labour_cost": "string",
"overhead_cost": "string",
"finished_value": "string",
"material_variance": "string",
"labour_variance": "string",
"overhead_variance": "string",
"variance": "string",
"lines": [
{
"product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"item": "string",
"item_name": "string",
"unit": "string",
"planned_quantity": "string",
"planned_unit_cost": "string",
"issued_quantity": "string",
"issued_value": "string"
}
],
"created_by": {},
"created_at": "2026-09-21T09:30:00Z"
}
GET /v1/production-orders/{order_id}
Get a production order
The order with its plan, components, postings, costs and variances.
| Required scope | read (admin implies every scope) |
| Operation id | get_production_order_v1_production_orders__order_id__get |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | order_id |
string (uuid) | yes | Id of the production order (GET /v1/production-orders). |
Example request
curl "$ERP_URL/v1/production-orders/{order_id}" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | ProductionOrderOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"number": "string",
"product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"product": "string",
"product_name": "string",
"unit": "string",
"warehouse": "string",
"quantity": "string",
"due_date": "2026-09-21",
"status": "cancelled",
"note": "string",
"currency": "string",
"labour_hours": "string",
"labour_rate": "string",
"overhead_rate": "string",
"planned_material": "string",
"planned_labour": "string",
"planned_overhead": "string",
"planned_cost": "string",
"started_on": "2026-09-21",
"start_posting": "string",
"material_cost": "string",
"finished_on": "2026-09-21",
"finish_posting": "string",
"produced_quantity": "string",
"actual_labour_hours": "string",
"labour_cost": "string",
"overhead_cost": "string",
"finished_value": "string",
"material_variance": "string",
"labour_variance": "string",
"overhead_variance": "string",
"variance": "string",
"lines": [
{
"product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"item": "string",
"item_name": "string",
"unit": "string",
"planned_quantity": "string",
"planned_unit_cost": "string",
"issued_quantity": "string",
"issued_value": "string"
}
],
"created_by": {},
"created_at": "2026-09-21T09:30:00Z"
}
POST /v1/production-orders/{order_id}/cancel
Cancel a production order
Cancel a planned order. 409 (order_not_planned) once its components have left stock.
| Required scope | draft (admin implies every scope) |
| Idempotency-Key | not used |
| Operation id | cancel_production_order_v1_production_orders__order_id__cancel_post |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | order_id |
string (uuid) | yes | Id of the production order (GET /v1/production-orders). |
Example request
curl -X POST "$ERP_URL/v1/production-orders/{order_id}/cancel" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | ProductionOrderOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"number": "string",
"product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"product": "string",
"product_name": "string",
"unit": "string",
"warehouse": "string",
"quantity": "string",
"due_date": "2026-09-21",
"status": "cancelled",
"note": "string",
"currency": "string",
"labour_hours": "string",
"labour_rate": "string",
"overhead_rate": "string",
"planned_material": "string",
"planned_labour": "string",
"planned_overhead": "string",
"planned_cost": "string",
"started_on": "2026-09-21",
"start_posting": "string",
"material_cost": "string",
"finished_on": "2026-09-21",
"finish_posting": "string",
"produced_quantity": "string",
"actual_labour_hours": "string",
"labour_cost": "string",
"overhead_cost": "string",
"finished_value": "string",
"material_variance": "string",
"labour_variance": "string",
"overhead_variance": "string",
"variance": "string",
"lines": [
{
"product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"item": "string",
"item_name": "string",
"unit": "string",
"planned_quantity": "string",
"planned_unit_cost": "string",
"issued_quantity": "string",
"issued_value": "string"
}
],
"created_by": {},
"created_at": "2026-09-21T09:30:00Z"
}
POST /v1/production-orders/{order_id}/finish
Finish a production order
Receive what was made into stock at its planned cost, take the labour hours and their
overhead into work in progress, and book the variances of the components, the labour and the
overhead (one stock posting). A planned order is started first, on the same day. 409
(production_order_status) while its start waits for approval.
| Required scope | draft (admin implies every scope) |
| Idempotency-Key | not used |
| Operation id | finish_production_order_v1_production_orders__order_id__finish_post |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | order_id |
string (uuid) | yes | Id of the production order (GET /v1/production-orders). |
Request body
application/json (required): FinishInput
| Field | Type | Required | Description |
|---|---|---|---|
posting_date |
string (date) or null | The day the finished goods arrive; default today. | |
produced_quantity |
decimal string or null | How many units were made; default the order's quantity. (greater than 0) | |
labour_hours |
decimal string or null | The labour hours it took; default the planned hours for what was made. (min 0) |
Example request
curl -X POST "$ERP_URL/v1/production-orders/{order_id}/finish" \
-H "Authorization: Bearer $ERP_KEY" \
-H "Content-Type: application/json" \
-d '{}'
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | ProductionOrderOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"number": "string",
"product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"product": "string",
"product_name": "string",
"unit": "string",
"warehouse": "string",
"quantity": "string",
"due_date": "2026-09-21",
"status": "cancelled",
"note": "string",
"currency": "string",
"labour_hours": "string",
"labour_rate": "string",
"overhead_rate": "string",
"planned_material": "string",
"planned_labour": "string",
"planned_overhead": "string",
"planned_cost": "string",
"started_on": "2026-09-21",
"start_posting": "string",
"material_cost": "string",
"finished_on": "2026-09-21",
"finish_posting": "string",
"produced_quantity": "string",
"actual_labour_hours": "string",
"labour_cost": "string",
"overhead_cost": "string",
"finished_value": "string",
"material_variance": "string",
"labour_variance": "string",
"overhead_variance": "string",
"variance": "string",
"lines": [
{
"product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"item": "string",
"item_name": "string",
"unit": "string",
"planned_quantity": "string",
"planned_unit_cost": "string",
"issued_quantity": "string",
"issued_value": "string"
}
],
"created_by": {},
"created_at": "2026-09-21T09:30:00Z"
}
POST /v1/production-orders/{order_id}/start
Start a production order
Take its components out of stock at moving average into work in progress (a stock
posting), as planned or in the quantities given. 409 (not_enough_stock) when the warehouse
does not hold them, (production_order_status) unless the order is planned. An agent's
start waits for approval (starting).
| Required scope | draft (admin implies every scope) |
| Idempotency-Key | not used |
| Operation id | start_production_order_v1_production_orders__order_id__start_post |
Parameters
| In | Name | Type | Required | Description |
|---|---|---|---|---|
| path | order_id |
string (uuid) | yes | Id of the production order (GET /v1/production-orders). |
Request body
application/json (required): StartInput
| Field | Type | Required | Description |
|---|---|---|---|
posting_date |
string (date) or null | The day the components leave stock; default today. | |
lines |
array of StartLine or null |
Components taken in another quantity than planned; the others as planned. (max items 500) |
Example request
curl -X POST "$ERP_URL/v1/production-orders/{order_id}/start" \
-H "Authorization: Bearer $ERP_KEY" \
-H "Content-Type: application/json" \
-d '{}'
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | ProductionOrderOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 404 | The resource does not exist, or belongs to another organization (not_found). |
ErrorEnvelope |
| 409 | The request conflicts with the data: an Idempotency-Key reused with a different request, a closed period, or an integrity rule of the database (conflict, integrity_violation). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"number": "string",
"product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"product": "string",
"product_name": "string",
"unit": "string",
"warehouse": "string",
"quantity": "string",
"due_date": "2026-09-21",
"status": "cancelled",
"note": "string",
"currency": "string",
"labour_hours": "string",
"labour_rate": "string",
"overhead_rate": "string",
"planned_material": "string",
"planned_labour": "string",
"planned_overhead": "string",
"planned_cost": "string",
"started_on": "2026-09-21",
"start_posting": "string",
"material_cost": "string",
"finished_on": "2026-09-21",
"finish_posting": "string",
"produced_quantity": "string",
"actual_labour_hours": "string",
"labour_cost": "string",
"overhead_cost": "string",
"finished_value": "string",
"material_variance": "string",
"labour_variance": "string",
"overhead_variance": "string",
"variance": "string",
"lines": [
{
"product_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"item": "string",
"item_name": "string",
"unit": "string",
"planned_quantity": "string",
"planned_unit_cost": "string",
"issued_quantity": "string",
"issued_value": "string"
}
],
"created_by": {},
"created_at": "2026-09-21T09:30:00Z"
}
Schemas
BomInput
| Field | Type | Required | Description |
|---|---|---|---|
entity |
string | yes | Code (or id) of the company that makes it. |
product |
string | yes | Code (or id) of the finished product: goods sold per unit. It is kept in stock from now on if it is not yet. |
lines |
array of BomLineInput |
yes | The components and what one batch takes. (min items 1; max items 500) |
output_quantity |
decimal string | How many units of the product one batch makes; default 1. (greater than 0; default "1") |
|
labour_hours |
decimal string or null | Labour hours one batch takes, e.g. 1.5; default 0. (min 0) |
|
labour_rate |
decimal string or null | What an hour of labour costs, in the company's currency; default 0. (min 0) | |
overhead_rate |
decimal string or null | The overhead (machines, rooms, energy) charged per labour hour, in the company's currency; default 0. (min 0) | |
note |
string or null | How it is made. (max length 1000) |
BomLineInput
| Field | Type | Required | Description |
|---|---|---|---|
item |
string | yes | Code (or id) of the component: a stock item of the company. |
quantity |
decimal string | yes | How much of it one batch takes. A quantity in the item's unit, up to six decimals, e.g. 12 or 2.5. (greater than 0) |
BomLineOut
| Field | Type | Required | Description |
|---|---|---|---|
product_id |
string (uuid) | yes | The component's product id. |
item |
string | yes | The component's product code. |
item_name |
string | yes | Its name. |
unit |
string | yes | Its unit. |
quantity |
string | yes | What one batch takes. |
unit_cost |
string or null | yes | Its moving average cost today; null while none is in stock. |
on_hand |
string | yes | Its quantity in stock today (all warehouses). |
BomOut
| Field | Type | Required | Description |
|---|---|---|---|
id |
string (uuid) | yes | Id of the bill. |
entity |
string | yes | Entity code. |
product_id |
string (uuid) | yes | The finished product's id. |
product |
string | yes | The finished product's code. |
product_name |
string | yes | Its name. |
unit |
string | yes | Its unit. |
output_quantity |
string | yes | Units one batch makes. |
labour_hours |
string | yes | Labour hours one batch takes. |
labour_rate |
string | yes | What an hour of labour costs. |
overhead_rate |
string | yes | Overhead charged per labour hour. |
currency |
string | yes | The company's currency of the costs. |
material_cost |
string | yes | One batch's components at today's average cost. |
labour_cost |
string | yes | One batch's labour. |
overhead_cost |
string | yes | One batch's overhead. |
unit_cost |
string | yes | What one unit costs to make today (six decimals). |
note |
string or null | yes | How it is made. |
active |
boolean | yes | False: no new orders. |
lines |
array of BomLineOut |
yes | The components. |
updated_at |
string (date-time) or null | yes | Last change (UTC). |
BomUpdate
| Field | Type | Required | Description |
|---|---|---|---|
lines |
array of BomLineInput or null |
The components, all of them (they replace the bill's). Orders already planned keep their plan. (min items 1; max items 500) | |
output_quantity |
decimal string or null | Units one batch makes. (greater than 0) | |
labour_hours |
decimal string or null | Labour hours one batch takes, e.g. 1.5; default 0. (min 0) |
|
labour_rate |
decimal string or null | What an hour of labour costs, in the company's currency; default 0. (min 0) | |
overhead_rate |
decimal string or null | The overhead (machines, rooms, energy) charged per labour hour, in the company's currency; default 0. (min 0) | |
note |
string or null | How it is made. (max length 1000) | |
active |
boolean or null | False: no new production orders for the product. |
FinishInput
| Field | Type | Required | Description |
|---|---|---|---|
posting_date |
string (date) or null | The day the finished goods arrive; default today. | |
produced_quantity |
decimal string or null | How many units were made; default the order's quantity. (greater than 0) | |
labour_hours |
decimal string or null | The labour hours it took; default the planned hours for what was made. (min 0) |
ProductionOrderInput
| Field | Type | Required | Description |
|---|---|---|---|
entity |
string | yes | Code (or id) of the company that makes it. |
product |
string | yes | Code (or id) of the product to make: it has a bill. |
quantity |
decimal string | yes | How many units to make. A quantity in the item's unit, up to six decimals, e.g. 12 or 2.5. (greater than 0) |
warehouse |
string or null | Code (or id) of the warehouse its components leave and its goods arrive in; default the company's default warehouse. | |
due_date |
string (date) or null | When it should be finished; default today. | |
note |
string or null | A note. (max length 1000) |
ProductionOrderLineOut
| Field | Type | Required | Description |
|---|---|---|---|
product_id |
string (uuid) | yes | The component's product id. |
item |
string | yes | Its code. |
item_name |
string | yes | Its name. |
unit |
string | yes | Its unit. |
planned_quantity |
string | yes | What the order plans to use. |
planned_unit_cost |
string | yes | Its average cost when the order was planned. |
issued_quantity |
string or null | yes | What its start took out of stock. |
issued_value |
string or null | yes | Its value at moving average, once posted. |
ProductionOrderOut
| Field | Type | Required | Description |
|---|---|---|---|
id |
string (uuid) | yes | Id of the order. |
entity |
string | yes | Entity code. |
number |
string | yes | Its number, e.g. MO-2026-000001. |
product_id |
string (uuid) | yes | The product made. |
product |
string | yes | Its code. |
product_name |
string | yes | Its name. |
unit |
string | yes | Its unit. |
warehouse |
string | yes | Code of the warehouse. |
quantity |
string | yes | Units planned. |
due_date |
string (date) | yes | When it should be finished. |
status |
"cancelled" | "finished" | "finishing" | "planned" | "started" | "starting" |
yes | planned, starting (its start waits for approval), started, finishing (its finish waits for approval), finished or cancelled. |
note |
string or null | yes | A note. |
currency |
string | yes | The company's currency of the costs. |
labour_hours |
string | yes | Labour hours planned. |
labour_rate |
string | yes | What an hour of labour costs. |
overhead_rate |
string | yes | Overhead per labour hour. |
planned_material |
string | yes | The components' planned cost. |
planned_labour |
string | yes | The labour's planned cost. |
planned_overhead |
string | yes | The overhead's planned cost. |
planned_cost |
string | yes | The whole planned cost. |
started_on |
string (date) or null | yes | The day its components left stock. |
start_posting |
string or null | yes | Number of the stock posting of its start. |
material_cost |
string or null | yes | What the issued components cost. |
finished_on |
string (date) or null | yes | The day its goods arrived. |
finish_posting |
string or null | yes | Number of the stock posting of its finish. |
produced_quantity |
string or null | yes | Units made. |
actual_labour_hours |
string or null | yes | Labour hours it took. |
labour_cost |
string or null | yes | What its labour cost. |
overhead_cost |
string or null | yes | Its overhead. |
finished_value |
string or null | yes | The finished goods' value in stock: their planned cost for what was made. |
material_variance |
string or null | yes | Components: actual less planned for what was made (positive: cost more). |
labour_variance |
string or null | yes | Labour: actual less planned. |
overhead_variance |
string or null | yes | Overhead: actual less planned. |
variance |
string or null | yes | The three variances together. |
lines |
array of ProductionOrderLineOut |
yes | The components. |
created_by |
object | yes | Who planned it. |
created_at |
string (date-time) | yes | When (UTC). |
StartInput
| Field | Type | Required | Description |
|---|---|---|---|
posting_date |
string (date) or null | The day the components leave stock; default today. | |
lines |
array of StartLine or null |
Components taken in another quantity than planned; the others as planned. (max items 500) |
StartLine
| Field | Type | Required | Description |
|---|---|---|---|
item |
string | yes | Code (or id) of a component of the order. |
quantity |
decimal string | yes | What really goes into production. A quantity in the item's unit, up to six decimals, e.g. 12 or 2.5. (greater than 0) |