Purchasing Manager API · pos
Journal an additional cost on the order by hand
POST /pos/{poId}/costs
Journal an additional cost on the order by hand: an amount, a reason and the chart account it is charged to (accountCode), for the order or one line (sku; 409 UnknownPoLine).
409 AccountNotPostable for an account not in the chart, archived or kept by the ledger; 409 CostCurrencyRefused for a currency other than the order's or the home one; 409 PoNotAuthorised on a draft, closed or cancelled order. With capitalise, or on the inventory account, it is spread over the units received like a landed cost (409 NothingReceivedToCapitalise before any arrive); otherwise an expense. Credits 2160 accrued costs. Appends purchasing.cost-recorded. costId (a caller-minted cost_…) is required and is the idempotency key: a retry with the same id is acknowledged and appends nothing.
Access
Requires financials:write.
How scopes come from roles: Scopes and roles. Getting a token: Authentication and app tokens.
Retries
costId (a caller-minted cost_…) is required and is the idempotency key: a retry with the same id is acknowledged and appends nothing.
A retry with the same key answers 201, with what the first call recorded.
Why every write carries a key: Idempotency and retries.
Facts appended
purchasing.cost-recorded
What a fact is: Facts and the journal.
AI agent tool
Agents call this as purchasing_record_po_cost (Purchasing: Record PO cost), in the costs toolset.
Connecting an agent: AI agents.
Example
From Journal an additional cost on an order, step 14: Journal the broker's fee.
curl -X POST 'https://purchasing.getmanifold.io/pos/po_01a15ad0-c2b1-7c3d-8e4f-5a6b7c8d9e0f/costs' \
-H "Authorization: Bearer $MANIFOLD_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"costId": "cost_01a15ad0-f0d1-7662-82e0-1b2c3d4e5f60",
"amountCents": 3500,
"reason": "Customs broker'\''s clearance fee",
"accountCode": "6300"
}'const response = await fetch("https://purchasing.getmanifold.io/pos/po_01a15ad0-c2b1-7c3d-8e4f-5a6b7c8d9e0f/costs", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.MANIFOLD_TOKEN}`, "Content-Type": "application/json" },
body: JSON.stringify({
"costId": "cost_01a15ad0-f0d1-7662-82e0-1b2c3d4e5f60",
"amountCents": 3500,
"reason": "Customs broker's clearance fee",
"accountCode": "6300"
}),
});
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
const answer = await response.json();{
"costId": "cost_01a15ad0-f0d1-7662-82e0-1b2c3d4e5f60",
"amountCents": 3500,
"reason": "Customs broker's clearance fee",
"accountCode": "6300"
}{
"id": "po_01a15ad0-c2b1-7c3d-8e4f-5a6b7c8d9e0f",
"number": "PO-00001",
"serial": 1,
"reference": "PO-POTTERY-0918",
"supplier": "Kiln Street Pottery",
"currency": "AUD",
"status": "authorised",
"authorisedOn": "2026-10-21",
"lines": [
{
"sku": "MUG-SPECKLED",
"ordered": 40,
"received": 0,
"cancelled": 0,
"unitCostCents": 950
}
],
"receipts": [],
"issues": [],
"shipments": [],
"landedCosts": [],
"costs": [
{
"costId": "cost_01a15ad0-f0d1-7662-82e0-1b2c3d4e5f60",
"amountCents": 3500,
"currency": "AUD",
"fx": {
"currency": "AUD",
"home": "AUD",
"rate": 1,
"rateDate": "2026-10-21",
"source": "same"
},
"reason": "Customs broker's clearance fee",
"accountCode": "6300",
"date": "2026-10-21",
"recordedBy": {
"_tag": "user",
"id": "usr_01a15ad0-a1b2-7c3d-8e4f-5a6b7c8d9e01"
},
"recordedAt": "2026-10-21T01:10:39.501Z",
"capitalised": false,
"lines": []
}
],
"payables": [],
"payments": [],
"revision": 0,
"createdAt": "2026-10-21T01:10:37.821Z",
"updatedAt": "2026-10-21T01:10:39.501Z"
}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. |
409
| Refusal | What it means | What to do |
|---|---|---|
PoNotAuthorised poId, status | The purchase order is not authorised, so it cannot receive or be invoiced. | Authorise it first. |
UnknownPoLine poId, sku | The SKU is not on the purchase order. | Add the line first, or check the SKU. |
AccountNotPostable accountCode, reason | The request was refused. reason says why. | Nothing changed. Read the record, then decide. |
CostCurrencyRefused currency, allowed | The request was refused, and nothing changed. | Nothing changed. Read the record, then decide. |
NothingReceivedToCapitalise poId, sku | 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, with the same key. |
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, with the same key. |
How refusals work everywhere: Errors.
Used in
- Journal an additional cost on an order, step 14: Journal the broker's fee