Purchasing Manager API · pos
Rewrite a purchase order
PUT /pos/{poId}
Rewrite a purchase order: the supplier and/or the whole line set (replace semantics — the lines sent are the lines the order has afterwards).
supplierId attaches the order to a CRM company, or detaches it when sent as null (the typed supplier name stays). A draft takes anything. Once authorised, a line with units already received is frozen — 409 PoLineReceived if its quantity would drop below what arrived or its cost changes — while unreceived lines may change, be removed or be added, and inventory's incoming expectations are re-registered to match (cancel, then expect the new outstanding quantity, keyed by the order's revision; 502 InventoryUnavailable if that fails). 409 PoNotEditable once received, invoiced, closed or cancelled. Appends purchasing.po-updated. Idempotent by content: a retry that says what the order already says is acknowledged and appends nothing. A stock-changing rewrite is saved as the order's plan first and its fact lands once inventory has every movement; a plan inventory cannot take yet is carried out by its own run when inventory answers.
Access
Requires purchasing:write.
How scopes come from roles: Scopes and roles. Getting a token: Authentication and app tokens.
Retries
Idempotent by content: a retry that says what the order already says is acknowledged and appends nothing.
Why every write carries a key: Idempotency and retries.
Facts appended
purchasing.po-updated
What a fact is: Facts and the journal.
AI agent tool
Agents call this as purchasing_update_po (Purchasing: Update PO), in the purchasing toolset.
Connecting an agent: AI agents.
Example
curl -X PUT 'https://purchasing.getmanifold.io/pos/po_01a1340f-9980-7c41-9d37-d97a5cec069b' \
-H "Authorization: Bearer $MANIFOLD_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"lines": [
{
"sku": "WIDGET-RED",
"quantity": 30
},
{
"sku": "WIDGET-BLUE",
"quantity": 10
}
]
}'const response = await fetch("https://purchasing.getmanifold.io/pos/po_01a1340f-9980-7c41-9d37-d97a5cec069b", {
method: "PUT",
headers: { Authorization: `Bearer ${process.env.MANIFOLD_TOKEN}`, "Content-Type": "application/json" },
body: JSON.stringify({
"lines": [
{
"sku": "WIDGET-RED",
"quantity": 30
},
{
"sku": "WIDGET-BLUE",
"quantity": 10
}
]
}),
});
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
const answer = await response.json();{
"lines": [
{
"sku": "WIDGET-RED",
"quantity": 30
},
{
"sku": "WIDGET-BLUE",
"quantity": 10
}
]
}{
"id": "po_01a1340f-9980-7c41-9d37-d97a5cec069b",
"number": "PO-00002",
"serial": 2,
"reference": "NW-REORDER-RED",
"supplier": "Northwind Components",
"supplierId": "cmp_01a15884-6399-7e5f-8a6b-1c2d3e4f5a6b",
"currency": "AUD",
"status": "draft",
"lines": [
{
"sku": "WIDGET-RED",
"ordered": 30,
"received": 0,
"cancelled": 0,
"unitCostCents": 1180
},
{
"sku": "WIDGET-BLUE",
"ordered": 10,
"received": 0,
"cancelled": 0,
"unitCostCents": 1250
}
],
"landedCosts": [],
"payables": [],
"payments": [],
"revision": 0,
"createdAt": "2026-10-06T23:40:00.000Z",
"updatedAt": "2026-10-07T00:05:00.000Z"
}The panel writes this call in other languages. It does not send it: Manifold's APIs do not take calls from a web
page on another site, so run the call from your own code or terminal. The whole API as OpenAPI: purchasing-manager.openapi.json. Base URL https://purchasing.getmanifold.io.
Errors
Every refusal is a status and a JSON body whose _tag names it. A refused call changes nothing.
401
| Refusal | What it means | What to do |
|---|---|---|
Unauthorized reason | The token is missing, expired or not one Manifold issued. | Get a fresh token and send the call again. |
TokenAlreadyUsed tokenId | A single-use app token was already spent. | Mint a new token for this call. |
402
| Refusal | What it means | What to do |
|---|---|---|
SubscriptionRequired status | The organization's subscription has lapsed, so writes are refused. | An owner settles billing. Reads still work meanwhile. |
403
| Refusal | What it means | What to do |
|---|---|---|
TenantRequired userId | The token names no organization. | Choose the organization, then get a new token. |
ScopeRequired required | The token's roles do not grant the scope this call needs. | Ask an owner or admin for a role that grants it. |
404
| Refusal | What it means | What to do |
|---|---|---|
PoNotFound poId | No such record in this organization. | Check the id in the path or the body. |
ItemNotFound sku | No such record in this organization. | Check the id in the path or the body. |
409
| Refusal | What it means | What to do |
|---|---|---|
PoNotEditable poId, status | The purchase order cannot be edited in its state. status says which. | Read the purchase order. |
PoLineReceived poId, sku, received, requested | Units have already arrived on this line, so its cost and the quantity received are fixed. | Change only what has not arrived. |
LineUncosted skus | A line has no cost, and the purchase order needs one on every line. skus names them. | Set a cost on each line. |
KitNotBuyable sku, reason | The request was refused. reason says why. | Nothing changed. Read the record, then decide. |
StockSkuOnTwoLines sku, lines | The request was refused, and nothing changed. | Nothing changed. Read the record, then decide. |
MirroredFromSource source | This area is fed by your source system until the organization goes live. | Make the change in the source system, or go live first. |
502
| Refusal | What it means | What to do |
|---|---|---|
InventoryUnavailable reason | The inventory service did not answer, so nothing changed. | Send the same request again shortly. |
503
| Refusal | What it means | What to do |
|---|---|---|
RequestLogUnavailable tokenId, reason | The service could not record the request, so it did nothing. | Send the same request again shortly. |
How refusals work everywhere: Errors.