Topolo Docs Topolo Platform
Open workspace

Complete and archive a campaign — Campaigns

Records a completion and changes an active or paused campaign to archived. Its codes subsequently fail the active-campaign validation check.

Complete and archive a campaign

Records a completion and changes an active or paused campaign to archived. Its codes subsequently fail the active-campaign validation check.

Outcome and boundaries

Records a completion and changes an active or paused campaign to archived. Its codes subsequently fail the active-campaign validation check.

An existing completion returns completion:null and alreadyCompleted:true without a new completion row. A background completion notification may still be attempted only on the initial completion.

Before you start

  • Confirm the intended environment and current credential organization using whoami; discover the exact application/action before any call.
  • Required application permission: app_topolo_campaigns.campaigns:write. Catalog discoverability is not permission to execute.
  • Discover an authorized canonical workspace and bind resourceType workspace/resourceId separately from action input.
  • All worked cases in this guide are hypothetical source-reviewed illustrations; no business action, live fixture, customer data or provider request was executed.
  • Canonical workspace minimum access is read_write in addition to the application permission. After grant verification, the first request may create an app-local identity/recipient mirror even before the later app-permission check; this is not campaign-domain completion.

Discover the intended identifiers

  • Read campaigns.get in the same workspace and inspect current status before completion.

Action: app_topolo_campaigns.campaigns.complete · POST /api/campaigns/{id}/complete.

Input fields

FieldRequiredMeaning and validation
idYesCampaign identifier from campaigns[].id; scoped to the selected organization/workspace. It is not a batch/code/placement id. string; minLength=1
summaryNoOptional stored completion summary object; no external metrics are independently verified. object

Safe call sequence

Write the reviewed input to payload.json; fixture identifiers below are unusable examples. Validate before planning, bind the discovered resource separately, and execute only within actual authority.

topolo actions validate app_topolo_campaigns.campaigns.complete --data @payload.json --json
topolo actions plan app_topolo_campaigns.campaigns.complete --resource-type workspace --resource-id "$CAMPAIGNS_WORKSPACE_ID" --data @payload.json --json

The published action requires confirmation. Only after the exact mutation is authorized, use that same payload/context with --confirm on plan/call; no operation in this guide has been executed.

Worked cases

Every response below is synthetic and source-reviewed, not captured. HTTP status and body are explained independently; a structurally valid body alone never proves successful execution. Middleware may add a different error envelope.

First completion · HTTP 200

Input:

{
  "id": "campaign_example",
  "summary": {
    "note": "Illustrative closeout"
  }
}

Illustrative response:

{
  "completion": {
    "id": "campaign_completion_campaign_example",
    "campaignId": "campaign_example",
    "campaignName": "Illustrative launch",
    "summary": {
      "note": "Illustrative closeout"
    },
    "completedAt": "2026-10-20T00:00:00.000Z"
  },
  "alreadyCompleted": false
}

Existing completion is a no-op · HTTP 200

Input:

{
  "id": "campaign_example"
}

Illustrative response:

{
  "completion": null,
  "alreadyCompleted": true
}

Draft campaign without a completion · HTTP 400

Input:

{
  "id": "campaign_example"
}

Illustrative response:

{
  "error": "campaign_not_running"
}

Verify the outcome

  • When alreadyCompleted is false, match completion.campaignId and read campaigns.get to verify the new archived state. When alreadyCompleted is true, completion is null: do not dereference it or infer the campaign is still archived, because it may have been separately updated. Read current campaigns.get and reconcile the retained completion separately.

Refusals and recovery

  • HTTP 404 campaign_not_found: Correct the named input or retain the authoritative refusal in the same context.
  • HTTP 400 campaign_not_running: Correct the named input or retain the authoritative refusal in the same context.
  • HTTP 403 forbidden: Raw handler permission refusal. SDKs can normalize it to permission_denied. Keep the same intended resource; do not widen access.
  • HTTP 403 workspace_forbidden: The canonical workspace grant refused the selected resource. Resolve it with the access owner, not a guessed workspace.

No deletion or exact undo is published for this record. Preserve the returned identifier and inspect the corresponding list before considering another separately authorized operation. A timeout does not prove that nothing was written.

Source and catalog limits

The route maps non-not-found domain errors to HTTP 400; the catalog 409 wording is not the reviewed route status. There is no published action that deletes the completion row.

Exact schemas and provenance

Input schema:

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1
    },
    "summary": {
      "type": "object",
      "properties": {},
      "additionalProperties": {}
    }
  },
  "required": [
    "id"
  ],
  "additionalProperties": false
}

Output schema:

{
  "type": "object",
  "title": "Complete campaign response",
  "description": "Operation result returned by campaigns.complete.",
  "properties": {
    "success": {
      "type": "boolean"
    },
    "id": {
      "type": "string"
    },
    "data": {
      "anyOf": [
        {
          "type": "object",
          "title": "campaign record",
          "properties": {
            "id": {
              "type": "string",
              "description": "Stable identifier when the campaign exposes one."
            }
          },
          "additionalProperties": true
        },
        {
          "type": "object",
          "additionalProperties": true
        }
      ]
    },
    "result": {
      "type": "object",
      "additionalProperties": true
    },
    "message": {
      "type": "string"
    }
  },
  "additionalProperties": true,
  "x-topolo-contract-source": "derived-action-metadata",
  "x-topolo-contract-precision": "structural"
}

Reviewed immutable source: TopoloCampaigns@cacbb8b12b4e19a662cf82d03a927aef3c3a35e8, apps/api/src/campaign-orchestration-store.ts. Fresh production catalog was read on 2026-10-20. Its publication metadata is not proof that this source is loaded. Output examples are not widened or rewritten to force schema success; the accompanying validation record classifies exact success, refusal, no-body and structural-schema limits.

  • Get campaign — Campaigns: Reads one non-deleted campaign in the bound organization and workspace. An absent or differently scoped campaign returns HTTP 404 campaign_not_found.
  • Update or activate a campaign — Campaigns: Changes campaign name, offer or draft/active/paused/archived status. Activation allows existing active codes to validate/redeem; it does not issue or distribute codes.
  • Check code eligibility — Campaigns: Evaluates a code and returns HTTP 200 with valid:true or valid:false and a reason. This read does not consume redemption capacity.

Local input rejection example

This deliberately invalid input belongs to a pure schema check; it is never a planned or executed request. The closed action input schema must reject the extra field. It has no HTTP status or server response.

{
  "id": "campaign_example",
  "summary": {
    "note": "Illustrative closeout"
  },
  "__unsupported_field": true
}

The hidden companion labels this as ILLUSTRATIVE_LOCAL_SCHEMA_CHECK; its validation representation is not an action output.

Published output validation limits

Current published output qualification: the output schema accepts an empty object, a partial success marker, a partial data object and a refusal body. It therefore establishes only broad structure. Require the documented HTTP/domain result and source-shaped fields; missing fields or a schema-valid error are not success.

These observations come from pure checks of the exact published schema; they are not server responses or production captures.