Topolo Docs Topolo Platform
Open workspace

Bind consumer resource

Bind a consumer resource or shared scope to an active kit.

Outcome

Bind a consumer resource or shared scope to an active kit.

Before you start

  • Verify whoami and the pinned credential context, then inspect the exact discovered action before preparing input.
  • Discover a granted Brand workspace. Pass its resourceType/workspace identifier separately from input; a copied fixture identifier grants no access.
  • The declared permission is brand:write. The active credential, application scope, resource binding and runtime authority must all authorize the request.
  • Review the exact mutation and recovery, including destructive scope, and execute only after the intended effect is authorized.

Discover the target

topolo whoami --json
topolo actions get app_topolo_brand.brand_bindings.upsert --detail --json
topolo resources topolo-brand --json
topolo workspaces list topolo-brand --json

Request

PUT /api/brand-bindings

Resource context is the selected Brand workspace. CLI/SDK action input includes path identifiers; direct HTTP JSON bodies exclude path parameters. Read the reviewed plan for the exact request.

Input fields

FieldRequiredMeaning
consumerAppIdYesConsumer application identifier, or * for a shared workspace/organization binding. Service callers can act only for their verified allowed service.
externalResourceTypeYesExact binding type; pair with externalResourceId. workspace and organization have special scope semantics.
externalResourceIdYesIdentifier paired with externalResourceType. For a workspace/organization binding use the canonical scoped identifier.
brandKitIdYesBrand kit identifier in the verified Brand workspace. Read brand_kits.list before selecting it.

Exact published input schema:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "consumerAppId": {
      "type": "string",
      "minLength": 1,
      "description": "Consumer application identifier, or * for a shared workspace/organization binding. Service callers can act only for their verified allowed service."
    },
    "externalResourceType": {
      "type": "string",
      "minLength": 1,
      "description": "Exact binding type; pair with externalResourceId. workspace and organization have special scope semantics."
    },
    "externalResourceId": {
      "type": "string",
      "minLength": 1,
      "description": "Identifier paired with externalResourceType. For a workspace/organization binding use the canonical scoped identifier."
    },
    "brandKitId": {
      "type": "string",
      "minLength": 1,
      "description": "Brand kit identifier in the verified Brand workspace. Read brand_kits.list before selecting it."
    }
  },
  "required": [
    "consumerAppId",
    "externalResourceType",
    "externalResourceId",
    "brandKitId"
  ],
  "additionalProperties": false
}

Effects

Creates or replaces the binding for an exact consumer/type/resource tuple and records an audit. Requires an active kit in the selected workspace.

Interpret the response

binding is the stored tuple. consumerAppId:* permits only workspace or organization scope; organization scope must name the verified organization. Workspace scopes use workspace identifiers. A stored binding does not make an unpublished kit resolve.

Response identifier contract:

{
  "kind": "brand_binding",
  "identifierSource": "response",
  "idPath": "$.binding.id"
}

Worked examples

These complete synthetic responses were captured from the local worker over canonical SQL migrations. Auth and R2 dependencies are simulated; notification delivery is not exercised. Set BRAND_WORKSPACE_ID from granted workspace discovery. Save reviewed input as payload.json, validate and inspect the unchanged plan. The final mutation command and MCP confirm flag assume the intended effect has already been authorized.

Minimal example

Input · payload.json:

{
  "consumerAppId": "app_topolo_books",
  "externalResourceType": "workspace",
  "externalResourceId": "ws_brand_documentation_fixture",
  "brandKitId": "brand_c794be50-0306-4933-8de8-5609340bed9e"
}

CLI:

topolo actions validate app_topolo_brand.brand_bindings.upsert --data @payload.json --json
topolo actions plan app_topolo_brand.brand_bindings.upsert --resource-type workspace --resource-id "$BRAND_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_brand.brand_bindings.upsert --resource-type workspace --resource-id "$BRAND_WORKSPACE_ID" --data @payload.json --confirm --json

MCP tool and arguments:

{
  "tool": "topolo_call_action",
  "arguments": {
    "actionId": "app_topolo_brand.brand_bindings.upsert",
    "input": {
      "consumerAppId": "app_topolo_books",
      "externalResourceType": "workspace",
      "externalResourceId": "ws_brand_documentation_fixture",
      "brandKitId": "brand_c794be50-0306-4933-8de8-5609340bed9e"
    },
    "resourceType": "workspace",
    "resourceId": "<identifier returned by resource discovery>",
    "confirm": true
  }
}

Captured local response · HTTP 200:

{
  "binding": {
    "id": "brand_binding_a4ab1e79-6dbe-45c4-af96-093a041abde6",
    "consumerAppId": "app_topolo_books",
    "externalResourceType": "workspace",
    "externalResourceId": "ws_brand_documentation_fixture",
    "brandKitId": "brand_c794be50-0306-4933-8de8-5609340bed9e",
    "createdAt": "2026-10-03T11:23:59.082Z",
    "updatedAt": "2026-10-03T11:23:59.082Z"
  }
}

binding is the stored tuple. consumerAppId:* permits only workspace or organization scope; organization scope must name the verified organization. Workspace scopes use workspace identifiers. A stored binding does not make an unpublished kit resolve.

Workflow example

Input · payload.json:

{
  "consumerAppId": "app_topolo_books",
  "externalResourceType": "workspace",
  "externalResourceId": "ws_brand_documentation_fixture",
  "brandKitId": "brand_55886012-13a4-4e95-ad31-3fe2b52cdf20"
}

CLI:

topolo actions validate app_topolo_brand.brand_bindings.upsert --data @payload.json --json
topolo actions plan app_topolo_brand.brand_bindings.upsert --resource-type workspace --resource-id "$BRAND_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_brand.brand_bindings.upsert --resource-type workspace --resource-id "$BRAND_WORKSPACE_ID" --data @payload.json --confirm --json

MCP tool and arguments:

{
  "tool": "topolo_call_action",
  "arguments": {
    "actionId": "app_topolo_brand.brand_bindings.upsert",
    "input": {
      "consumerAppId": "app_topolo_books",
      "externalResourceType": "workspace",
      "externalResourceId": "ws_brand_documentation_fixture",
      "brandKitId": "brand_55886012-13a4-4e95-ad31-3fe2b52cdf20"
    },
    "resourceType": "workspace",
    "resourceId": "<identifier returned by resource discovery>",
    "confirm": true
  }
}

Captured local response · HTTP 200:

{
  "binding": {
    "id": "brand_binding_813652d7-03ee-4cb3-b08c-001b1ba912f1",
    "consumerAppId": "app_topolo_books",
    "externalResourceType": "workspace",
    "externalResourceId": "ws_brand_documentation_fixture",
    "brandKitId": "brand_55886012-13a4-4e95-ad31-3fe2b52cdf20",
    "createdAt": "2026-10-03T11:23:59.119Z",
    "updatedAt": "2026-10-03T11:23:59.119Z"
  }
}

binding is the stored tuple. consumerAppId:* permits only workspace or organization scope; organization scope must name the verified organization. Workspace scopes use workspace identifiers. A stored binding does not make an unpublished kit resolve.

Verify the result

List the exact binding and resolve the intended context, checking binding.id, kit.id, version.id and winning scope.

Errors and recovery

  • auth_error (HTTP 401): CLI/SDK authentication classification when Auth returns a non-code message: restore the authorized credential, then verify whoami and context. Preserve the exact service message.

  • permission_denied (HTTP 403): Use the exact permission and granted resource required by the reviewed action; organization membership alone is insufficient.

  • workspace_required (HTTP 400): Discover and select a granted Brand workspace before preparing the request.

  • brand_storage_unavailable (HTTP 503): The Brand storage bindings are unavailable. Preserve the request identifier and report the service fault; do not retry an unverified mutation.

Recovery boundary

Capture any prior tuple and kit. Restore the prior binding through an approved upsert, or remove a newly created binding through an approved delete.

  • app_topolo_brand.brand_bindings.list: List consumer bindings for kits in the selected workspace.
  • app_topolo_brand.brand_kits.resolve_context: Resolve the first eligible brand for a consumer context.

Evidence

Four real local SQLite stores use all canonical migrations; Auth identity/grants and archival plus R2 object storage are explicitly simulated. Notifications are disabled in fixtures. No notification delivery, live mutation, gateway credential parity or deployed environment proof is claimed. Fixture identifiers and timestamps are synthetic and must be replaced by exact authorized resource discovery.