Purchasing Manager API · pos
Reverse a cost on the order
POST /pos/{poId}/costs/{costId}/reverse
Reverse a cost on the order (404 CostNotFound): it stays, marked reversed, and the ledger posts its opposite (a capitalised one lowers the layers it lifted).
Appends purchasing.cost-reversed. Idempotent by state: a cost is reversed once, so a retry 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
Idempotent by state: a cost is reversed once, so a retry is acknowledged and appends nothing.
Why every write carries a key: Idempotency and retries.
Facts appended
purchasing.cost-reversed
What a fact is: Facts and the journal.
AI agent tool
Agents call this as purchasing_reverse_po_cost (Purchasing: Reverse PO cost), in the costs toolset.
Connecting an agent: AI agents.
Example
From Journal an additional cost on an order, step 16: Reverse it.
curl -X POST 'https://purchasing.getmanifold.io/pos/po_01a15ad0-c2b1-7c3d-8e4f-5a6b7c8d9e0f/costs/cost_01a15ad0-f0d1-7662-82e0-1b2c3d4e5f60/reverse' \
-H "Authorization: Bearer $MANIFOLD_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"reason": "Billed to the supplier instead"
}'const response = await fetch("https://purchasing.getmanifold.io/pos/po_01a15ad0-c2b1-7c3d-8e4f-5a6b7c8d9e0f/costs/cost_01a15ad0-f0d1-7662-82e0-1b2c3d4e5f60/reverse", {
method: "POST",
headers: { Authorization: `Bearer ${process.env.MANIFOLD_TOKEN}`, "Content-Type": "application/json" },
body: JSON.stringify({
"reason": "Billed to the supplier instead"
}),
});
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
const answer = await response.json();{
"reason": "Billed to the supplier instead"
}{
"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",
"reversal": {
"by": {
"_tag": "user",
"id": "usr_01a15ad0-a1b2-7c3d-8e4f-5a6b7c8d9e01"
},
"at": "2026-10-21T01:10:40.464Z",
"reason": "Billed to the supplier instead"
},
"capitalised": false,
"lines": []
}
],
"payables": [],
"payments": [],
"revision": 0,
"createdAt": "2026-10-21T01:10:37.821Z",
"updatedAt": "2026-10-21T01:10:40.464Z"
}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. |
CostNotFound costId | No such record in this organization. | Check the id in the path or the body. |
409
| Refusal | What it means | What to do |
|---|---|---|
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.
Used in
- Journal an additional cost on an order, step 16: Reverse it
- Journal an additional cost on an order, step 17: Reverse it again