PUT
Edit a purchase
Company space For: Buyer, Manager · Permission: purchases.update Conditions
  • The purchase must be in draft or rejected status.
  • items is prohibited: lines are changed through the purchase item actions.
  • vendor_id, when sent, must be a supplier of the company.
  • reference, when sent, must be unique among the company’s purchases (the purchase itself is ignored).
  • When the purchase prices lines per unit, vat_total and cost_total_includes_vat are refused, and cost_total can only be sent with its current value.
  • When the purchase has a single total cost, vat_total sent without cost_total_includes_vat is refused if the purchase has never recorded it, and vat_total cannot exceed cost_total when VAT is included.
  • vat_is_recoverable is required when the resulting VAT is greater than zero and it was never set.
  • due_date is applied only when the purchase is on credit; for a non-credit purchase it is ignored.
What else happens
  • Recalculates the invoice total, per-line unit_cost_ttc and cost_leftover from the new totals.
  • Omitted fields, and null for reference, purchase_date and notes, keep the stored values.
  • No stock movement or accounting entry is created.
Part of Create and approve purchases.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

purchase
string
required

Identifier of the purchase to change.

Query Parameters

response
enum<string>
default:none

Response mode. Default none; none answers 204 No Content.

Available options:
none,
resource
fields
string

Comma-separated JSON keys of the root resource (id is always rendered). Available: id, company_id, vendor_id, reference, purchase_date, notes, status, is_credit, cost_total, cost_total_includes_vat, vat_total, vat_is_recoverable, invoice_total, cost_leftover, invoiced_at, amount_paid, amount_debt_adjusted, remaining_amount, due_date, payment_status, need_approval, cost_strategy, created_at, updated_at.

include
string

Comma-separated include paths, each optionally followed by its fields in parentheses: units(id,sku),units.uomUnit(id,name). Max depth 6, max 40 paths. Available: items, items.stockable, items.stockableUnit, debtAdjustments, debtAdjustments.purchase, returns, returns.items, pickups, pickups.items, pickups.costs, deliveries, deliveries.items, deliveries.costs, vendor.

Response

Resource (only with response=resource).

id

Identifier of the purchase (27-character KSUID).

company_id

Identifier of the company the record belongs to.

vendor_id

Identifier of the supplier the goods are bought from.

reference

Free reference of the purchase (for example the supplier's order number); unique among the company's purchases when set.

purchase_date

Date of the purchase (ISO 8601 date), null when not given.

notes

Free notes, up to 1000 characters.

status

Workflow status: draft (editable), awaiting_approval (waiting for a manager when a credit limit was exceeded), rejected (editable again), pending (confirmed, goods can be received), completed, closed.

is_credit
boolean

True when the purchase is bought on credit from the supplier, so the unpaid amount counts as a debt.

cost_total
number

Cost of the purchase as entered. Under the unit cost strategy it is the sum of the line costs before VAT; under the total strategy it is the amount entered by the caller, which includes VAT when cost_total_includes_vat is true. In major units (the stored minor-unit amount divided by 10 to the power currency_exponent).

cost_total_includes_vat
boolean | null

Whether cost_total already includes VAT. Only meaningful under the total cost strategy; null under the unit strategy.

vat_total
number

VAT of the purchase. Computed from the lines under the unit strategy; entered by the caller under the total strategy. In major units (the stored minor-unit amount divided by 10 to the power currency_exponent).

vat_is_recoverable
boolean | null

Whether the VAT of this purchase can be recovered. Required when VAT is above zero; null when never set.

invoice_total
number | null

Amount invoiced by the supplier, VAT included: the sum of the line totals (unit strategy) or cost_total plus VAT when VAT is not included (total strategy). Recomputed while the purchase is editable; null while not yet computed. In major units (the stored minor-unit amount divided by 10 to the power currency_exponent).

cost_leftover
number

Remainder in the division of the invoice total by the total quantity under the total cost strategy, which cannot be spread evenly over the units. 0 under the unit strategy. In major units (the stored minor-unit amount divided by 10 to the power currency_exponent).

invoiced_at

When the supplier invoice was recognised (ISO 8601), set the first time the purchase becomes pending; null before that.

amount_paid
number

Cash paid so far against the purchase. In major units (the stored minor-unit amount divided by 10 to the power currency_exponent).

amount_debt_adjusted
number

Total of debt adjustments applied to the purchase. In major units (the stored minor-unit amount divided by 10 to the power currency_exponent).

remaining_amount
number

Amount still to be paid to the supplier. 0 before the invoice is recognised and while awaiting approval. In major units (the stored minor-unit amount divided by 10 to the power currency_exponent).

due_date

Date by which a credit purchase must be paid (ISO 8601 date); when omitted on a credit purchase, filled from the purchase date (or the creation day) plus the supplier's standard payment terms, if those are above 0.

payment_status

Payment state: unpaid, partial or paid.

need_approval
boolean

True while the purchase waits for a manager's approval because a supplier debt limit was exceeded.

cost_strategy

How costs are entered: unit (a unit_cost per line) or total (one cost_total for the whole purchase).

items
array

Lines of the purchase. Present only when requested with include=items.

debt_adjustments
array

Debt adjustments of the purchase. Present only when requested with include.

returns
array

Returns made against the purchase. Present only when requested with include.

pickups
array

Pickup receptions of the purchase. Present only when requested with include.

deliveries
array

Delivery receptions of the purchase. Present only when requested with include.

vendor
object

The supplier of the purchase. Present only when requested with include=vendor.

created_at

Date and time the record was created (ISO 8601, UTC).

updated_at

Date and time the record was last changed (ISO 8601, UTC).