Inventory Manager API · stocktakes

Start a stocktake, appending inventory.stocktake-started

POST /stocktakes

The organization's first (after any it cancelled) is its opening stocktake: it counts every live location (naming fewer is 409 StocktakeLineRefused) and values every stock SKU, and completing it opens the general ledger. Every later one is periodic, over the locationIds it names (all live locations when omitted). One is open at a time: 409 StocktakeInProgress names the open one. Moving nothing until it completes, it is open to a person while the organization's stock is mirrored from a source, and to anyone holding financials:write — the count is stock's, the values the books'. stocktakeId is the caller-minted stk_ id and the idempotency key: a retry with the same stocktakeId is acknowledged with the stocktake it started and appends nothing.

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

stocktakeId is the caller-minted stk_ id and the idempotency key: a retry with the same stocktakeId is acknowledged with the stocktake it started 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

  • inventory.stocktake-started

What a fact is: Facts and the journal.

AI agent tool

Agents call this as inventory_start_stocktake (Inventory: Start stocktake), in the stocktakes toolset.

Connecting an agent: AI agents.

Example

Start a periodic count of Main; the caller mints the stocktake's id.

curl
curl -X POST 'https://inventory.getmanifold.io/stocktakes' \
  -H "Authorization: Bearer $MANIFOLD_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
  "stocktakeId": "stk_01a16585-57c0-7200-961d-25255f868ed4",
  "locationIds": [
    "loc_019cadd3-8330-7e12-aa44-2cd5f05da74a"
  ]
}'
JavaScript (fetch)
const response = await fetch("https://inventory.getmanifold.io/stocktakes", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.MANIFOLD_TOKEN}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "stocktakeId": "stk_01a16585-57c0-7200-961d-25255f868ed4",
    "locationIds": [
      "loc_019cadd3-8330-7e12-aa44-2cd5f05da74a"
    ]
  }),
});
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
const answer = await response.json();
Request body · application/json
{
  "stocktakeId": "stk_01a16585-57c0-7200-961d-25255f868ed4",
  "locationIds": [
    "loc_019cadd3-8330-7e12-aa44-2cd5f05da74a"
  ]
}
Response · 201 · application/json
{
  "id": "stk_01a16585-57c0-7200-961d-25255f868ed4",
  "number": "ST-00002",
  "kind": "periodic",
  "status": "open",
  "locationIds": [
    "loc_019cadd3-8330-7e12-aa44-2cd5f05da74a"
  ],
  "counts": [],
  "costs": [],
  "startedAt": "2026-10-22T21:30:00.000Z",
  "updatedAt": "2026-10-22T21:30: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: 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
LocationNotFound locationId No such record in this organization.Check the id in the path or the body.

409

RefusalWhat it meansWhat to do
StocktakeInProgress stocktakeId Another stocktake is already open over the same stock.Complete or cancel that stocktake first.
StocktakeLineRefused stocktakeId, sku, locationId, reason The SKU or location is outside this stocktake. reason says why.Count only what the stocktake covers.
LocationArchived locationId The location is archived, and an archived location takes no changes or stock.Use an active location.
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, with the same key.

How refusals work everywhere: Errors.

Used in