{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/africanmarketos-com/json-schema/africanmarketos-com-integration-retirement-response-schema.json",
  "title": "IntegrationRetirementResponse",
  "description": "Successful operator-only POST integration_retire receipt. Retires canonical state and preserves private history without deleting legacy KV, registering or activating an integration, issuing permission, enqueueing delivery or retrying historical jobs. Matching operation replay returns the original receipt, not a fresh current-state observation. Additional top-level fields may be added by the shared response envelope.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/africanmarketos-com-admin-api-openapi.yml#/components/schemas/IntegrationRetirementResponse",
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "enum": [
        "ok"
      ]
    },
    "scope": {
      "type": "object",
      "properties": {
        "tenant_id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,119}$"
        },
        "workspace_id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,119}$"
        }
      },
      "required": [
        "tenant_id",
        "workspace_id"
      ],
      "additionalProperties": false
    },
    "family": {
      "type": "string",
      "enum": [
        "webhook",
        "sink"
      ]
    },
    "integration_id": {
      "type": "string",
      "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,119}$"
    },
    "operation_id": {
      "type": "string",
      "format": "uuid",
      "pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$",
      "description": "Required body operation_id, scoped to the target tenant/workspace across integration families. It is distinct from the optional HTTP Idempotency-Key header; that header cannot replace it. Retry with the same operation_id, action, scope, family, integration_id, trimmed reason and ORIGINAL expected_canonical_version/expected_canonical_hash/expected_legacy_hash. While the stored operation receipt exists, matching replay returns its original result with duplicate=true without rechecking current integration state; changed reuse returns HTTP 409 runtime_integration_operation_conflict. Do not refresh preconditions or change the operation ID to bypass a conflict or uncertain result."
    },
    "canonical_status": {
      "type": "string",
      "enum": [
        "retired"
      ]
    },
    "canonical_version": {
      "type": "integer",
      "minimum": 1
    },
    "retired_at": {
      "type": "string",
      "format": "date-time"
    },
    "history_preserved": {
      "type": "boolean",
      "enum": [
        true
      ],
      "description": "Private canonical and legacy before-images and the operation receipt are committed with retirement in one canonical transaction. The private before-images are not returned here. Legacy KV is not part of that transaction."
    },
    "legacy_record_deleted": {
      "type": "boolean",
      "enum": [
        false
      ]
    },
    "external_actions_executed": {
      "type": "boolean",
      "enum": [
        false
      ]
    },
    "historical_actions_replayed": {
      "type": "boolean",
      "enum": [
        false
      ]
    },
    "prior_effect_recalled": {
      "type": "boolean",
      "enum": [
        false
      ]
    },
    "enforcement": {
      "type": "string",
      "description": "Future effect claims require current active canonical state. Already claimed or completed external effects cannot be recalled."
    },
    "duplicate": {
      "type": "boolean",
      "enum": [
        true
      ],
      "description": "Present only for matching replay of a stored operation receipt; omitted on the initial successful retirement."
    }
  },
  "required": [
    "status",
    "scope",
    "family",
    "integration_id",
    "operation_id",
    "canonical_status",
    "canonical_version",
    "retired_at",
    "history_preserved",
    "legacy_record_deleted",
    "external_actions_executed",
    "historical_actions_replayed",
    "prior_effect_recalled",
    "enforcement"
  ],
  "additionalProperties": true
}