Documentation menu
These are pre-release docs from the main branch.

API reference

27 operations in purchasing. Raw spec: openapi.json.

GET/api/v1/projects/{id}/cost-rollup

GET /api/projects/{id}/cost-rollup — posted PO bills in base currency (ADR 0002 locked) plus the project budget for comparison.

Parameters

NameInTypeRequiredDescription
idpathstringYes

Responses

StatusDescription
200
404project not visible in scope

Security: bearer

GET/api/v1/purchase-orders

GET /api/purchase-orders

Parameters

NameInTypeRequiredDescription
statusquery—No
vendor_idquery—No
project_idquery—No
qquery—No

Responses

StatusDescription
200

Security: bearer

POST/api/v1/purchase-orders

POST /api/purchase-orders

Request body

CreateOrderRequest

Responses

StatusDescription
200
404vendor or project not visible in scope
409order number already exists

Security: bearer

GET/api/v1/purchase-orders/{id}

GET /api/purchase-orders/{id} — header + lines + receipts + bill.

Parameters

NameInTypeRequiredDescription
idpathstringYes

Responses

StatusDescription
200
404order not visible in scope

Security: bearer

PATCH/api/v1/purchase-orders/{id}

PATCH /api/purchase-orders/{id} — draft-only header edits.

Parameters

NameInTypeRequiredDescription
idpathstringYes

Request body

UpdateOrderRequest

Responses

StatusDescription
200
404order not visible in scope
409order is not a draft

Security: bearer

GET/api/v1/purchase-orders/{id}/bill

GET /api/purchase-orders/{id}/bill

Parameters

NameInTypeRequiredDescription
idpathstringYes

Responses

StatusDescription
200
404no bill recorded for this order

Security: bearer

PUT/api/v1/purchase-orders/{id}/bill

PUT /api/purchase-orders/{id}/bill — record or edit the draft bill.

Parameters

NameInTypeRequiredDescription
idpathstringYes

Request body

RecordBillRequest

Responses

StatusDescription
200
409order not billable yet, or the bill is already posted

Security: bearer

POST/api/v1/purchase-orders/{id}/bill/post

POST /api/purchase-orders/{id}/bill/post — the rollup moment: locks the ADR 0002 FX snapshot and stamps `posted_at`.

Parameters

NameInTypeRequiredDescription
idpathstringYes

Request body

CloseOrderRequest

Responses

StatusDescription
200
404no bill recorded
409the bill is already posted

Security: bearer

POST/api/v1/purchase-orders/{id}/cancel

POST /api/purchase-orders/{id}/cancel — draft|ordered, nothing received.

Parameters

NameInTypeRequiredDescription
idpathstringYes

Request body

CancelOrderRequest

Responses

StatusDescription
200
409order already received goods or is terminal

Security: bearer

POST/api/v1/purchase-orders/{id}/close

POST /api/purchase-orders/{id}/close — received|partially_received → closed; the close disposition is the typed under-receipt record.

Parameters

NameInTypeRequiredDescription
idpathstringYes

Request body

CloseOrderRequest

Responses

StatusDescription
200
409order is not in a closable state

Security: bearer

POST/api/v1/purchase-orders/{id}/lines

POST /api/purchase-orders/{id}/lines — draft-only line add.

Parameters

NameInTypeRequiredDescription
idpathstringYes

Request body

OrderLineInput

Responses

StatusDescription
200
409order is not a draft
422line validation failed

Security: bearer

PATCH/api/v1/purchase-orders/{id}/lines/{line_id}

PATCH /api/purchase-orders/{id}/lines/{line_id} — draft-only line edit.

Parameters

NameInTypeRequiredDescription
idpathstringYes
line_idpathstringYes

Request body

AddOrderLineRequest

Responses

StatusDescription
200
404order or line not visible in scope
409order is not a draft or the line already received goods

Security: bearer

DELETE/api/v1/purchase-orders/{id}/lines/{line_id}

DELETE /api/purchase-orders/{id}/lines/{line_id} — draft-only.

Parameters

NameInTypeRequiredDescription
idpathstringYes
line_idpathstringYes

Request body

DeleteOrderLineRequest

Responses

StatusDescription
200
404order or line not visible in scope
409order is not a draft

Security: bearer

POST/api/v1/purchase-orders/{id}/order

POST /api/purchase-orders/{id}/order — draft → ordered.

Parameters

NameInTypeRequiredDescription
idpathstringYes

Request body

CloseOrderRequest

Responses

StatusDescription
200
409order is not a draft or has no lines

Security: bearer

POST/api/v1/purchase-orders/{id}/receive

POST /api/purchase-orders/{id}/receive — the receipt that posts into the lane-1 movement ledger at `location_id`.

Parameters

NameInTypeRequiredDescription
idpathstringYes

Request body

ReceiveOrderRequest

Responses

StatusDescription
200
404order or location not visible in scope
409order not receivable, over-receipt without acknowledgement, or a line without a stock item
422serial numbers inconsistent with the received quantity

Security: bearer

GET/api/v1/vendors

GET /api/vendors

Parameters

NameInTypeRequiredDescription
qquery—No
include_inactivequerybooleanNo

Responses

StatusDescription
200

Security: bearer

POST/api/v1/vendors

POST /api/vendors

Request body

CreateVendorRequest

Responses

StatusDescription
200
409vendor code already exists

Security: bearer

GET/api/v1/vendors/{id}

GET /api/vendors/{id} — entity + contacts + links.

Parameters

NameInTypeRequiredDescription
idpathstringYes

Responses

StatusDescription
200
404vendor not visible in scope

Security: bearer

PATCH/api/v1/vendors/{id}

PATCH /api/vendors/{id}

Parameters

NameInTypeRequiredDescription
idpathstringYes

Request body

UpdateVendorRequest

Responses

StatusDescription
200
404vendor not visible in scope
409vendor code already exists or version conflict

Security: bearer

GET/api/v1/vendors/{id}/contacts

GET /api/vendors/{id}/contacts

Parameters

NameInTypeRequiredDescription
idpathstringYes

Responses

StatusDescription
200

Security: bearer

POST/api/v1/vendors/{id}/contacts

POST /api/vendors/{id}/contacts — replace-on-write.

Parameters

NameInTypeRequiredDescription
idpathstringYes

Request body

ReplaceContactsRequest

Responses

StatusDescription
200
404vendor not visible in scope

Security: bearer