Maxim

Maxim

Last updated on Oct 8, 2026

Creates a production run. Controlata calculates the consumption of materials, used products and resources from the product components; you do not pass it.

v1/production/add.php

Parameters

Field Type Required Description
products array Yes Products to make, see below
date string No Production date, YYYY-MM-DD. Default today
name string No Name
notes string No Notes
produce_subproducts int No 1: produce subassemblies together with the products, 0: deduct them from stock ready-made. Default per company setting
materials_storage_id int No Storage location materials are deducted from. 0: choose automatically
subproducts_storage_id int No Storage location used products are deducted from. 0: choose automatically
products_storage_id int No Storage location the produced products are added to

products line:

Field Type Required Description
id int id or sku Product ID
sku string id or sku Product SKU
amount float Yes Quantity, greater than 0

A product is specified by id or sku (it is also matched by alternative SKUs). The same product can be listed in several lines.

A new production run is created with the status from the Default status for new production setting.

Example request

{
    "date": "2026-10-06",
    "name": "Batch of tables",
    "products": [
        {
            "id": 512,
            "amount": 10
        },
        {
            "sku": "P-CHAIR-01",
            "amount": 40
        }
    ],
    "materials_storage_id": 3998,
    "products_storage_id": 4001,
    "produce_subproducts": 1
}

Example response

{
    "success": true,
    "production_id": 39978,
    "num": 152,
    "status": 0
}

The response returns the ID, number and status code of the new production run.

Errors

Error Reason
No products in input products is missing or an empty array
Products is not an array products is not an array
Line 0 of products must be an object A products line is not an object (instead of 0, the line number)
SKU or id not set for product 0 The line has neither id nor sku
Product with id 512 not found Product not found or deleted (for a SKU: Product with SKU "P-CHAIR-01" not found)
Amount must be greater than 0 for product with id 512 Quantity is not a number or not above 0 after rounding
Storage ID is not set products_storage_id equal to 0 was passed
Storage ID not found Storage location not found or deleted
Date is not a valid date in format YYYY-MM-DD Invalid date format