Production Runs API — cURL examples for Postman
Replace before use:
BASE_URL— e.g.http://localhost:3000(or your backend origin)TOKEN— Bearer token (e.g. Firebase ID token or your auth header value)BUSINESS_ID— UUID of the businessLOCATION_ID— UUID of the locationUSER_ID— UUID of the user (createdBy / updatedBy)PRODUCT_ID— UUID of a product (for input/output lines)RUN_ID— UUID of an existing production run (for get/update/delete)
In Postman: Import → Raw text and paste a cURL, or use Code → cURL to copy from a request.
1. Create production run
curl -X POST "{{BASE_URL}}/production-runs" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {{TOKEN}}" \
-d '{
"businessId": "{{BUSINESS_ID}}",
"locationId": "{{LOCATION_ID}}",
"createdBy": "{{USER_ID}}",
"productionRunType": "mixing",
"runDate": "2026-02-12T10:00:00.000Z",
"status": "draft",
"notes": "Test run",
"inputs": [
{
"productId": "{{PRODUCT_ID}}",
"locationId": "{{LOCATION_ID}}",
"quantity": 10,
"unitCost": 5.5,
"sortOrder": 0
}
],
"outputs": [
{
"productId": "{{PRODUCT_ID}}",
"quantity": 8,
"unitCost": 7,
"sortOrder": 0
}
]
}'
productionRunType: collection | processing | mixing | baking | packing | assembly | harvest | transfer
status: draft | in_progress | completed | cancelled
2. List production runs (paginated)
curl -X GET "{{BASE_URL}}/production-runs?businessId={{BUSINESS_ID}}&page=1&size=20" \
-H "Authorization: Bearer {{TOKEN}}"
With filters:
curl -X GET "{{BASE_URL}}/production-runs?businessId={{BUSINESS_ID}}&locationId={{LOCATION_ID}}&status=draft&productionRunType=mixing&runDateFrom=2026-02-01&runDateTo=2026-02-28&page=1&size=10&orderBy=runDate&order=desc" \
-H "Authorization: Bearer {{TOKEN}}"
Query params (all optional): businessId, locationId, status, productionRunType, runDateFrom, runDateTo, createdAtFrom, createdAtTo, page, size, orderBy (runDate | createdAt | documentNumber | status), order (asc | desc)
3. Search production runs
Same as list; endpoint alias:
curl -X GET "{{BASE_URL}}/production-runs/search?businessId={{BUSINESS_ID}}&page=1&size=20" \
-H "Authorization: Bearer {{TOKEN}}"
4. Get production run by id
curl -X GET "{{BASE_URL}}/production-runs/{{RUN_ID}}" \
-H "Authorization: Bearer {{TOKEN}}"
5. Update production run
curl -X PATCH "{{BASE_URL}}/production-runs/{{RUN_ID}}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {{TOKEN}}" \
-d '{
"updatedBy": "{{USER_ID}}",
"status": "in_progress",
"notes": "Updated notes"
}'
Full body example (all fields optional except updatedBy):
curl -X PATCH "{{BASE_URL}}/production-runs/{{RUN_ID}}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {{TOKEN}}" \
-d '{
"updatedBy": "{{USER_ID}}",
"productionRunType": "packing",
"runDate": "2026-02-12T14:00:00.000Z",
"status": "completed",
"notes": "Completed run",
"inputs": [
{
"productId": "{{PRODUCT_ID}}",
"locationId": "{{LOCATION_ID}}",
"quantity": 12,
"unitCost": 5,
"sortOrder": 0
}
],
"outputs": [
{
"productId": "{{PRODUCT_ID}}",
"quantity": 10,
"unitCost": 6.5,
"sortOrder": 0
}
]
}'
6. Delete production run
curl -X DELETE "{{BASE_URL}}/production-runs/{{RUN_ID}}" \
-H "Authorization: Bearer {{TOKEN}}"
Postman environment variables (optional)
Create an environment with:
| Variable | Initial / Current value |
|---|---|
| BASE_URL | http://localhost:3000 |
| TOKEN | (paste your Bearer token) |
| BUSINESS_ID | (UUID) |
| LOCATION_ID | (UUID) |
| USER_ID | (UUID) |
| PRODUCT_ID | (UUID) |
| RUN_ID | (UUID, after creating one) |
Use {{BASE_URL}}, {{TOKEN}}, etc. in the request URL and body.