Inventory Manager API · accounts

A ledger app reports its chart of accounts

PUT /accounts/managed

A ledger app (Xero, MYOB) reports its chart of accounts, whole, under its own token (403 NotALedgerApp for anyone else), and the organization's chart follows it.

An account the app already keeps is found by its externalId and renamed, renumbered or archived to match; one at a code the organization already has is claimed — kept from then on by the app; any other is created. Nothing is ever removed: an account the app keeps that its chart no longer lists is marked archived, and the organization's own accounts are left alone. An account is skipped, with a reason, when its code is one Manifold cannot hold, another app keeps that code, or SKUs or a default stand in the way of renumbering it. Appends inventory.account-saved per account that changed. Idempotent by content: a chart reported as it already stands appends nothing.

Access

Requires financials:write.

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

Retries

Idempotent by content: a chart reported as it already stands appends nothing.

Why every write carries a key: Idempotency and retries.

Facts appended

  • inventory.account-saved

What a fact is: Facts and the journal.

AI agent tool

No agent tool. only a ledger app's own token may report its chart (NotALedgerApp for anyone else); an agent connects Xero or MYOB and asks for a sync instead

Connecting an agent: AI agents.

Example

A ledger app reports its chart: one account new, one matching a code the tenant has, one Manifold cannot hold.

curl
curl -X PUT 'https://inventory.getmanifold.io/accounts/managed' \
  -H "Authorization: Bearer $MANIFOLD_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
  "accounts": [
    {
      "externalId": "01a15890-7dea-7806-9cf0-c59f91669602",
      "code": "4020",
      "name": "Online sales",
      "archived": false
    },
    {
      "externalId": "01a1589d-8690-7b74-aefc-712fb1b0fec2",
      "code": "4010",
      "name": "Wholesale sales",
      "description": "Income from trade customers.",
      "archived": false
    },
    {
      "externalId": "01a15860-14a6-74e8-9328-26df4b457cba",
      "code": "BANK FEES",
      "name": "Bank fees",
      "archived": false
    }
  ]
}'
JavaScript (fetch)
const response = await fetch("https://inventory.getmanifold.io/accounts/managed", {
  method: "PUT",
  headers: { Authorization: `Bearer ${process.env.MANIFOLD_TOKEN}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "accounts": [
      {
        "externalId": "01a15890-7dea-7806-9cf0-c59f91669602",
        "code": "4020",
        "name": "Online sales",
        "archived": false
      },
      {
        "externalId": "01a1589d-8690-7b74-aefc-712fb1b0fec2",
        "code": "4010",
        "name": "Wholesale sales",
        "description": "Income from trade customers.",
        "archived": false
      },
      {
        "externalId": "01a15860-14a6-74e8-9328-26df4b457cba",
        "code": "BANK FEES",
        "name": "Bank fees",
        "archived": false
      }
    ]
  }),
});
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
const answer = await response.json();
Request body · application/json
{
  "accounts": [
    {
      "externalId": "01a15890-7dea-7806-9cf0-c59f91669602",
      "code": "4020",
      "name": "Online sales",
      "archived": false
    },
    {
      "externalId": "01a1589d-8690-7b74-aefc-712fb1b0fec2",
      "code": "4010",
      "name": "Wholesale sales",
      "description": "Income from trade customers.",
      "archived": false
    },
    {
      "externalId": "01a15860-14a6-74e8-9328-26df4b457cba",
      "code": "BANK FEES",
      "name": "Bank fees",
      "archived": false
    }
  ]
}
Response · 200 · application/json
{
  "results": [
    {
      "externalId": "01a15890-7dea-7806-9cf0-c59f91669602",
      "code": "4020",
      "outcome": "created",
      "accountId": "acct_019e80e8-c900-79a0-be53-3d5443d6d0a2"
    },
    {
      "externalId": "01a1589d-8690-7b74-aefc-712fb1b0fec2",
      "code": "4010",
      "outcome": "claimed",
      "accountId": "acct_01a161c4-0a00-72db-a577-07bcb2a24026"
    },
    {
      "externalId": "01a15860-14a6-74e8-9328-26df4b457cba",
      "code": "BANK FEES",
      "outcome": "skipped",
      "reason": "the code \"BANK FEES\" is not one the chart can hold (letters and digits, up to 20 characters)"
    }
  ]
}

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
NotALedgerApp Only a ledger app may call this.Call it with the ledger app's token.
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.

409

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

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.