Retrieving a Production Run

Maxim

Maxim

Last updated on Oct 8, 2026

Returns a production run: its fields, the produced products and the consumption of materials, used products and resources.

v1/production/get_entry.php

Parameters

Field Type Required Description
production_id int Yes Production run ID

Response

An object production with the production's fields:

Field Type Description
id int Production run ID
num int Number. Assigned automatically
name string Name
date string Production date, YYYY-MM-DD
status int Status code from Production Statuses
order_id int ID of the sale the production was created for. 0 if not linked to a sale
produce_subproducts int 1 if subassemblies are produced together with the products
materials_storage_id int Storage location materials are deducted from. 0 if chosen automatically
materials_storage_name string Materials storage location name
products_storage_id int Storage location the produced products are added to
products_storage_name string Produced products storage location name
subproducts_storage_id int Storage location used products are deducted from. 0 if chosen automatically
subproducts_storage_name string Used products storage location name
cost float Cost of the whole production run
price float Value of the produced products at their sale price
amount float Total quantity of products. null if the products have different units
lines int Number of product lines
notes string Notes

and four arrays of lines.

products: the produced products.

Field Type Description
id int Product ID
sku string SKU
name string Name
amount float Quantity
unit string Unit of measure
cost float Line cost
price float Line value at the product's sale price

materials: material consumption across the whole production run. If a material is deducted from several storage locations, a separate line comes for each one.

Field Type Description
id int Material ID
sku string SKU
name string Name
storage_id int Storage location the material was deducted from
amount float Quantity
unit string Unit of measure
cost float Cost

subproducts: used products from the components of the ones being made. If subassemblies are produced (produce_subproducts is 1), they do not appear here: instead, the consumption of their components goes into materials and resources.

Field Type Description
id int Product ID
sku string SKU
name string Name
storage_id int Storage location the product was deducted from
amount float Quantity
unit string Unit of measure
cost float Cost

resources: the resources used.

Field Type Description
id int Resource ID
name string Name
type string Calculation type: "rate" fixed rate, "percent" percentage, "amortized" depreciation
amount float Quantity
unit string Unit of measure
cost float Cost

The products array can be sent to v1/production/edit unchanged. Consumption is not changed via the API: it is calculated from the product components.

Example request

{
    "production_id": 39978
}

Example response

{
    "success": true,
    "production": {
        "id": 39978,
        "num": 152,
        "name": "Batch of tables",
        "date": "2026-10-06",
        "status": 1,
        "order_id": 0,
        "produce_subproducts": 0,
        "materials_storage_id": 3998,
        "materials_storage_name": "Main",
        "products_storage_id": 4001,
        "products_storage_name": "Finished goods",
        "subproducts_storage_id": 3998,
        "subproducts_storage_name": "Main",
        "cost": 61540,
        "price": 130000,
        "amount": 10,
        "lines": 1,
        "notes": "",
        "products": [
            {
                "id": 512,
                "sku": "P-TABLE-01",
                "name": "Dining table",
                "amount": 10,
                "unit": "pcs",
                "cost": 61540,
                "price": 130000
            }
        ],
        "materials": [
            {
                "id": 2051,
                "sku": "M010",
                "name": "Oak board",
                "storage_id": 3998,
                "amount": 0.4,
                "unit": "cu m",
                "cost": 54000
            }
        ],
        "subproducts": [
            {
                "id": 530,
                "sku": "P-LEG-01",
                "name": "Table leg",
                "storage_id": 3998,
                "amount": 40,
                "unit": "pcs",
                "cost": 6000
            }
        ],
        "resources": [
            {
                "id": 77,
                "name": "Carpenter's work",
                "type": "rate",
                "amount": 20,
                "unit": "h",
                "cost": 1540
            }
        ]
    }
}

Errors

Error Reason
No production_id in input production_id is missing
Production not found or access denied Production run not found or deleted