Inventory Manager API · stocktakes

Abandon an open stocktake

POST /stocktakes/{stocktakeId}/cancel

Abandon an open stocktake, appending inventory.stocktake-cancelled: nothing it counted moves, and if it was the opening one, the next stocktake started is the opening one.

409 StocktakeNotOpen once completed. Idempotent by state: a stocktake is cancelled once, so a retry on a cancelled stocktake is acknowledged and appends nothing (a second reason is ignored).

Access

Requires stock:write or financials:write.

Any one of these scopes is enough.

How scopes come from roles: Scopes and roles. Getting a token: Authentication and app tokens.

Retries

Idempotent by state: a stocktake is cancelled once, so a retry on a cancelled stocktake is acknowledged and appends nothing (a second reason is ignored).

Why every write carries a key: Idempotency and retries.

Facts appended

  • inventory.stocktake-cancelled

What a fact is: Facts and the journal.

AI agent tool

Agents call this as inventory_cancel_stocktake (Inventory: Cancel stocktake), in the stocktakes toolset. It is marked destructive, so the agent asks before running it.

Connecting an agent: AI agents.

Example

curl
curl -X POST 'https://inventory.getmanifold.io/stocktakes/stk_01a16585-57c0-7200-961d-25255f868ed4/cancel' \
  -H "Authorization: Bearer $MANIFOLD_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
  "reason": "Counted the wrong aisle; starting again."
}'
JavaScript (fetch)
const response = await fetch("https://inventory.getmanifold.io/stocktakes/stk_01a16585-57c0-7200-961d-25255f868ed4/cancel", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.MANIFOLD_TOKEN}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "reason": "Counted the wrong aisle; starting again."
  }),
});
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
const answer = await response.json();
Request body · application/json
{
  "reason": "Counted the wrong aisle; starting again."
}
Response · 200 · application/json
{
  "id": "stk_01a16585-57c0-7200-961d-25255f868ed4",
  "number": "ST-00002",
  "kind": "periodic",
  "status": "cancelled",
  "locationIds": [
    "loc_019cadd3-8330-7e12-aa44-2cd5f05da74a"
  ],
  "counts": [
    {
      "sku": "WIDGET-BLUE",
      "locationId": "loc_019cadd3-8330-7e12-aa44-2cd5f05da74a",
      "counted": 137
    },
    {
      "sku": "WIDGET-RED",
      "locationId": "loc_019cadd3-8330-7e12-aa44-2cd5f05da74a",
      "counted": 0
    }
  ],
  "costs": [],
  "startedAt": "2026-10-22T21:30:00.000Z",
  "updatedAt": "2026-10-22T22:05:00.000Z",
  "cancelledAt": "2026-10-22T22:05:00.000Z",
  "reason": "Counted the wrong aisle; starting again."
}

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: inventory-manager.openapi.json. Base URL https://inventory.getmanifold.io.

Errors

Every refusal is a status and a JSON body whose _tag names it. A refused call changes nothing.

401

RefusalWhat it meansWhat 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

RefusalWhat it meansWhat to do
SubscriptionRequired status The organization's subscription has lapsed, so writes are refused.An owner settles billing. Reads still work meanwhile.

403

RefusalWhat it meansWhat 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

RefusalWhat it meansWhat to do
StocktakeNotFound stocktakeId No such record in this organization.Check the id in the path or the body.

409

RefusalWhat it meansWhat to do
StocktakeNotOpen stocktakeId, status The stocktake is completed or cancelled, so it takes no more counts.Start a new stocktake.
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.

503

RefusalWhat it meansWhat 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