Topolo Docs Topolo Platform
Open workspace

Discard brand draft

Permanently discard an unpublished working draft.

Outcome

Permanently discard an unpublished working draft.

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_kit_versions.discard --detail --json
topolo resources topolo-brand --json
topolo workspaces list topolo-brand --json

Request

DELETE /api/brand-kits/{brandKitId}/versions/{versionId}

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
brandKitIdYesBrand kit identifier in the verified Brand workspace. Read brand_kits.list before selecting it.
versionIdYesExact version identifier from brand_kit_versions.list for brandKitId; not the numeric version.

Exact published input schema:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "brandKitId": {
      "type": "string",
      "minLength": 1,
      "description": "Brand kit identifier in the verified Brand workspace. Read brand_kits.list before selecting it."
    },
    "versionId": {
      "type": "string",
      "minLength": 1,
      "description": "Exact version identifier from brand_kit_versions.list for brandKitId; not the numeric version."
    }
  },
  "required": [
    "brandKitId",
    "versionId"
  ],
  "additionalProperties": false
}

Effects

Deletes only a draft version and records its discard. Published and retired version rows cannot be discarded.

Interpret the response

discarded:true is the success result. brand_draft_not_found can mean the version is absent, inaccessible or immutable, so inspect status rather than assuming absence.

Response identifier contract:

{
  "kind": "brand_kit_versions_discard",
  "identifierSource": "none",
  "explanation": "discarded:true is the success result. brand_draft_not_found can mean the version is absent, inaccessible or immutable, so inspect status rather than assuming absence."
}

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:

{
  "brandKitId": "brand_c794be50-0306-4933-8de8-5609340bed9e",
  "versionId": "brand_version_e03a22ea-3d96-491b-8a09-d868a7b1d7b8"
}

CLI:

topolo actions validate app_topolo_brand.brand_kit_versions.discard --data @payload.json --json
topolo actions plan app_topolo_brand.brand_kit_versions.discard --resource-type workspace --resource-id "$BRAND_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_brand.brand_kit_versions.discard --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_kit_versions.discard",
    "input": {
      "brandKitId": "brand_c794be50-0306-4933-8de8-5609340bed9e",
      "versionId": "brand_version_e03a22ea-3d96-491b-8a09-d868a7b1d7b8"
    },
    "resourceType": "workspace",
    "resourceId": "<identifier returned by resource discovery>",
    "confirm": true
  }
}

Captured local response · HTTP 200:

{
  "discarded": true
}

discarded:true is the success result. brand_draft_not_found can mean the version is absent, inaccessible or immutable, so inspect status rather than assuming absence.

Workflow example

Input · payload.json:

{
  "brandKitId": "brand_55886012-13a4-4e95-ad31-3fe2b52cdf20",
  "versionId": "brand_version_5b7e9b88-e616-4797-aef7-1c5bd094eeed"
}

CLI:

topolo actions validate app_topolo_brand.brand_kit_versions.discard --data @payload.json --json
topolo actions plan app_topolo_brand.brand_kit_versions.discard --resource-type workspace --resource-id "$BRAND_WORKSPACE_ID" --data @payload.json --json
topolo actions call app_topolo_brand.brand_kit_versions.discard --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_kit_versions.discard",
    "input": {
      "brandKitId": "brand_55886012-13a4-4e95-ad31-3fe2b52cdf20",
      "versionId": "brand_version_5b7e9b88-e616-4797-aef7-1c5bd094eeed"
    },
    "resourceType": "workspace",
    "resourceId": "<identifier returned by resource discovery>",
    "confirm": true
  }
}

Captured local response · HTTP 200:

{
  "discarded": true
}

discarded:true is the success result. brand_draft_not_found can mean the version is absent, inaccessible or immutable, so inspect status rather than assuming absence.

Verify the result

List versions for the kit and confirm the exact draft identifier is gone while historical versions remain.

Errors and recovery

refused · HTTP 404

{
  "input": {
    "brandKitId": "missing-fixture",
    "versionId": "missing-version"
  },
  "response": {
    "error": "brand_draft_not_found"
  }
}

published immutable · HTTP 404

{
  "input": {
    "brandKitId": "brand_5b9a9c07-74db-48cd-85fe-b6cda159a7f7",
    "versionId": "brand_version_99d46a87-cdd3-47a8-bb44-7a45c648cb9d"
  },
  "response": {
    "error": "brand_draft_not_found"
  }
}
  • 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.

  • brand_draft_not_found (HTTP 404): Discover the exact parent/resource again and inspect its lifecycle status. Missing, inaccessible or immutable resources can share this refusal.

Recovery boundary

The discarded draft cannot be restored. Preserve its snapshot before deletion; creating a replacement draft produces a different identity.

  • app_topolo_brand.brand_kit_versions.list: List draft, published and retired versions of a kit.

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.