Topolo Docs Topolo Platform
Open workspace

Create Inventory location

Create a location with an ASCII slug code in the granted workspace. The first location is default; later ones are not. Duplicate workspace/code values fail uniqueness rather than upsert.

Outcome

Create a location with an ASCII slug code in the granted workspace. The first location is default; later ones are not. Duplicate workspace/code values fail uniqueness rather than upsert.

Before you start

  • Verify the authenticated identity, exact environment and pinned approved organization context before preparing an action.
  • The published application permission is workspace:write. Discover a granted Inventory workspace and bind that exact resource. Supplied identifiers do not grant access.
  • Authorize the documented inventory, review, import, notification, metering, privacy or archival effects before CLI --confirm or MCP confirm:true.

Discover the target

topolo whoami --json
topolo actions get app_topolo_inventory.locations.create --detail --json
topolo resources topolo-inventory --json
topolo workspaces list topolo-inventory --json
  • Select the exact granted workspace id as INVENTORY_WORKSPACE_ID. Fixture ids authorize no live operation.
  • Discover location ids through locations.list or the reviewed locations.create response in this workspace.

Request

POST /api/locations

Save action input as payload.json. Inspect the plan for the exact path, query and body. Set INVENTORY_WORKSPACE_ID from granted resource discovery.

Inspect and test this action in the signed action console, then perform the verification below.

Input fields

FieldRequiredTypeConstraints
nameRequiredstringNonblank location display name, trimmed by the handler.; {"minLength":1}
codeOptionalstringOptional code; lowercased ASCII slug from supplied value or name, at most 64 characters.; {"minLength":1}

View the complete input schema in the action console. The same schema is available through CLI and MCP action discovery.

Effects

  • Initializes the local identity mirror if absent, then creates a UUID location. No stock or notification is created.
  • The supplied code, or name when omitted, is lowercased, ASCII-slugified and truncated to 64 characters. isDefault is true only when the prior location count is zero.
  • Code and one-default uniqueness are enforced by SQLite. Count and insert are separate operations; concurrent first-location creation is not promised atomic.

Interpret the response

Use response path $.location.id for inventory_location. An empty list does not discover a target.

Retain location.id and verify code/isDefault through locations.get. Use locations.list to identify existing codes before an ambiguous replay.

The success schema was checked against captured handler responses. Delegated Auth profile and canonical widget context fields can vary; exact Inventory projections and all six raw SQL export stores are source-reviewed. Error examples retain their actual refusal shapes.

View the complete success schema in the action console. The worked examples below retain complete captured responses; action discovery supplies the exact schema.

Worked examples

Captured exported Worker responses use both real local SQLite D1 databases with all six committed migrations, synthetic Auth/workspace grants and simulated Notify/Nexus/archive transport. They prove local handler shapes and scoped behavior, not live authorization, notification delivery, metering acceptance or environment deployment. Large 100-row list/capped-dashboard captures are retained in local evidence; committed tests verify those limits while worked guides use smaller complete responses. Refused examples demonstrate boundaries and must not be executed as successful workflows.

Successful request

Actual exported Worker response with both local SQLite D1 databases and all committed migrations; synthetic Auth/grants and simulated Notify/Nexus/archive transport. No live delivery, billing or environment deployment proof. Captured scenario: derived code and nondefault location.

Input · payload.json:

{
  "name": "Overflow Rack 2"
}

CLI:

topolo actions validate app_topolo_inventory.locations.create --data @payload.json --json
topolo actions plan app_topolo_inventory.locations.create --resource-type workspace --resource-id "$INVENTORY_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_inventory.locations.create --resource-type workspace --resource-id "$INVENTORY_WORKSPACE_ID" --data @payload.json --confirm --json

MCP tool and arguments:

{
  "tool": "topolo_call_action",
  "arguments": {
    "actionId": "app_topolo_inventory.locations.create",
    "input": {
      "name": "Overflow Rack 2"
    },
    "resourceType": "workspace",
    "resourceId": "<identifier returned by granted resource discovery>",
    "confirm": true
  }
}

Captured local response · HTTP 201:

{
  "location": {
    "id": "invloc_736232f7-132c-4434-aafd-6f0795c71141",
    "name": "Overflow Rack 2",
    "code": "overflow-rack-2",
    "isDefault": false,
    "createdAt": "2026-10-04T05:46:36.699Z",
    "updatedAt": "2026-10-04T05:46:36.699Z"
  }
}

HTTP 201. Retain location.id and verify code/isDefault through locations.get. Use locations.list to identify existing codes before an ambiguous replay.

Another supported request

Actual exported Worker response with both local SQLite D1 databases and all committed migrations; synthetic Auth/grants and simulated Notify/Nexus/archive transport. No live delivery, billing or environment deployment proof. Captured scenario: locations.create.

Input · payload.json:

{
  "name": "Main warehouse",
  "code": "main"
}

CLI:

topolo actions validate app_topolo_inventory.locations.create --data @payload.json --json
topolo actions plan app_topolo_inventory.locations.create --resource-type workspace --resource-id "$INVENTORY_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_inventory.locations.create --resource-type workspace --resource-id "$INVENTORY_WORKSPACE_ID" --data @payload.json --confirm --json

MCP tool and arguments:

{
  "tool": "topolo_call_action",
  "arguments": {
    "actionId": "app_topolo_inventory.locations.create",
    "input": {
      "name": "Main warehouse",
      "code": "main"
    },
    "resourceType": "workspace",
    "resourceId": "<identifier returned by granted resource discovery>",
    "confirm": true
  }
}

Captured local response · HTTP 201:

{
  "location": {
    "id": "invloc_cfa27344-e120-4c97-90e4-7e876b0a5e3e",
    "name": "Main warehouse",
    "code": "main",
    "isDefault": true,
    "createdAt": "2026-10-04T05:46:37.080Z",
    "updatedAt": "2026-10-04T05:46:37.080Z"
  }
}

HTTP 201. Retain location.id and verify code/isDefault through locations.get. Use locations.list to identify existing codes before an ambiguous replay.

Verify the result

  • Retain location.id and verify code/isDefault through locations.get.
  • Use locations.list to identify existing codes before an ambiguous replay.

Errors and recovery

  • invalid_action_input (HTTP 400): Correct only the exact fields reported by the published schema validator. An invalid input can be refused before its handler.
  • action_permission_required (HTTP 403): Stop when the verified credential lacks the published action permission. Resource identifiers and organization ownership do not grant that permission.
  • organization_required (HTTP 403): Use the specifically authorized organization context; personal scope cannot act on organization-owned Inventory data.
  • workspace_required (HTTP 400): Discover an authorized Inventory workspace and pass its exact separate resource binding; bootstrap does not select a workspace.
  • workspaces_unavailable (HTTP 503): Retain the request id and report unavailable canonical workspace discovery; do not invent a default workspace.
  • name_required (HTTP 400): Provide a nonblank trimmed location name.

Auth, action-input validation and platform resource resolution can refuse a request before its handler. Retain the exact error, request id and context; requesting another context is not a legitimate way to bypass a refusal.

Recovery boundary

No published location edit, delete or default-changing action exists. Report a mistaken location for an authorized product/operator workflow; do not erase an entire organization to undo it.

  • Get Inventory location: Read one granted-workspace location by its returned identifier, with normalized code, default flag and timestamps. This response contains no per-location stock totals.
  • Record Inventory stock movement: Append one nonzero signed quantity delta against an active item and existing location in the same workspace. Movement type labels do not set the sign, pair a transfer or defer stock while review is pending.

Evidence

Captured exported Worker responses use both real local SQLite D1 databases with all six committed migrations, synthetic Auth/workspace grants and simulated Notify/Nexus/archive transport. They prove local handler shapes and scoped behavior, not live authorization, notification delivery, metering acceptance or environment deployment. Large 100-row list/capped-dashboard captures are retained in local evidence; committed tests verify those limits while worked guides use smaller complete responses. Capture digests and test scenarios are retained in the source fixture records.