Add Part to Unit
POST/api/repairs/:repair/lines/:line/parts
Records a part on a repair unit, either planned (demand only: no stock moves and nothing posts) or consumed (stock moves at FIFO and the cost posts).
repairs:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Fields:
product_id(integer, required) — the part.warehouse_id(integer, required) — where the part comes from (or goes to, forremove).quantity(number, required, > 0, max 100000) — in the part's stock unit, or inuom_idwhen given. Fractions are kept.uom_id(integer, optional) — enter the quantity in another unit configured on the part (e.g. cm of a chain stocked by the inch). See List Part Units. The response keeps what was typed inentered_quantity/entered_uom.operation(string, optional) —add(default),remove(a component taken off a brand-owned unit enters stock as a new FIFO layer) orrecycle.state(string, optional) —consumed(default) orplanned.bill_to(string, optional) —warranty,goodwill,customer,supplier; defaults from the unit's coverage.bill_price(number, optional, ≥ 0).unit_cost(number, optional, ≥ 0) — planned parts only; defaults to the part's current cost. Consumed parts cost what the FIFO layers drew.description(string, optional, max 255) — defaults to the part name.lots(array, optional) — override the automatic FEFO/FIFO pick:lots.*.fifo_layer_id(integer, required with lots),lots.*.quantity(number, required with lots, > 0).serials(array of strings, optional, max 191 each) — serial numbers for a serialised part; one per unit consumed.planned_cost_id(integer, optional) — consume an existing planned part on this unit instead of adding a new line.
Refused with 422 when free stock is short, when a serialised part has too few serials, when the unit is not one of the part's units, or when remove is used on a customer-owned unit.
Authentication: Bearer token with the repairs:write scope.
Request
Responses
- 200
- 401
- 403
- 404
- 422
- 429
OK
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Not Found
Response Headers
Unprocessable Entity
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.