Inventory Manager API · sources

Register a legacy source

PUT /sources/{sourceId}

Register a legacy source, or say where it stands now — the call the app providing the source makes, under its own token, when it connects to the platform, as its first import runs and lands, and when its installation is retired at go-live.

The app mints sourceId (src_…) and sends the whole description: type is fixed once registered; status and counts are the migration as it stands. The registry stamps importedAt the first time the source reaches mirroring; the app never sends it. Appends inventory.source-connected for a new source and inventory.source-updated naming only what changed for a known one. 403 SourceNotYours for anyone but an app whose first-party role is legacy-platform (a sales channel holding imports:write included), or for a source another app registered; 409 SourceConflict when the body would change the source's type; 409 SourceAlreadyRetired for any change to a retired source. Idempotent by content: a retry that changes nothing is acknowledged and appends nothing.

Access

Requires imports:write.

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

Retries

Idempotent by content: a retry that changes nothing is acknowledged and appends nothing.

Why every write carries a key: Idempotency and retries.

Facts appended

  • inventory.source-connected
  • inventory.source-updated

What a fact is: Facts and the journal.

AI agent tool

No agent tool. Called only by the app that provides the legacy source (a legacy-platform app), under its own token, as its import runs and at go-live — the endpoint refuses any other caller; an agent reads where a migration stands with inventory_list_sources.

Connecting an agent: AI agents.

Example

The source's app reports its first import has landed and the tenant now mirrors it.

curl
curl -X PUT 'https://inventory.getmanifold.io/sources/src_019cb5dc-bf88-756c-8d01-2fa61dd4b669' \
  -H "Authorization: Bearer $MANIFOLD_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
  "type": "legacy-erp",
  "name": "Previous ERP",
  "status": "mirroring",
  "counts": [
    {
      "kind": "products",
      "count": 412
    },
    {
      "kind": "locations",
      "count": 2
    },
    {
      "kind": "parties",
      "count": 1380
    },
    {
      "kind": "stock-positions",
      "count": 824
    }
  ]
}'
JavaScript (fetch)
const response = await fetch("https://inventory.getmanifold.io/sources/src_019cb5dc-bf88-756c-8d01-2fa61dd4b669", {
  method: "PUT",
  headers: { Authorization: `Bearer ${process.env.MANIFOLD_TOKEN}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "type": "legacy-erp",
    "name": "Previous ERP",
    "status": "mirroring",
    "counts": [
      {
        "kind": "products",
        "count": 412
      },
      {
        "kind": "locations",
        "count": 2
      },
      {
        "kind": "parties",
        "count": 1380
      },
      {
        "kind": "stock-positions",
        "count": 824
      }
    ]
  }),
});
if (!response.ok) throw new Error(`${response.status}: ${await response.text()}`);
const answer = await response.json();
Request body · application/json
{
  "type": "legacy-erp",
  "name": "Previous ERP",
  "status": "mirroring",
  "counts": [
    {
      "kind": "products",
      "count": 412
    },
    {
      "kind": "locations",
      "count": 2
    },
    {
      "kind": "parties",
      "count": 1380
    },
    {
      "kind": "stock-positions",
      "count": 824
    }
  ]
}
Response · 200 · application/json
{
  "sourceId": "src_019cb5dc-bf88-756c-8d01-2fa61dd4b669",
  "appId": "app_019b8b74-1fd0-7d77-ba23-1c91bb26607d",
  "type": "legacy-erp",
  "name": "Previous ERP",
  "status": "mirroring",
  "importedAt": "2026-03-04T01:12:40.000Z",
  "counts": [
    {
      "kind": "products",
      "count": 412
    },
    {
      "kind": "locations",
      "count": 2
    },
    {
      "kind": "parties",
      "count": 1380
    },
    {
      "kind": "stock-positions",
      "count": 824
    }
  ],
  "connectedAt": "2026-03-03T22:41:09.000Z",
  "updatedAt": "2026-03-04T01:12:40.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
SourceNotYours sourceId, reason The import source belongs to another app, or your app may not keep one.Call it with the app that registered the source.
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
SourceAlreadyRetired sourceId The source is retired and takes no changes.Nothing to do here.
SourceConflict sourceId, reason The change would make the source a different kind.Register a new source instead.
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.