Skip to main content

Create Repair Cost

POST 

/api/repairs/:repair/costs

Adds a cost line of any type to a repair. Consumed lines post to the general ledger. A part with a line, product and warehouse moves stock at FIFO; use Add Part to Unit to pick lots, serials or another unit of measure.

Required scope: repairs:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Fields:

  • repair_order_line_id (integer, optional; required when type is part) — the unit the cost belongs to; leave empty for a repair-level cost such as freight. Must be on this repair.
  • type (string, required) — part, labour, vendor_service, freight_inbound, freight_outbound, assessment_fee, other.
  • description (string, required, max 255).
  • quantity (number, optional, > 0, max 100000) — default 1.
  • unit_cost (number, required, ≥ 0).
  • bill_price (number, optional, ≥ 0) — unit price charged when billed to the customer.
  • bill_to (string, optional) — warranty, goodwill, customer, supplier. Defaults from the unit's coverage (in warranty → warranty, out of warranty → customer).
  • state (string, optional) — planned or consumed (default consumed).
  • operation (string, optional) — parts only: add, remove (a component taken off a brand-owned unit back into stock), recycle.
  • product_id (integer) — required when type is part.
  • warehouse_id (integer, optional; required when type is part).
  • repair_shipment_id (integer, optional) — link a freight cost to a repair shipment.
  • purchase_order_id (integer, optional) — link a cost to a purchase order.

A part cost always moves real stock, so it needs the unit, product and warehouse — without them the request is refused with 422 rather than recorded as a plain cost line. A consumed part is refused with 422 when free stock is short ("Only N on hand at <warehouse>").

Authentication: Bearer token with the repairs:write scope.

Request​

Responses​

OK

Response Headers
    Content-Type