{
  "openapi": "3.1.0",
  "info": {
    "title": "Orishare API",
    "version": "v1",
    "description": "Loyalty, incentives, promotions and engagement infrastructure. Customers integrate once, send events, and versioned rules award points, move tiers, issue rewards, progress challenges and emit webhooks.  Conventions: JSON snake_case; RFC 3339 UTC timestamps; cursor pagination (`limit`, `cursor`, `next_cursor`, `has_more`); one error shape with stable `code` values (see `x-error-codes`); `Idempotency-Key` required on creating POSTs; `ETag` / `If-Match` for safe edits; management tokens (`opat_`) name an environment with `X-Orishare-Environment`; secret keys (`osk_`) are bound to one environment; publishable keys (`opk_`) may only send allowed client events.",
    "contact": {
      "name": "Orishare",
      "url": "https://docs.orishare.com"
    }
  },
  "servers": [
    {
      "url": "https://api.orishare.com/v1"
    }
  ],
  "tags": [
    {
      "name": "client configurations",
      "description": "Exact browser origins and bounded client admission settings."
    },
    {
      "name": "portal configurations",
      "description": "Versioned hosted widget configurations and their public render read."
    },
    {
      "name": "assets",
      "description": "Bounded immutable program art and public normalized images."
    },
    {
      "name": "notifications",
      "description": "Message types, templates, quiet hours, caps, recipient consent and the delivery log; signed unsubscribe links."
    },
    {
      "name": "leagues",
      "description": "Weekly cohorts on a tier ladder with promotion, demotion and rank rewards."
    },
    {
      "name": "social",
      "description": "Display names and visibility customers show to other players."
    },
    {
      "name": "teams",
      "description": "Teams of players, their members, team quests and team boards."
    },
    {
      "name": "friend quests",
      "description": "Shared goals for two friends and friend streaks, with paired rewards."
    },
    {
      "name": "customer surface",
      "description": "Private customer projections and session-authorized commands."
    },
    {
      "name": "customer merges",
      "description": "Permanent anonymous-to-known customer ownership links."
    },
    {
      "name": "customer identity",
      "description": "Customer identity connections, bindings and authentication state."
    },
    {
      "name": "customer sessions",
      "description": "Customer proof exchange, session issuance, renewal and revocation."
    },
    {
      "name": "account",
      "description": "Signup, tokens, invitations, memberships and ownership for people and agents."
    },
    {
      "name": "management",
      "description": "Organizations, projects, environments, API keys and usage."
    },
    {
      "name": "change_sets",
      "description": "Configuration proposals: applied under the environment autonomy policy, or confirmed by a person in the dashboard; logged and undoable."
    },
    {
      "name": "pending actions",
      "description": "One exact request an AI asked a person to approve after the production gate held it: approved or declined in the dashboard, run once, answer stored."
    },
    {
      "name": "autonomy",
      "description": "Per-environment autonomy policy: whether agent change sets apply on their own, within limits, or only after a person confirms."
    },
    {
      "name": "agent_onboarding",
      "description": "Agent signup (a working project in one call, no browser) and the claim link a person uses to take ownership."
    },
    {
      "name": "bulk_operations",
      "description": "Frozen per-customer operations proposed as a change set, run item by item, retried and undone."
    },
    {
      "name": "playbooks",
      "description": "First-party playbook manifests, install/upgrade/uninstall previews as change sets, and installations with ownership drift."
    },
    {
      "name": "assistant",
      "description": "The conversational admin assistant: conversations, turns admitted with 202 and polled, recorded tool calls. It reads and proposes; a person confirms every change in the dashboard."
    },
    {
      "name": "events",
      "description": "Ingestion (202 async, 200 sync), event definitions, retries."
    },
    {
      "name": "customers",
      "description": "Customers, aliases, attributes and the aggregated state view."
    },
    {
      "name": "ledger",
      "description": "Currencies, manual adjustments, entries and balances."
    },
    {
      "name": "rules",
      "description": "Rules, immutable versions, publish, pause, simulate."
    },
    {
      "name": "campaigns",
      "description": "Schedules, priorities, stacking groups, budgets, audiences."
    },
    {
      "name": "programs",
      "description": "Versioned program definitions, publication and activation."
    },
    {
      "name": "streaks",
      "description": "Pinned streak programs, periods and freeze inventory."
    },
    {
      "name": "badges",
      "description": "Pinned achievements, ranks and recognition history."
    },
    {
      "name": "quests",
      "description": "Pinned graph quests, runs, progress and claims."
    },
    {
      "name": "levels",
      "description": "Native XP qualification, levels and prestige."
    },
    {
      "name": "leaderboards",
      "description": "Leaderboard contributions, standings and prize settlement."
    },
    {
      "name": "referrals",
      "description": "Referral share codes, settlement reviews and corrections."
    },
    {
      "name": "reward commerce",
      "description": "Reward catalogues, quotes, inventory and fulfillment."
    },
    {
      "name": "seasons",
      "description": "Immutable season versions and settlement periods."
    },
    {
      "name": "tiers",
      "description": "Tier programs, levels and per-customer tiers."
    },
    {
      "name": "rewards",
      "description": "Rewards, issuances, redemption and cancellation."
    },
    {
      "name": "challenges",
      "description": "Challenges, enrollment and progress."
    },
    {
      "name": "segments",
      "description": "Static membership and dynamic segments computed from attributes, balances, tiers and activity."
    },
    {
      "name": "counters",
      "description": "Historical counter definitions and backfills."
    },
    {
      "name": "webhooks",
      "description": "Endpoints, signed deliveries, replay."
    },
    {
      "name": "audit",
      "description": "Audit trail."
    },
    {
      "name": "context",
      "description": "Project context for AI drafting and the UI."
    },
    {
      "name": "config",
      "description": "Whole-environment export and atomic apply."
    },
    {
      "name": "ai",
      "description": "AI drafting: plain-English requests become validated rule documents for review; never published by the model."
    },
    {
      "name": "support",
      "description": "Audited staff access."
    },
    {
      "name": "pricing",
      "description": "Public offer and estimates, organization pricing, usage, statements and spend settings, and staff pricing authoring and proposals."
    },
    {
      "name": "store credit",
      "description": "Money-valued wallets, applying credit to orders (hold, capture, void, refund) and reconciliation."
    },
    {
      "name": "connectors",
      "description": "Shopify, Stripe and Klaviyo installations, verified inbound webhooks, discount-code redemptions and profile sync."
    },
    {
      "name": "imports",
      "description": "Customer and balance imports from another loyalty program: chunked upload, dry run, run and reconciliation."
    },
    {
      "name": "partner rewards",
      "description": "Gift-card suppliers and brand partners: catalogue items, offer links, orders, reconciliation and settlement."
    },
    {
      "name": "economy",
      "description": "Items, shop offers and player inventories: grants, purchases, consumption, equipping and refunds."
    },
    {
      "name": "experiments",
      "description": "Holdouts and A/B tests: weighted variants, targeted rules, campaigns and programs, and results with intervals and lift."
    },
    {
      "name": "analytics",
      "description": "Retention cohorts, daily activity and the analytics build."
    }
  ],
  "x-error-codes": {
    "validation_failed": {
      "status": 400,
      "type": "invalid_request",
      "doc_url": "https://docs.orishare.com/errors#validation_failed",
      "retry": "never"
    },
    "invalid_cursor": {
      "status": 400,
      "type": "invalid_request",
      "doc_url": "https://docs.orishare.com/errors#invalid_cursor",
      "retry": "never"
    },
    "invalid_json": {
      "status": 400,
      "type": "invalid_request",
      "doc_url": "https://docs.orishare.com/errors#invalid_json",
      "retry": "never"
    },
    "body_too_large": {
      "status": 413,
      "type": "invalid_request",
      "doc_url": "https://docs.orishare.com/errors#body_too_large",
      "retry": "never"
    },
    "event_too_large": {
      "status": 413,
      "type": "invalid_request",
      "doc_url": "https://docs.orishare.com/errors#event_too_large",
      "retry": "never"
    },
    "batch_too_large": {
      "status": 400,
      "type": "invalid_request",
      "doc_url": "https://docs.orishare.com/errors#batch_too_large",
      "retry": "never"
    },
    "occurred_at_in_future": {
      "status": 400,
      "type": "invalid_request",
      "doc_url": "https://docs.orishare.com/errors#occurred_at_in_future",
      "retry": "never"
    },
    "unsupported_media_type": {
      "status": 415,
      "type": "invalid_request",
      "doc_url": "https://docs.orishare.com/errors#unsupported_media_type",
      "retry": "never"
    },
    "authentication_required": {
      "status": 401,
      "type": "authentication",
      "doc_url": "https://docs.orishare.com/errors#authentication_required",
      "retry": "never"
    },
    "invalid_credentials": {
      "status": 401,
      "type": "authentication",
      "doc_url": "https://docs.orishare.com/errors#invalid_credentials",
      "retry": "never"
    },
    "invalid_customer_session": {
      "status": 401,
      "type": "authentication",
      "doc_url": "https://docs.orishare.com/errors#invalid_customer_session",
      "retry": "never"
    },
    "customer_credential_retired": {
      "status": 410,
      "type": "authentication",
      "doc_url": "https://docs.orishare.com/errors#customer_credential_retired",
      "retry": "never"
    },
    "customer_surface_inactive": {
      "status": 403,
      "type": "permission",
      "doc_url": "https://docs.orishare.com/errors#customer_surface_inactive",
      "retry": "never"
    },
    "insufficient_customer_scope": {
      "status": 403,
      "type": "permission",
      "doc_url": "https://docs.orishare.com/errors#insufficient_customer_scope",
      "retry": "never"
    },
    "invalid_session_grant": {
      "status": 400,
      "type": "invalid_request",
      "doc_url": "https://docs.orishare.com/errors#invalid_session_grant",
      "retry": "never"
    },
    "customer_session_limit": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#customer_session_limit",
      "retry": "after_delay"
    },
    "portal_unavailable": {
      "status": 503,
      "type": "api_error",
      "doc_url": "https://docs.orishare.com/errors#portal_unavailable",
      "retry": "never"
    },
    "portal_version_stale": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#portal_version_stale",
      "retry": "refetch_then_retry"
    },
    "credentials_revoked": {
      "status": 401,
      "type": "authentication",
      "doc_url": "https://docs.orishare.com/errors#credentials_revoked",
      "retry": "never"
    },
    "environment_required": {
      "status": 403,
      "type": "permission",
      "doc_url": "https://docs.orishare.com/errors#environment_required",
      "retry": "never"
    },
    "environment_served_elsewhere": {
      "status": 421,
      "type": "invalid_request",
      "doc_url": "https://docs.orishare.com/errors#environment_served_elsewhere",
      "retry": "never"
    },
    "insufficient_scope": {
      "status": 403,
      "type": "permission",
      "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
      "retry": "never"
    },
    "event_requires_secret_key": {
      "status": 403,
      "type": "permission",
      "doc_url": "https://docs.orishare.com/errors#event_requires_secret_key",
      "retry": "never"
    },
    "anonymous_id_retired": {
      "status": 403,
      "type": "permission",
      "doc_url": "https://docs.orishare.com/errors#anonymous_id_retired",
      "retry": "never"
    },
    "origin_not_allowed": {
      "status": 403,
      "type": "permission",
      "doc_url": "https://docs.orishare.com/errors#origin_not_allowed",
      "retry": "never"
    },
    "audit_reason_required": {
      "status": 403,
      "type": "permission",
      "doc_url": "https://docs.orishare.com/errors#audit_reason_required",
      "retry": "never"
    },
    "forbidden": {
      "status": 403,
      "type": "permission",
      "doc_url": "https://docs.orishare.com/errors#forbidden",
      "retry": "never"
    },
    "route_not_found": {
      "status": 404,
      "type": "not_found",
      "doc_url": "https://docs.orishare.com/errors#route_not_found",
      "retry": "never"
    },
    "resource_not_found": {
      "status": 404,
      "type": "not_found",
      "doc_url": "https://docs.orishare.com/errors#resource_not_found",
      "retry": "never"
    },
    "stale_write": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#stale_write",
      "retry": "refetch_then_retry"
    },
    "preview_stale": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#preview_stale",
      "retry": "never"
    },
    "confirmation_required": {
      "status": 403,
      "type": "permission",
      "doc_url": "https://docs.orishare.com/errors#confirmation_required",
      "retry": "never"
    },
    "origin_mismatch": {
      "status": 403,
      "type": "permission",
      "doc_url": "https://docs.orishare.com/errors#origin_mismatch",
      "retry": "never"
    },
    "csrf_invalid": {
      "status": 403,
      "type": "permission",
      "doc_url": "https://docs.orishare.com/errors#csrf_invalid",
      "retry": "never"
    },
    "acknowledgement_required": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#acknowledgement_required",
      "retry": "never"
    },
    "change_set_not_pending": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#change_set_not_pending",
      "retry": "never"
    },
    "change_set_expired": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#change_set_expired",
      "retry": "never"
    },
    "resource_in_use": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#resource_in_use",
      "retry": "never"
    },
    "already_exists": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#already_exists",
      "retry": "never"
    },
    "event_id_conflict": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#event_id_conflict",
      "retry": "never"
    },
    "contribution_conflict": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#contribution_conflict",
      "retry": "never"
    },
    "alias_conflict": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#alias_conflict",
      "retry": "never"
    },
    "merge_conflict": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#merge_conflict",
      "retry": "never"
    },
    "merge_capacity_exceeded": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#merge_capacity_exceeded",
      "retry": "never"
    },
    "invalid_state": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#invalid_state",
      "retry": "never"
    },
    "config_format_required": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#config_format_required",
      "retry": "never"
    },
    "insufficient_balance": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#insufficient_balance",
      "retry": "never"
    },
    "streak_repair_unavailable": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#streak_repair_unavailable",
      "retry": "never"
    },
    "streak_repair_limit_reached": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#streak_repair_limit_reached",
      "retry": "never"
    },
    "reward_unavailable": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#reward_unavailable",
      "retry": "never"
    },
    "last_owner": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#last_owner",
      "retry": "never"
    },
    "concurrent_update": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#concurrent_update",
      "retry": "same_key"
    },
    "selection_unsupported": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#selection_unsupported",
      "retry": "never"
    },
    "selection_too_large": {
      "status": 400,
      "type": "invalid_request",
      "doc_url": "https://docs.orishare.com/errors#selection_too_large",
      "retry": "never"
    },
    "selection_empty": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#selection_empty",
      "retry": "never"
    },
    "operation_running": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#operation_running",
      "retry": "after_delay"
    },
    "playbook_refused": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#playbook_refused",
      "retry": "never"
    },
    "playbook_too_large": {
      "status": 413,
      "type": "invalid_request",
      "doc_url": "https://docs.orishare.com/errors#playbook_too_large",
      "retry": "never"
    },
    "rule_invalid": {
      "status": 422,
      "type": "invalid_request",
      "doc_url": "https://docs.orishare.com/errors#rule_invalid",
      "retry": "never"
    },
    "trust_insufficient": {
      "status": 403,
      "type": "permission",
      "doc_url": "https://docs.orishare.com/errors#trust_insufficient",
      "retry": "never"
    },
    "source_time_untrusted": {
      "status": 400,
      "type": "invalid_request",
      "doc_url": "https://docs.orishare.com/errors#source_time_untrusted",
      "retry": "never"
    },
    "idempotency_key_required": {
      "status": 400,
      "type": "idempotency",
      "doc_url": "https://docs.orishare.com/errors#idempotency_key_required",
      "retry": "never"
    },
    "idempotency_key_reused": {
      "status": 422,
      "type": "idempotency",
      "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
      "retry": "never"
    },
    "idempotency_in_progress": {
      "status": 409,
      "type": "idempotency",
      "doc_url": "https://docs.orishare.com/errors#idempotency_in_progress",
      "retry": "after_delay"
    },
    "rate_limited": {
      "status": 429,
      "type": "rate_limited",
      "doc_url": "https://docs.orishare.com/errors#rate_limited",
      "retry": "after_delay"
    },
    "quota_exceeded": {
      "status": 429,
      "type": "rate_limited",
      "doc_url": "https://docs.orishare.com/errors#quota_exceeded",
      "retry": "after_delay"
    },
    "asset_quota_exceeded": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#asset_quota_exceeded",
      "retry": "never"
    },
    "ai_drafting_disabled": {
      "status": 403,
      "type": "permission",
      "doc_url": "https://docs.orishare.com/errors#ai_drafting_disabled",
      "retry": "never"
    },
    "ai_assistant_disabled": {
      "status": 403,
      "type": "permission",
      "doc_url": "https://docs.orishare.com/errors#ai_assistant_disabled",
      "retry": "never"
    },
    "turn_in_progress": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#turn_in_progress",
      "retry": "after_delay"
    },
    "conversation_expired": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#conversation_expired",
      "retry": "never"
    },
    "conversation_full": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#conversation_full",
      "retry": "never"
    },
    "usage_allowance_exhausted": {
      "status": 402,
      "type": "rate_limited",
      "doc_url": "https://docs.orishare.com/errors#usage_allowance_exhausted",
      "retry": "never"
    },
    "free_allowance_exhausted": {
      "status": 402,
      "type": "rate_limited",
      "doc_url": "https://docs.orishare.com/errors#free_allowance_exhausted",
      "retry": "never"
    },
    "live_requires_claim": {
      "status": 403,
      "type": "permission",
      "doc_url": "https://docs.orishare.com/errors#live_requires_claim",
      "retry": "never"
    },
    "test_player_limit": {
      "status": 403,
      "type": "permission",
      "doc_url": "https://docs.orishare.com/errors#test_player_limit",
      "retry": "never"
    },
    "test_environment_resetting": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#test_environment_resetting",
      "retry": "after_delay"
    },
    "pricing_unavailable": {
      "status": 503,
      "type": "api_error",
      "doc_url": "https://docs.orishare.com/errors#pricing_unavailable",
      "retry": "never"
    },
    "billing_unavailable": {
      "status": 503,
      "type": "api_error",
      "doc_url": "https://docs.orishare.com/errors#billing_unavailable",
      "retry": "never"
    },
    "mid_period_change_unsupported": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#mid_period_change_unsupported",
      "retry": "never"
    },
    "offer_changed": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#offer_changed",
      "retry": "refetch_then_retry"
    },
    "entitlement_required": {
      "status": 403,
      "type": "permission",
      "doc_url": "https://docs.orishare.com/errors#entitlement_required",
      "retry": "never"
    },
    "ai_draft_rejected": {
      "status": 422,
      "type": "invalid_request",
      "doc_url": "https://docs.orishare.com/errors#ai_draft_rejected",
      "retry": "never"
    },
    "ai_unavailable": {
      "status": 503,
      "type": "api_error",
      "doc_url": "https://docs.orishare.com/errors#ai_unavailable",
      "retry": "after_delay"
    },
    "customer_admission_unavailable": {
      "status": 503,
      "type": "api_error",
      "doc_url": "https://docs.orishare.com/errors#customer_admission_unavailable",
      "retry": "after_delay"
    },
    "asset_processing_unavailable": {
      "status": 503,
      "type": "api_error",
      "doc_url": "https://docs.orishare.com/errors#asset_processing_unavailable",
      "retry": "after_delay"
    },
    "capability_unavailable": {
      "status": 501,
      "type": "api_error",
      "doc_url": "https://docs.orishare.com/errors#capability_unavailable",
      "retry": "never"
    },
    "evaluation_failed": {
      "status": 502,
      "type": "api_error",
      "doc_url": "https://docs.orishare.com/errors#evaluation_failed",
      "retry": "same_key"
    },
    "internal_error": {
      "status": 500,
      "type": "api_error",
      "doc_url": "https://docs.orishare.com/errors#internal_error",
      "retry": "never"
    },
    "connector_order_pending": {
      "status": 503,
      "type": "api_error",
      "doc_url": "https://docs.orishare.com/errors#connector_order_pending",
      "retry": "after_delay"
    },
    "inventory_full": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#inventory_full",
      "retry": "never"
    },
    "insufficient_items": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#insufficient_items",
      "retry": "never"
    },
    "offer_unavailable": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#offer_unavailable",
      "retry": "refetch_then_retry"
    },
    "purchase_limit_reached": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#purchase_limit_reached",
      "retry": "never"
    },
    "item_archived": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#item_archived",
      "retry": "never"
    },
    "not_equippable": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#not_equippable",
      "retry": "never"
    },
    "invalid_economy_request": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#invalid_economy_request",
      "retry": "never"
    },
    "energy_archived": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#energy_archived",
      "retry": "never"
    },
    "insufficient_energy": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#insufficient_energy",
      "retry": "never"
    },
    "too_many_boosts": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#too_many_boosts",
      "retry": "never"
    },
    "match_profile_archived": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#match_profile_archived",
      "retry": "never"
    },
    "loot_table_unavailable": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#loot_table_unavailable",
      "retry": "never"
    },
    "battle_pass_unavailable": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#battle_pass_unavailable",
      "retry": "never"
    },
    "tier_not_reached": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#tier_not_reached",
      "retry": "never"
    },
    "premium_required": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#premium_required",
      "retry": "never"
    },
    "tier_already_claimed": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#tier_already_claimed",
      "retry": "never"
    },
    "energy_paused": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#energy_paused",
      "retry": "never"
    },
    "battle_pass_paused": {
      "status": 409,
      "type": "conflict",
      "doc_url": "https://docs.orishare.com/errors#battle_pass_paused",
      "retry": "never"
    },
    "proof_of_work_invalid": {
      "status": 422,
      "type": "invalid_request",
      "doc_url": "https://docs.orishare.com/errors#proof_of_work_invalid",
      "retry": "never"
    },
    "claim_invalid": {
      "status": 404,
      "type": "not_found",
      "doc_url": "https://docs.orishare.com/errors#claim_invalid",
      "retry": "never"
    },
    "environment_activating": {
      "status": 503,
      "type": "api_error",
      "doc_url": "https://docs.orishare.com/errors#environment_activating",
      "retry": "after_delay"
    }
  },
  "paths": {
    "/auth/signup": {
      "post": {
        "summary": "Create a user, an organization with a default project and two environments, and a first token",
        "tags": [
          "account"
        ],
        "operationId": "post_auth_signup",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "already_exists",
            "offer_changed",
            "pricing_unavailable"
          ],
          "resource": "accounts",
          "action": "create",
          "examples": {
            "request": {
              "email": "reader@example.test",
              "organization_name": "Example",
              "timezone": "UTC"
            },
            "success": {
              "status": 201,
              "body": {
                "organization": {
                  "id": "org_example",
                  "name": "Example",
                  "slug": "example"
                },
                "project": {
                  "id": "proj_example",
                  "name": "Default"
                },
                "environments": [
                  {
                    "id": "env_example",
                    "name": "sandbox",
                    "runtime_class": "sandbox"
                  }
                ],
                "user": {
                  "id": "usr_example",
                  "email": "reader@example.test",
                  "name": "Reader",
                  "created_at": "2026-09-20T10:00:00.000000Z"
                },
                "token": {
                  "id": "pat_example",
                  "token": "opat_example_secret",
                  "scopes": [
                    "*"
                  ]
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": [
              "accounts"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [],
        "security": [],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "email": "reader@example.test",
                "organization_name": "Example",
                "timezone": "UTC"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "maxLength": 254,
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "organization_name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "timezone": {
                    "default": "UTC",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "offer": {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      "version": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 1000000
                      }
                    },
                    "required": [
                      "id",
                      "version"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "email",
                  "organization_name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "created_at": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        }
                      },
                      "required": [
                        "id",
                        "email",
                        "name",
                        "created_at"
                      ],
                      "additionalProperties": false
                    },
                    "organization": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "slug"
                      ],
                      "additionalProperties": false
                    },
                    "project": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "environments": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "runtime_class": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "runtime_class"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "token": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "token": {
                              "type": "string"
                            },
                            "scopes": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "id",
                            "token",
                            "scopes"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "The first token, shown once. null on an idempotent replay (Idempotent-Replayed: true): the account exists, sign in to issue a new token"
                    }
                  },
                  "required": [
                    "user",
                    "organization",
                    "project",
                    "environments",
                    "token"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/organizations": {
      "post": {
        "summary": "Create another organization owned by the caller, with a default project and two environments",
        "tags": [
          "account"
        ],
        "operationId": "post_organizations",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "insufficient_scope"
          ],
          "resource": "organizations",
          "action": "create",
          "examples": {
            "request": {
              "name": "Example",
              "timezone": "UTC"
            },
            "success": {
              "status": 201,
              "body": {
                "organization": {
                  "id": "org_example",
                  "name": "Example",
                  "slug": "example"
                },
                "project": {
                  "id": "proj_example",
                  "name": "Default"
                },
                "environments": [
                  {
                    "id": "env_example",
                    "name": "sandbox",
                    "runtime_class": "sandbox"
                  }
                ]
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "organizations"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "Example",
                "timezone": "UTC"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "timezone": {
                    "default": "UTC",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "organization": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "slug": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "slug"
                      ],
                      "additionalProperties": false
                    },
                    "project": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "environments": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "runtime_class": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "runtime_class"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "organization",
                    "project",
                    "environments"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "Organizations the caller belongs to",
        "tags": [
          "management"
        ],
        "operationId": "get_organizations",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "audit_reason_required",
            "invalid_cursor"
          ],
          "resource": "organizations",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "plan": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "version": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "id",
                              "version"
                            ],
                            "additionalProperties": false
                          },
                          "billing_mode": {
                            "type": "string",
                            "enum": [
                              "card",
                              "invoice",
                              "none"
                            ]
                          },
                          "ai_drafting_disabled": {
                            "type": "boolean"
                          },
                          "version": {
                            "type": "number"
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "slug",
                          "plan",
                          "billing_mode",
                          "ai_drafting_disabled",
                          "version",
                          "created_at",
                          "updated_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/users/me": {
      "get": {
        "summary": "The caller and their memberships",
        "tags": [
          "account"
        ],
        "operationId": "get_users_me",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "audit_reason_required",
            "resource_not_found"
          ],
          "resource": "users",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "usr_example",
                "email": "reader@example.test",
                "name": "Reader",
                "created_at": "2026-09-20T10:00:00.000000Z",
                "memberships": [
                  {
                    "organization_id": "org_example",
                    "user_id": "usr_example",
                    "email": "reader@example.test",
                    "role": "owner",
                    "created_at": "2026-09-20T10:00:00.000000Z"
                  }
                ]
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "memberships": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "organization_id": {
                            "type": "string"
                          },
                          "user_id": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "owner",
                              "admin",
                              "editor",
                              "viewer"
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "organization_id",
                          "user_id",
                          "email",
                          "role",
                          "created_at"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "id",
                    "email",
                    "name",
                    "created_at",
                    "memberships"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/tokens": {
      "post": {
        "summary": "Issue a personal access token with scopes, or an AI access key (purpose ai_access) narrowed to an organization, environments and a default environment",
        "tags": [
          "account"
        ],
        "operationId": "post_auth_tokens",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "insufficient_scope",
            "resource_not_found"
          ],
          "resource": "personal_access_tokens",
          "action": "create",
          "examples": {
            "request": {
              "name": "Server",
              "scopes": [
                "organizations:read"
              ]
            },
            "success": {
              "status": 201,
              "body": {
                "id": "pat_example",
                "name": "Server",
                "prefix": "opat_example",
                "scopes": [
                  "organizations:read"
                ],
                "expires_at": null,
                "last_used_at": null,
                "created_at": "2026-09-20T10:00:00.000000Z",
                "purpose": null,
                "organization_id": null,
                "environment_ids": null,
                "default_environment_id": null,
                "token": "opat_example_secret"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": [
              "personal_access_tokens"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "Server",
                "scopes": [
                  "organizations:read"
                ]
              },
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "scopes": {
                    "description": "The scopes; or give `access` instead",
                    "minItems": 1,
                    "maxItems": 80,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[a-z_]+:[a-z_*]+$|^\\*$"
                    }
                  },
                  "access": {
                    "description": "ADR 0065: read = every read scope, full = `*` (both bounded by your role); instead of `scopes`",
                    "type": "string",
                    "enum": [
                      "read",
                      "full"
                    ]
                  },
                  "expires_in_days": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 365
                  },
                  "purpose": {
                    "description": "ai_access: an AI access key, listed under Settings, AI connections",
                    "type": "string",
                    "enum": [
                      "ai_access"
                    ]
                  },
                  "organization_id": {
                    "description": "The only organization the token may act in; omitted or null = all",
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "environment_ids": {
                    "description": "Environments of organization_id the token may act in; null = all",
                    "anyOf": [
                      {
                        "minItems": 1,
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "default_environment_id": {
                    "description": "Selected when a request sends no X-Orishare-Environment",
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "prefix": {
                      "type": "string"
                    },
                    "scopes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "expires_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "last_used_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "purpose": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "ai_access"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "organization_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "environment_ids": {
                      "anyOf": [
                        {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "default_environment_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "token": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "prefix",
                    "scopes",
                    "expires_at",
                    "last_used_at",
                    "created_at",
                    "purpose",
                    "organization_id",
                    "environment_ids",
                    "default_environment_id",
                    "token"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "List the caller's tokens",
        "tags": [
          "account"
        ],
        "operationId": "get_auth_tokens",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "audit_reason_required",
            "invalid_cursor"
          ],
          "resource": "personal_access_tokens",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "purpose",
            "schema": {
              "description": "Only AI access keys",
              "type": "string",
              "enum": [
                "ai_access"
              ]
            },
            "description": "Only AI access keys"
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "prefix": {
                            "type": "string"
                          },
                          "scopes": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "expires_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "last_used_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "purpose": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "ai_access"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "organization_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "environment_ids": {
                            "anyOf": [
                              {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "default_environment_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "prefix",
                          "scopes",
                          "expires_at",
                          "last_used_at",
                          "created_at",
                          "purpose",
                          "organization_id",
                          "environment_ids",
                          "default_environment_id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/auth/tokens/{id}": {
      "delete": {
        "summary": "Revoke a token (the current one included)",
        "tags": [
          "account"
        ],
        "operationId": "delete_auth_tokens_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "audit_reason_required",
            "confirmation_required",
            "resource_not_found",
            "insufficient_scope"
          ],
          "resource": "personal_access_tokens",
          "action": "delete",
          "examples": {
            "success": {
              "status": 204
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": true,
            "effectFamilies": [
              "personal_access_tokens"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/organizations/{id}/invitations": {
      "post": {
        "summary": "Invite a user by email with a role",
        "tags": [
          "account"
        ],
        "operationId": "post_organizations_id_invitations",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "resource_not_found",
            "already_exists"
          ],
          "resource": "invitations",
          "action": "create",
          "examples": {
            "request": {
              "email": "reader@example.test",
              "role": "viewer"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "inv_example",
                "organization_id": "org_example",
                "email": "reader@example.test",
                "role": "viewer",
                "expires_at": "2026-09-20T10:00:00.000000Z",
                "accepted_at": null,
                "created_at": "2026-09-20T10:00:00.000000Z",
                "token": "inv_example_secret"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": [
              "invitations"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "organizations:read",
              "organizations:write"
            ],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "email": "reader@example.test",
                "role": "viewer"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "maxLength": 254,
                    "format": "email",
                    "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                  },
                  "role": {
                    "type": "string",
                    "enum": [
                      "owner",
                      "admin",
                      "editor",
                      "viewer"
                    ]
                  }
                },
                "required": [
                  "email",
                  "role"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "organization_id": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "admin",
                        "editor",
                        "viewer"
                      ]
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "accepted_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "token": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "organization_id",
                    "email",
                    "role",
                    "expires_at",
                    "accepted_at",
                    "created_at",
                    "token"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/invitations/{id}/accept": {
      "post": {
        "summary": "Accept an invitation with its token; creates the user when needed and returns a first token (existing users sign in instead)",
        "tags": [
          "account"
        ],
        "operationId": "post_invitations_id_accept",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "resource_not_found",
            "invalid_state",
            "forbidden"
          ],
          "resource": "invitations",
          "action": "transition",
          "examples": {
            "request": {
              "token": "inv_example_secret"
            },
            "success": {
              "status": 200,
              "body": {
                "user": {
                  "id": "usr_example",
                  "email": "reader@example.test",
                  "name": "Reader",
                  "created_at": "2026-09-20T10:00:00.000000Z"
                },
                "membership": {
                  "organization_id": "org_example",
                  "user_id": "usr_example",
                  "email": "reader@example.test",
                  "role": "owner",
                  "created_at": "2026-09-20T10:00:00.000000Z"
                },
                "token": {
                  "id": "pat_example",
                  "token": "opat_example_secret",
                  "scopes": [
                    "*"
                  ]
                }
              }
            }
          },
          "transition": {
            "from": [
              "pending"
            ],
            "to": "accepted"
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": [
              "invitations"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [],
        "security": [],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "token": "inv_example_secret"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "token": {
                    "type": "string",
                    "minLength": 10
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  }
                },
                "required": [
                  "token"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "created_at": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        }
                      },
                      "required": [
                        "id",
                        "email",
                        "name",
                        "created_at"
                      ],
                      "additionalProperties": false
                    },
                    "membership": {
                      "type": "object",
                      "properties": {
                        "organization_id": {
                          "type": "string"
                        },
                        "user_id": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string",
                          "enum": [
                            "owner",
                            "admin",
                            "editor",
                            "viewer"
                          ]
                        },
                        "created_at": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        }
                      },
                      "required": [
                        "organization_id",
                        "user_id",
                        "email",
                        "role",
                        "created_at"
                      ],
                      "additionalProperties": false
                    },
                    "token": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "token": {
                              "type": "string"
                            },
                            "scopes": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "id",
                            "token",
                            "scopes"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ],
                      "description": "A first token when the user was just created; null for an existing user and on an idempotent replay (Idempotent-Replayed: true), where the user signs in instead"
                    }
                  },
                  "required": [
                    "user",
                    "membership",
                    "token"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/organizations/{id}/memberships": {
      "get": {
        "summary": "List members",
        "tags": [
          "account"
        ],
        "operationId": "get_organizations_id_memberships",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "memberships",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "organizations:read"
            ],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "organization_id": {
                            "type": "string"
                          },
                          "user_id": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "owner",
                              "admin",
                              "editor",
                              "viewer"
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "organization_id",
                          "user_id",
                          "email",
                          "role",
                          "created_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/organizations/{id}/memberships/{user_id}": {
      "patch": {
        "summary": "Change a member's role",
        "tags": [
          "account"
        ],
        "operationId": "patch_organizations_id_memberships_user_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "confirmation_required",
            "resource_not_found",
            "last_owner"
          ],
          "resource": "memberships",
          "action": "update",
          "examples": {
            "request": {
              "role": "editor"
            },
            "success": {
              "status": 200,
              "body": {
                "organization_id": "org_example",
                "user_id": "usr_example",
                "email": "reader@example.test",
                "role": "editor",
                "created_at": "2026-09-20T10:00:00.000000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "memberships"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "organizations:write"
            ],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "user_id",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "role": "editor"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "role": {
                    "type": "string",
                    "enum": [
                      "admin",
                      "editor",
                      "viewer"
                    ]
                  }
                },
                "required": [
                  "role"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "organization_id": {
                      "type": "string"
                    },
                    "user_id": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "role": {
                      "type": "string",
                      "enum": [
                        "owner",
                        "admin",
                        "editor",
                        "viewer"
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "organization_id",
                    "user_id",
                    "email",
                    "role",
                    "created_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Remove a member (never the last owner)",
        "tags": [
          "account"
        ],
        "operationId": "delete_organizations_id_memberships_user_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "confirmation_required",
            "resource_not_found",
            "last_owner"
          ],
          "resource": "memberships",
          "action": "delete",
          "examples": {
            "success": {
              "status": 204
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": true,
            "effectFamilies": [
              "memberships"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "organizations:write"
            ],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "path",
            "name": "user_id",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/organizations/{id}/transfer_ownership": {
      "post": {
        "summary": "Transfer ownership to another member; the caller becomes admin",
        "tags": [
          "account"
        ],
        "operationId": "post_organizations_id_transfer_ownership",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "resource_not_found"
          ],
          "resource": "memberships",
          "action": "transition",
          "examples": {
            "request": {
              "user_id": "usr_next"
            },
            "success": {
              "status": 200,
              "body": {
                "owner": {
                  "organization_id": "org_example",
                  "user_id": "usr_next",
                  "email": "reader@example.test",
                  "role": "owner",
                  "created_at": "2026-09-20T10:00:00.000000Z"
                },
                "previous_owner": {
                  "organization_id": "org_example",
                  "user_id": "usr_example",
                  "email": "reader@example.test",
                  "role": "admin",
                  "created_at": "2026-09-20T10:00:00.000000Z"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "transition": {
            "from": [
              "owner"
            ],
            "to": "admin"
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "memberships"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "organizations:write"
            ],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "user_id": "usr_next"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "user_id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "user_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "owner": {
                      "type": "object",
                      "properties": {
                        "organization_id": {
                          "type": "string"
                        },
                        "user_id": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string",
                          "enum": [
                            "owner",
                            "admin",
                            "editor",
                            "viewer"
                          ]
                        },
                        "created_at": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        }
                      },
                      "required": [
                        "organization_id",
                        "user_id",
                        "email",
                        "role",
                        "created_at"
                      ],
                      "additionalProperties": false
                    },
                    "previous_owner": {
                      "type": "object",
                      "properties": {
                        "organization_id": {
                          "type": "string"
                        },
                        "user_id": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "role": {
                          "type": "string",
                          "enum": [
                            "owner",
                            "admin",
                            "editor",
                            "viewer"
                          ]
                        },
                        "created_at": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        }
                      },
                      "required": [
                        "organization_id",
                        "user_id",
                        "email",
                        "role",
                        "created_at"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "owner",
                    "previous_owner"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/oauth/authorization_requests/{id}": {
      "get": {
        "summary": "An AI app is asking to connect: what the consent page shows (the app is unverified)",
        "tags": [
          "account"
        ],
        "operationId": "get_oauth_authorization_request",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "resource_not_found"
          ],
          "resource": "oauth_connections",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "oar_example",
                "expires_at": "2026-10-07T10:00:00.000000Z",
                "client": {
                  "client_id": "https://claude.ai/oauth/claude-code-client-metadata",
                  "name": "Claude Code",
                  "logo_uri": null,
                  "client_uri": null,
                  "domain": "claude.ai",
                  "registration": "metadata_document",
                  "verified": false
                },
                "redirect_uri": "http://localhost:53682/callback",
                "redirect_host": "localhost:53682",
                "loopback_redirect": true,
                "requested_access": "full",
                "user": {
                  "id": "usr_example",
                  "email": "reader@example.test",
                  "name": "Reader"
                },
                "organizations": [
                  {
                    "id": "org_example",
                    "name": "Example",
                    "role": "owner",
                    "environments": [
                      {
                        "id": "env_example",
                        "name": "sandbox",
                        "runtime_class": "sandbox"
                      }
                    ]
                  }
                ]
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "session"
            ],
            "environment": "none",
            "scopes": []
          }
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "expires_at": {
                      "type": "string"
                    },
                    "client": {
                      "type": "object",
                      "properties": {
                        "client_id": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "logo_uri": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "client_uri": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "domain": {
                          "type": "string"
                        },
                        "registration": {
                          "type": "string",
                          "enum": [
                            "metadata_document",
                            "dynamic"
                          ]
                        },
                        "verified": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "client_id",
                        "name",
                        "logo_uri",
                        "client_uri",
                        "domain",
                        "registration",
                        "verified"
                      ],
                      "additionalProperties": false
                    },
                    "redirect_uri": {
                      "type": "string"
                    },
                    "redirect_host": {
                      "type": "string"
                    },
                    "loopback_redirect": {
                      "type": "boolean"
                    },
                    "requested_access": {
                      "type": "string",
                      "enum": [
                        "read",
                        "full"
                      ]
                    },
                    "user": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "name": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "id",
                        "email",
                        "name"
                      ],
                      "additionalProperties": false
                    },
                    "organizations": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "owner",
                              "admin",
                              "editor",
                              "viewer"
                            ]
                          },
                          "environments": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "runtime_class": {
                                  "type": "string",
                                  "enum": [
                                    "sandbox",
                                    "production"
                                  ]
                                }
                              },
                              "required": [
                                "id",
                                "name",
                                "runtime_class"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "role",
                          "environments"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "id",
                    "expires_at",
                    "client",
                    "redirect_uri",
                    "redirect_host",
                    "loopback_redirect",
                    "requested_access",
                    "user",
                    "organizations"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/oauth/authorization_requests/{id}/decision": {
      "post": {
        "summary": "Allow or deny an AI app: allow grants it one organization, chosen environments and an access level",
        "tags": [
          "account"
        ],
        "operationId": "decide_oauth_authorization_request",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "origin_mismatch",
            "resource_not_found"
          ],
          "resource": "oauth_connections",
          "action": "create",
          "examples": {
            "request": {
              "decision": "allow",
              "organization_id": "org_example",
              "environment_ids": [
                "env_example"
              ],
              "default_environment_id": "env_example",
              "access": "read",
              "expires_in_days": 90
            },
            "success": {
              "status": 200,
              "body": {
                "redirect_to": "http://localhost:53682/callback?code=…"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "session"
            ],
            "environment": "none",
            "scopes": []
          }
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "decision": "allow",
                "organization_id": "org_example",
                "environment_ids": [
                  "env_example"
                ],
                "default_environment_id": "env_example",
                "access": "read",
                "expires_in_days": 90
              },
              "schema": {
                "type": "object",
                "properties": {
                  "decision": {
                    "type": "string",
                    "enum": [
                      "allow",
                      "deny"
                    ]
                  },
                  "organization_id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "environment_ids": {
                    "anyOf": [
                      {
                        "minItems": 1,
                        "maxItems": 50,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "minLength": 1
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "default_environment_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "access": {
                    "type": "string",
                    "enum": [
                      "read",
                      "full"
                    ]
                  },
                  "expires_in_days": {
                    "anyOf": [
                      {
                        "anyOf": [
                          {
                            "type": "number",
                            "const": 30
                          },
                          {
                            "type": "number",
                            "const": 90
                          },
                          {
                            "type": "number",
                            "const": 365
                          }
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "decision"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "redirect_to": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "redirect_to"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/oauth/grants": {
      "get": {
        "summary": "Connected apps: the AI apps the signed-in person allowed, newest first",
        "tags": [
          "account"
        ],
        "operationId": "list_oauth_grants",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden"
          ],
          "resource": "oauth_connections",
          "action": "list",
          "pagination": {
            "kind": "bounded",
            "maximumItems": 200,
            "reason": "A person connects a handful of AI apps; the newest 200 live grants are listed."
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [
                  {
                    "id": "ogr_example",
                    "client": {
                      "client_id": "https://claude.ai/oauth/claude-code-client-metadata",
                      "name": "Claude Code",
                      "logo_uri": null,
                      "domain": "claude.ai",
                      "registration": "metadata_document"
                    },
                    "organization": {
                      "id": "org_example",
                      "name": "Example"
                    },
                    "environment_ids": [
                      "env_example"
                    ],
                    "default_environment_id": "env_example",
                    "access": "read",
                    "created_at": "2026-10-07T10:00:00.000000Z",
                    "last_used_at": null,
                    "expires_at": null
                  }
                ]
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "session"
            ],
            "environment": "none",
            "scopes": []
          }
        ],
        "security": [
          {
            "session": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "client": {
                            "type": "object",
                            "properties": {
                              "client_id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "logo_uri": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "domain": {
                                "type": "string"
                              },
                              "registration": {
                                "type": "string",
                                "enum": [
                                  "metadata_document",
                                  "dynamic"
                                ]
                              }
                            },
                            "required": [
                              "client_id",
                              "name",
                              "logo_uri",
                              "domain",
                              "registration"
                            ],
                            "additionalProperties": false
                          },
                          "organization": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "name"
                            ],
                            "additionalProperties": false
                          },
                          "environment_ids": {
                            "anyOf": [
                              {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "default_environment_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "access": {
                            "type": "string",
                            "enum": [
                              "read",
                              "full"
                            ]
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "last_used_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "expires_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "client",
                          "organization",
                          "environment_ids",
                          "default_environment_id",
                          "access",
                          "created_at",
                          "last_used_at",
                          "expires_at"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/oauth/grants/{id}": {
      "delete": {
        "summary": "Disconnect an AI app: revokes its access and every token at once",
        "tags": [
          "account"
        ],
        "operationId": "delete_oauth_grant",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "resource_not_found"
          ],
          "resource": "oauth_connections",
          "action": "delete",
          "examples": {
            "success": {
              "status": 204
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": true,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "session"
            ],
            "environment": "none",
            "scopes": []
          }
        ],
        "security": [
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "required": true
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/change_sets": {
      "post": {
        "summary": "Propose a change set: plan it without applying and store the plan for review",
        "tags": [
          "change_sets"
        ],
        "operationId": "create_change_set",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "rule_invalid",
            "invalid_state",
            "resource_in_use",
            "already_exists",
            "stale_write",
            "capability_unavailable",
            "item_archived",
            "offer_unavailable",
            "invalid_economy_request",
            "energy_archived",
            "loot_table_unavailable",
            "battle_pass_unavailable"
          ],
          "resource": "change_sets",
          "action": "create",
          "examples": {
            "request": {
              "commands": [
                {
                  "type": "portal_configuration.publish",
                  "key": "rewards",
                  "expected_revision": 3
                }
              ]
            },
            "success": {
              "status": 201,
              "body": {
                "id": "chs_00000000000000000000000000000002",
                "environment_id": "env_example",
                "status": "pending",
                "channel": "api",
                "source": "manual",
                "principal": {
                  "kind": "pat",
                  "id": "user_example"
                },
                "commands": [
                  {
                    "type": "portal_configuration.publish",
                    "key": "rewards",
                    "expected_revision": 3
                  }
                ],
                "plan": {
                  "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "commands_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "snapshot_at": "2026-09-27T00:00:00.000000Z",
                  "diff": {
                    "entries": [
                      {
                        "section": "portal_configurations",
                        "key": "rewards",
                        "op": "update",
                        "fields": [
                          {
                            "path": "/active_document/surfaces",
                            "before": [
                              {
                                "surface": "streak"
                              },
                              {
                                "surface": "quests"
                              }
                            ],
                            "after": [
                              {
                                "surface": "streak"
                              },
                              {
                                "surface": "quests"
                              },
                              {
                                "surface": "catalogue"
                              }
                            ]
                          },
                          {
                            "path": "/active_version/digest",
                            "before": "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd",
                            "after": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
                          },
                          {
                            "path": "/active_version/id",
                            "before": "ptv_00000000000000000000000000000001",
                            "after": "ptv_00000000000000000000000000000002"
                          },
                          {
                            "path": "/active_version/number",
                            "before": 1,
                            "after": 2
                          },
                          {
                            "path": "/revision",
                            "before": 3,
                            "after": 4
                          }
                        ]
                      }
                    ],
                    "unchanged": 12
                  },
                  "expected_versions": [
                    {
                      "resource": "portal_configuration",
                      "key": "rewards",
                      "version": "3"
                    }
                  ],
                  "effects": {
                    "customers_affected": null,
                    "liability": [],
                    "stock": [],
                    "codes": [],
                    "webhooks": {
                      "event_types": []
                    },
                    "notes": [
                      "Open widgets keep the document they loaded until they reload; new loads use the active version within 15 seconds.",
                      "Disable ends the portal's embed tokens immediately; enable does not bring them back."
                    ]
                  },
                  "irreversibility": [],
                  "flags": [],
                  "required_scopes": [
                    "config:write",
                    "portal_configurations:write"
                  ],
                  "approved_bounds": {},
                  "destructive": [],
                  "dependencies": []
                },
                "publish": false,
                "expires_at": "2026-09-28T00:00:00.000000Z",
                "stale_reason": null,
                "committed_at": null,
                "commit_id": null,
                "commit": null,
                "undo_of": null,
                "undone_by": null,
                "created_at": "2026-09-27T00:00:00.000000Z",
                "updated_at": "2026-09-27T00:00:00.000000Z",
                "version": 1
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "chs_00000000000000000000000000000002",
                "environment_id": "env_example",
                "status": "pending",
                "channel": "api",
                "source": "manual",
                "principal": {
                  "kind": "pat",
                  "id": "user_example"
                },
                "commands": [
                  {
                    "type": "portal_configuration.publish",
                    "key": "rewards",
                    "expected_revision": 3
                  }
                ],
                "plan": {
                  "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "commands_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "snapshot_at": "2026-09-27T00:00:00.000000Z",
                  "diff": {
                    "entries": [
                      {
                        "section": "portal_configurations",
                        "key": "rewards",
                        "op": "update",
                        "fields": [
                          {
                            "path": "/active_document/surfaces",
                            "before": [
                              {
                                "surface": "streak"
                              },
                              {
                                "surface": "quests"
                              }
                            ],
                            "after": [
                              {
                                "surface": "streak"
                              },
                              {
                                "surface": "quests"
                              },
                              {
                                "surface": "catalogue"
                              }
                            ]
                          },
                          {
                            "path": "/active_version/digest",
                            "before": "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd",
                            "after": "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
                          },
                          {
                            "path": "/active_version/id",
                            "before": "ptv_00000000000000000000000000000001",
                            "after": "ptv_00000000000000000000000000000002"
                          },
                          {
                            "path": "/active_version/number",
                            "before": 1,
                            "after": 2
                          },
                          {
                            "path": "/revision",
                            "before": 3,
                            "after": 4
                          }
                        ]
                      }
                    ],
                    "unchanged": 12
                  },
                  "expected_versions": [
                    {
                      "resource": "portal_configuration",
                      "key": "rewards",
                      "version": "3"
                    }
                  ],
                  "effects": {
                    "customers_affected": null,
                    "liability": [],
                    "stock": [],
                    "codes": [],
                    "webhooks": {
                      "event_types": []
                    },
                    "notes": [
                      "Open widgets keep the document they loaded until they reload; new loads use the active version within 15 seconds.",
                      "Disable ends the portal's embed tokens immediately; enable does not bring them back."
                    ]
                  },
                  "irreversibility": [],
                  "flags": [],
                  "required_scopes": [
                    "config:write",
                    "portal_configurations:write"
                  ],
                  "approved_bounds": {},
                  "destructive": [],
                  "dependencies": []
                },
                "publish": false,
                "expires_at": "2026-09-28T00:00:00.000000Z",
                "stale_reason": null,
                "committed_at": null,
                "commit_id": null,
                "commit": null,
                "undo_of": null,
                "undone_by": null,
                "created_at": "2026-09-27T00:00:00.000000Z",
                "updated_at": "2026-09-27T00:00:00.000000Z",
                "version": 1
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "propose",
            "destructive": false,
            "effectFamilies": [
              "configuration"
            ],
            "assistant": {
              "offered": true,
              "reason": "Stores a proposal in the selected environment; commits nothing by itself. A person confirms it in the dashboard, or create_change_set_application applies it where the autonomy policy allows."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "config:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "config:write"
            ]
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "commands": [
                  {
                    "type": "portal_configuration.publish",
                    "key": "rewards",
                    "expected_revision": 3
                  }
                ]
              },
              "schema": {
                "type": "object",
                "properties": {
                  "commands": {
                    "minItems": 1,
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "config.apply_document"
                            },
                            "document": {
                              "type": "object",
                              "properties": {
                                "schema": {
                                  "type": "string",
                                  "const": "orishare.config/v2"
                                },
                                "resources": {
                                  "maxItems": 10000,
                                  "type": "array",
                                  "items": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "currency"
                                          },
                                          "key": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "definition": {
                                            "type": "object",
                                            "properties": {
                                              "version": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              },
                                              "code": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                              },
                                              "name": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 255
                                              },
                                              "precision": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 6
                                              },
                                              "expiration_policy": {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "enum": [
                                                      "never",
                                                      "days"
                                                    ]
                                                  },
                                                  "days": {
                                                    "type": "integer",
                                                    "exclusiveMinimum": 0,
                                                    "maximum": 9007199254740991
                                                  }
                                                },
                                                "required": [
                                                  "type"
                                                ],
                                                "additionalProperties": false
                                              },
                                              "negative_balance": {
                                                "type": "string",
                                                "enum": [
                                                  "allow",
                                                  "forbid"
                                                ]
                                              },
                                              "capabilities": {
                                                "anyOf": [
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "spendable": {
                                                        "type": "boolean"
                                                      },
                                                      "transferable": {
                                                        "type": "boolean"
                                                      },
                                                      "qualification": {
                                                        "type": "string",
                                                        "enum": [
                                                          "none",
                                                          "earned",
                                                          "xp"
                                                        ]
                                                      },
                                                      "expiry_policy": {
                                                        "anyOf": [
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "none"
                                                              }
                                                            },
                                                            "required": [
                                                              "type"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "after"
                                                              },
                                                              "seconds": {
                                                                "type": "integer",
                                                                "exclusiveMinimum": 0,
                                                                "maximum": 9007199254740991
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "seconds"
                                                            ],
                                                            "additionalProperties": false
                                                          }
                                                        ]
                                                      }
                                                    },
                                                    "required": [
                                                      "spendable",
                                                      "transferable",
                                                      "qualification",
                                                      "expiry_policy"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  {
                                                    "type": "null"
                                                  }
                                                ]
                                              }
                                            },
                                            "required": [
                                              "version",
                                              "code",
                                              "name",
                                              "precision",
                                              "expiration_policy",
                                              "negative_balance",
                                              "capabilities"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "key",
                                          "definition"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "attribute_definition"
                                          },
                                          "key": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "definition": {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "enum": [
                                                  "string",
                                                  "number",
                                                  "boolean",
                                                  "timestamp"
                                                ]
                                              },
                                              "description": {
                                                "type": [
                                                  "string",
                                                  "null"
                                                ]
                                              },
                                              "pii": {
                                                "type": "boolean"
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "description",
                                              "pii"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "key",
                                          "definition"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "event_definition"
                                          },
                                          "key": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "definition": {
                                            "type": "object",
                                            "properties": {
                                              "description": {
                                                "type": [
                                                  "string",
                                                  "null"
                                                ]
                                              },
                                              "client_allowed": {
                                                "type": "boolean"
                                              },
                                              "confirmed_schema": {
                                                "anyOf": [
                                                  {
                                                    "type": "object",
                                                    "propertyNames": {
                                                      "type": "string"
                                                    },
                                                    "additionalProperties": {
                                                      "$ref": "#/components/schemas/__schema0"
                                                    }
                                                  },
                                                  {
                                                    "type": "null"
                                                  }
                                                ]
                                              },
                                              "schema_enforcement": {
                                                "type": "string",
                                                "enum": [
                                                  "off",
                                                  "warn",
                                                  "enforce"
                                                ]
                                              },
                                              "minimum_trust": {
                                                "anyOf": [
                                                  {
                                                    "type": "string",
                                                    "enum": [
                                                      "anonymous_claim",
                                                      "customer_claim",
                                                      "merchant_asserted",
                                                      "verified_evidence",
                                                      "legacy_unknown"
                                                    ]
                                                  },
                                                  {
                                                    "type": "null"
                                                  }
                                                ]
                                              },
                                              "fact_policy": {
                                                "anyOf": [
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "object_type": {
                                                        "type": "string",
                                                        "minLength": 1,
                                                        "maxLength": 120
                                                      },
                                                      "key": {
                                                        "minItems": 1,
                                                        "maxItems": 32,
                                                        "type": "array",
                                                        "items": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)*$"
                                                        }
                                                      },
                                                      "owner": {
                                                        "type": "string",
                                                        "enum": [
                                                          "merchant",
                                                          "customer"
                                                        ]
                                                      }
                                                    },
                                                    "required": [
                                                      "object_type",
                                                      "key",
                                                      "owner"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  {
                                                    "type": "null"
                                                  }
                                                ]
                                              },
                                              "time_policy": {
                                                "anyOf": [
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "client": {
                                                        "anyOf": [
                                                          {
                                                            "type": "string",
                                                            "const": "received_at"
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "offline_seconds": {
                                                                "type": "integer",
                                                                "minimum": 0,
                                                                "maximum": 2147483647
                                                              }
                                                            },
                                                            "required": [
                                                              "offline_seconds"
                                                            ],
                                                            "additionalProperties": false
                                                          }
                                                        ]
                                                      }
                                                    },
                                                    "required": [
                                                      "client"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  {
                                                    "type": "null"
                                                  }
                                                ]
                                              }
                                            },
                                            "required": [
                                              "description",
                                              "client_allowed",
                                              "confirmed_schema",
                                              "schema_enforcement",
                                              "minimum_trust",
                                              "fact_policy",
                                              "time_policy"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "key",
                                          "definition"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "segment"
                                          },
                                          "key": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "definition": {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "enum": [
                                                  "static",
                                                  "dynamic"
                                                ]
                                              },
                                              "definition": {
                                                "anyOf": [
                                                  {
                                                    "$ref": "#/components/schemas/__schema1"
                                                  },
                                                  {
                                                    "type": "null"
                                                  }
                                                ]
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "definition"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "key",
                                          "definition"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "counter_definition"
                                          },
                                          "key": {
                                            "type": "string",
                                            "minLength": 1
                                          },
                                          "definition": {
                                            "type": "object",
                                            "properties": {
                                              "event": {
                                                "type": "string",
                                                "minLength": 1
                                              },
                                              "window": {
                                                "type": "string",
                                                "enum": [
                                                  "none",
                                                  "day",
                                                  "week",
                                                  "month",
                                                  "year"
                                                ]
                                              },
                                              "filter": {
                                                "anyOf": [
                                                  {
                                                    "$ref": "#/components/schemas/__schema1"
                                                  },
                                                  {
                                                    "type": "null"
                                                  }
                                                ]
                                              }
                                            },
                                            "required": [
                                              "event",
                                              "window",
                                              "filter"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "key",
                                          "definition"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "webhook_endpoint"
                                          },
                                          "key": {
                                            "type": "string",
                                            "format": "uri"
                                          },
                                          "definition": {
                                            "type": "object",
                                            "properties": {
                                              "subscribed_types": {
                                                "minItems": 1,
                                                "type": "array",
                                                "items": {
                                                  "type": "string"
                                                }
                                              },
                                              "status": {
                                                "type": "string",
                                                "enum": [
                                                  "active",
                                                  "disabled"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "subscribed_types",
                                              "status"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "key",
                                          "definition"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ],
                                    "type": "object"
                                  }
                                },
                                "programs": {
                                  "maxItems": 1000,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "tier",
                                          "quest",
                                          "campaign",
                                          "reward",
                                          "streak",
                                          "badge",
                                          "leaderboard",
                                          "referral"
                                        ]
                                      },
                                      "key": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                      },
                                      "name": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 255
                                      },
                                      "status": {
                                        "type": "string",
                                        "enum": [
                                          "draft",
                                          "active",
                                          "paused",
                                          "ended",
                                          "archived"
                                        ]
                                      },
                                      "head": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "version": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              },
                                              "digest": {
                                                "type": "string",
                                                "pattern": "^[a-f0-9]{64}$"
                                              }
                                            },
                                            "required": [
                                              "version",
                                              "digest"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "draft": {
                                        "anyOf": [
                                          {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "schema": {
                                                    "type": "string",
                                                    "const": "orishare.program/v1"
                                                  },
                                                  "kind": {
                                                    "type": "string",
                                                    "enum": [
                                                      "tier",
                                                      "quest",
                                                      "campaign",
                                                      "reward",
                                                      "streak",
                                                      "badge",
                                                      "leaderboard",
                                                      "referral"
                                                    ]
                                                  },
                                                  "semantics": {
                                                    "type": "string",
                                                    "enum": [
                                                      "native_v2",
                                                      "compat_v1"
                                                    ]
                                                  },
                                                  "definition": {
                                                    "oneOf": [
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "tier"
                                                          },
                                                          "legacy": {
                                                            "type": "object",
                                                            "propertyNames": {
                                                              "type": "string"
                                                            },
                                                            "additionalProperties": {
                                                              "$ref": "#/components/schemas/__schema2"
                                                            }
                                                          },
                                                          "currency": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                          },
                                                          "basis": {
                                                            "oneOf": [
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "lifetime_earned"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "balance"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "earned_rolling_days"
                                                                  },
                                                                  "days": {
                                                                    "type": "integer",
                                                                    "exclusiveMinimum": 0,
                                                                    "maximum": 9007199254740991
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "days"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "earned_calendar_year"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "earned_anniversary_year"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            ],
                                                            "type": "object"
                                                          },
                                                          "downgrade_check": {
                                                            "type": "string",
                                                            "enum": [
                                                              "daily",
                                                              "monthly",
                                                              "never"
                                                            ]
                                                          },
                                                          "levels": {
                                                            "minItems": 1,
                                                            "type": "array",
                                                            "items": {
                                                              "type": "object",
                                                              "properties": {
                                                                "key": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                },
                                                                "threshold": {
                                                                  "type": "integer",
                                                                  "minimum": 0,
                                                                  "maximum": 9007199254740991
                                                                }
                                                              },
                                                              "required": [
                                                                "key",
                                                                "threshold"
                                                              ],
                                                              "additionalProperties": false
                                                            }
                                                          }
                                                        },
                                                        "required": [
                                                          "kind",
                                                          "currency",
                                                          "basis",
                                                          "downgrade_check",
                                                          "levels"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "quest"
                                                          },
                                                          "legacy": {
                                                            "type": "object",
                                                            "propertyNames": {
                                                              "type": "string"
                                                            },
                                                            "additionalProperties": {
                                                              "$ref": "#/components/schemas/__schema2"
                                                            }
                                                          },
                                                          "steps": {
                                                            "minItems": 1,
                                                            "type": "array",
                                                            "items": {
                                                              "type": "object",
                                                              "properties": {
                                                                "key": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                },
                                                                "aggregation": {
                                                                  "type": "string",
                                                                  "enum": [
                                                                    "count",
                                                                    "sum"
                                                                  ]
                                                                },
                                                                "target": {
                                                                  "type": "integer",
                                                                  "exclusiveMinimum": 0,
                                                                  "maximum": 9007199254740991
                                                                }
                                                              },
                                                              "required": [
                                                                "key",
                                                                "aggregation",
                                                                "target"
                                                              ],
                                                              "additionalProperties": false
                                                            }
                                                          },
                                                          "repeatable": {
                                                            "type": "boolean"
                                                          }
                                                        },
                                                        "required": [
                                                          "kind",
                                                          "steps",
                                                          "repeatable"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "campaign"
                                                          },
                                                          "legacy": {
                                                            "type": "object",
                                                            "propertyNames": {
                                                              "type": "string"
                                                            },
                                                            "additionalProperties": {
                                                              "$ref": "#/components/schemas/__schema2"
                                                            }
                                                          },
                                                          "priority": {
                                                            "default": 0,
                                                            "type": "integer",
                                                            "minimum": -9007199254740991,
                                                            "maximum": 9007199254740991
                                                          }
                                                        },
                                                        "required": [
                                                          "kind"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "reward"
                                                          },
                                                          "legacy": {
                                                            "type": "object",
                                                            "propertyNames": {
                                                              "type": "string"
                                                            },
                                                            "additionalProperties": {
                                                              "$ref": "#/components/schemas/__schema2"
                                                            }
                                                          },
                                                          "reward": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                          }
                                                        },
                                                        "required": [
                                                          "kind",
                                                          "reward"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "streak"
                                                          },
                                                          "target": {
                                                            "type": "integer",
                                                            "exclusiveMinimum": 0,
                                                            "maximum": 9007199254740991
                                                          },
                                                          "freezes": {
                                                            "default": 0,
                                                            "type": "integer",
                                                            "minimum": 0,
                                                            "maximum": 9007199254740991
                                                          }
                                                        },
                                                        "required": [
                                                          "kind",
                                                          "target"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "badge"
                                                          },
                                                          "repeatable": {
                                                            "default": false,
                                                            "type": "boolean"
                                                          }
                                                        },
                                                        "required": [
                                                          "kind"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "leaderboard"
                                                          },
                                                          "aggregation": {
                                                            "type": "string",
                                                            "enum": [
                                                              "sum",
                                                              "max",
                                                              "count"
                                                            ]
                                                          },
                                                          "order": {
                                                            "type": "string",
                                                            "enum": [
                                                              "ascending",
                                                              "descending"
                                                            ]
                                                          }
                                                        },
                                                        "required": [
                                                          "kind",
                                                          "aggregation",
                                                          "order"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "referral"
                                                          },
                                                          "target": {
                                                            "type": "integer",
                                                            "exclusiveMinimum": 0,
                                                            "maximum": 9007199254740991
                                                          }
                                                        },
                                                        "required": [
                                                          "kind",
                                                          "target"
                                                        ],
                                                        "additionalProperties": false
                                                      }
                                                    ],
                                                    "type": "object"
                                                  },
                                                  "qualification": {
                                                    "type": "object",
                                                    "properties": {
                                                      "sources": {
                                                        "type": "array",
                                                        "items": {
                                                          "type": "object",
                                                          "properties": {
                                                            "event": {
                                                              "type": "string",
                                                              "minLength": 1
                                                            },
                                                            "conditions": {
                                                              "$ref": "#/components/schemas/__schema3"
                                                            },
                                                            "value": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "number"
                                                                },
                                                                {
                                                                  "type": "string",
                                                                  "minLength": 1
                                                                }
                                                              ]
                                                            },
                                                            "step": {
                                                              "type": "string",
                                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                            },
                                                            "occurrence": {
                                                              "default": "lifetime",
                                                              "type": "string",
                                                              "enum": [
                                                                "lifetime",
                                                                "period"
                                                              ]
                                                            }
                                                          },
                                                          "required": [
                                                            "event"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "audience": {
                                                        "type": "array",
                                                        "items": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        }
                                                      },
                                                      "starts_at": {
                                                        "type": "string",
                                                        "format": "date-time",
                                                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                      },
                                                      "ends_at": {
                                                        "type": "string",
                                                        "format": "date-time",
                                                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                      },
                                                      "campaign": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      }
                                                    },
                                                    "required": [
                                                      "sources"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  "calendar": {
                                                    "type": "object",
                                                    "properties": {
                                                      "schema": {
                                                        "type": "string",
                                                        "const": "orishare.calendar/v1"
                                                      },
                                                      "period": {
                                                        "anyOf": [
                                                          {
                                                            "type": "string",
                                                            "enum": [
                                                              "none",
                                                              "day",
                                                              "week",
                                                              "month",
                                                              "year"
                                                            ]
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "kind": {
                                                                "type": "string",
                                                                "const": "season"
                                                              },
                                                              "starts_at": {
                                                                "type": "string",
                                                                "format": "date-time",
                                                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                              },
                                                              "ends_at": {
                                                                "type": "string",
                                                                "format": "date-time",
                                                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                              }
                                                            },
                                                            "required": [
                                                              "kind",
                                                              "starts_at",
                                                              "ends_at"
                                                            ],
                                                            "additionalProperties": false
                                                          }
                                                        ]
                                                      },
                                                      "run_per_period": {
                                                        "type": "boolean"
                                                      },
                                                      "timezone_source": {
                                                        "type": "string",
                                                        "enum": [
                                                          "environment",
                                                          "customer",
                                                          "fixed"
                                                        ]
                                                      },
                                                      "timezone": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      },
                                                      "day_start_offset_minutes": {
                                                        "default": 0,
                                                        "type": "integer",
                                                        "minimum": 0,
                                                        "maximum": 1439
                                                      },
                                                      "ambiguous_local_time": {
                                                        "type": "string",
                                                        "const": "earlier"
                                                      },
                                                      "nonexistent_local_time": {
                                                        "type": "string",
                                                        "const": "next_valid"
                                                      },
                                                      "event_time": {
                                                        "type": "object",
                                                        "properties": {
                                                          "merchant": {
                                                            "type": "string",
                                                            "const": "occurred_at"
                                                          },
                                                          "client": {
                                                            "anyOf": [
                                                              {
                                                                "type": "string",
                                                                "const": "received_at"
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "offline_seconds": {
                                                                    "type": "integer",
                                                                    "minimum": 0,
                                                                    "maximum": 9007199254740991
                                                                  }
                                                                },
                                                                "required": [
                                                                  "offline_seconds"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            ]
                                                          }
                                                        },
                                                        "required": [
                                                          "merchant",
                                                          "client"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      "grace_seconds": {
                                                        "default": 0,
                                                        "type": "integer",
                                                        "minimum": 0,
                                                        "maximum": 9007199254740991
                                                      },
                                                      "max_lateness_seconds": {
                                                        "default": 0,
                                                        "type": "integer",
                                                        "minimum": 0,
                                                        "maximum": 9007199254740991
                                                      },
                                                      "settlement_delay_seconds": {
                                                        "default": 0,
                                                        "type": "integer",
                                                        "minimum": 0,
                                                        "maximum": 9007199254740991
                                                      },
                                                      "after_finalization": {
                                                        "type": "string",
                                                        "const": "correction_only"
                                                      }
                                                    },
                                                    "required": [
                                                      "schema",
                                                      "period",
                                                      "run_per_period",
                                                      "timezone_source",
                                                      "ambiguous_local_time",
                                                      "nonexistent_local_time",
                                                      "event_time",
                                                      "after_finalization"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  "trust": {
                                                    "type": "object",
                                                    "properties": {
                                                      "minimum_trust": {
                                                        "type": "string",
                                                        "enum": [
                                                          "anonymous_claim",
                                                          "customer_claim",
                                                          "merchant_asserted",
                                                          "verified_evidence",
                                                          "legacy_unknown"
                                                        ]
                                                      },
                                                      "allowed_sources": {
                                                        "minItems": 1,
                                                        "type": "array",
                                                        "items": {
                                                          "type": "string",
                                                          "enum": [
                                                            "publishable_event",
                                                            "secret_key_event",
                                                            "verified_connector",
                                                            "operator_command",
                                                            "customer_command",
                                                            "import",
                                                            "program_transition",
                                                            "schedule"
                                                          ]
                                                        }
                                                      },
                                                      "on_insufficient": {
                                                        "type": "string",
                                                        "enum": [
                                                          "ignore",
                                                          "progress_without_reward"
                                                        ]
                                                      },
                                                      "liability_caps": {
                                                        "type": "array",
                                                        "items": {
                                                          "type": "object",
                                                          "properties": {
                                                            "trust": {
                                                              "type": "string",
                                                              "enum": [
                                                                "anonymous_claim",
                                                                "customer_claim",
                                                                "merchant_asserted",
                                                                "verified_evidence",
                                                                "legacy_unknown"
                                                              ]
                                                            },
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "scope": {
                                                              "type": "string",
                                                              "enum": [
                                                                "customer",
                                                                "environment"
                                                              ]
                                                            },
                                                            "window": {
                                                              "type": "string",
                                                              "enum": [
                                                                "day",
                                                                "month",
                                                                "lifetime"
                                                              ]
                                                            },
                                                            "maximum_minor": {
                                                              "type": "integer",
                                                              "minimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "trust",
                                                            "currency",
                                                            "scope",
                                                            "window",
                                                            "maximum_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "recognition_caps": {
                                                        "type": "array",
                                                        "items": {
                                                          "type": "object",
                                                          "properties": {
                                                            "trust": {
                                                              "type": "string",
                                                              "enum": [
                                                                "anonymous_claim",
                                                                "customer_claim",
                                                                "merchant_asserted",
                                                                "verified_evidence",
                                                                "legacy_unknown"
                                                              ]
                                                            },
                                                            "per": {
                                                              "type": "string",
                                                              "enum": [
                                                                "period",
                                                                "day"
                                                              ]
                                                            },
                                                            "contributions": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            },
                                                            "value": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "trust",
                                                            "per"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "allow_legacy_unknown": {
                                                        "type": "boolean",
                                                        "const": false
                                                      }
                                                    },
                                                    "required": [
                                                      "minimum_trust",
                                                      "allowed_sources",
                                                      "on_insufficient",
                                                      "liability_caps",
                                                      "recognition_caps",
                                                      "allow_legacy_unknown"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  "correction": {
                                                    "type": "object",
                                                    "properties": {
                                                      "qualification": {
                                                        "default": "reverse",
                                                        "type": "string",
                                                        "enum": [
                                                          "reverse",
                                                          "keep"
                                                        ]
                                                      },
                                                      "spendable": {
                                                        "type": "string",
                                                        "const": "reverse"
                                                      },
                                                      "xp": {
                                                        "default": "reverse",
                                                        "type": "string",
                                                        "enum": [
                                                          "reverse",
                                                          "keep"
                                                        ]
                                                      },
                                                      "recognition": {
                                                        "default": "keep",
                                                        "type": "string",
                                                        "enum": [
                                                          "keep",
                                                          "revoke_on_fraud"
                                                        ]
                                                      },
                                                      "after_finalization": {
                                                        "default": "correcting_revision",
                                                        "type": "string",
                                                        "const": "correcting_revision"
                                                      },
                                                      "allowance_on_refund": {
                                                        "default": "consumed",
                                                        "type": "string",
                                                        "enum": [
                                                          "consumed",
                                                          "release_on_verified_void"
                                                        ]
                                                      }
                                                    },
                                                    "required": [
                                                      "spendable"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  "reward": {
                                                    "type": "object",
                                                    "properties": {
                                                      "on": {
                                                        "type": "object",
                                                        "propertyNames": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]*(?::[a-z0-9_]+)?$"
                                                        },
                                                        "additionalProperties": {
                                                          "type": "array",
                                                          "items": {
                                                            "anyOf": [
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "points.award"
                                                                  },
                                                                  "currency": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "amount": {
                                                                    "anyOf": [
                                                                      {
                                                                        "type": "number"
                                                                      },
                                                                      {
                                                                        "type": "string",
                                                                        "minLength": 1
                                                                      }
                                                                    ]
                                                                  },
                                                                  "reason": {
                                                                    "type": "string",
                                                                    "maxLength": 200
                                                                  },
                                                                  "confirm_after": {
                                                                    "type": "string",
                                                                    "pattern": "^\\d+[smhdw]$"
                                                                  },
                                                                  "expires_after": {
                                                                    "type": "string",
                                                                    "pattern": "^\\d+[smhdw]$"
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "currency",
                                                                  "amount",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "points.deduct"
                                                                  },
                                                                  "currency": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "amount": {
                                                                    "anyOf": [
                                                                      {
                                                                        "type": "number"
                                                                      },
                                                                      {
                                                                        "type": "string",
                                                                        "minLength": 1
                                                                      }
                                                                    ]
                                                                  },
                                                                  "reason": {
                                                                    "type": "string",
                                                                    "maxLength": 200
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "currency",
                                                                  "amount",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "points.reverse"
                                                                  },
                                                                  "currency": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "match": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "event": {
                                                                        "type": "string",
                                                                        "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                                      },
                                                                      "on": {
                                                                        "type": "string",
                                                                        "minLength": 1
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "event",
                                                                      "on"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  },
                                                                  "fraction": {
                                                                    "anyOf": [
                                                                      {
                                                                        "type": "number"
                                                                      },
                                                                      {
                                                                        "type": "string",
                                                                        "minLength": 1
                                                                      }
                                                                    ]
                                                                  },
                                                                  "amount": {
                                                                    "anyOf": [
                                                                      {
                                                                        "type": "number"
                                                                      },
                                                                      {
                                                                        "type": "string",
                                                                        "minLength": 1
                                                                      }
                                                                    ]
                                                                  },
                                                                  "reason": {
                                                                    "type": "string",
                                                                    "maxLength": 200
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "currency",
                                                                  "match",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "reward.issue"
                                                                  },
                                                                  "reward": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "reward",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "tier.evaluate"
                                                                  },
                                                                  "program": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "program",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "attribute.set"
                                                                  },
                                                                  "attribute": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "value": {
                                                                    "type": [
                                                                      "string",
                                                                      "number",
                                                                      "boolean",
                                                                      "null"
                                                                    ]
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "attribute",
                                                                  "value",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "webhook.emit"
                                                                  },
                                                                  "event": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                                  },
                                                                  "payload": {
                                                                    "type": "object",
                                                                    "propertyNames": {
                                                                      "type": "string"
                                                                    },
                                                                    "additionalProperties": {
                                                                      "anyOf": [
                                                                        {
                                                                          "type": [
                                                                            "string",
                                                                            "number",
                                                                            "boolean"
                                                                          ]
                                                                        },
                                                                        {
                                                                          "type": "null"
                                                                        },
                                                                        {
                                                                          "type": "array",
                                                                          "items": {
                                                                            "type": [
                                                                              "string",
                                                                              "number",
                                                                              "boolean"
                                                                            ]
                                                                          }
                                                                        }
                                                                      ]
                                                                    }
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "event",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "badge.grant"
                                                                  },
                                                                  "badge": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "occurrence": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "badge",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "streak.contribute"
                                                                  },
                                                                  "streak": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "value": {
                                                                    "anyOf": [
                                                                      {
                                                                        "type": "number"
                                                                      },
                                                                      {
                                                                        "type": "string",
                                                                        "minLength": 1
                                                                      }
                                                                    ]
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "streak",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "streak.freeze_grant"
                                                                  },
                                                                  "streak": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "quantity": {
                                                                    "type": "integer",
                                                                    "exclusiveMinimum": 0,
                                                                    "maximum": 9007199254740991
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "streak",
                                                                  "quantity",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "quest.contribute"
                                                                  },
                                                                  "quest": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "step": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "value": {
                                                                    "anyOf": [
                                                                      {
                                                                        "type": "number"
                                                                      },
                                                                      {
                                                                        "type": "string",
                                                                        "minLength": 1
                                                                      }
                                                                    ]
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "quest",
                                                                  "step",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "quest.enroll"
                                                                  },
                                                                  "quest": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "quest",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "leaderboard.contribute"
                                                                  },
                                                                  "leaderboard": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "value": {
                                                                    "anyOf": [
                                                                      {
                                                                        "type": "number"
                                                                      },
                                                                      {
                                                                        "type": "string",
                                                                        "minLength": 1
                                                                      }
                                                                    ]
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "leaderboard",
                                                                  "value",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "program.reverse_contribution"
                                                                  },
                                                                  "program": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "source_fact": {
                                                                    "anyOf": [
                                                                      {
                                                                        "type": "object",
                                                                        "properties": {
                                                                          "fact_id": {
                                                                            "type": "string",
                                                                            "pattern": "^[A-Za-z0-9_-]+$"
                                                                          }
                                                                        },
                                                                        "required": [
                                                                          "fact_id"
                                                                        ],
                                                                        "additionalProperties": false
                                                                      },
                                                                      {
                                                                        "type": "object",
                                                                        "properties": {
                                                                          "object_type": {
                                                                            "type": "string",
                                                                            "pattern": "^[A-Za-z0-9_-]+$"
                                                                          },
                                                                          "key": {
                                                                            "minItems": 1,
                                                                            "type": "array",
                                                                            "items": {
                                                                              "type": "string",
                                                                              "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_-]*(?:\\.[A-Za-z_][A-Za-z0-9_-]*)*$"
                                                                            }
                                                                          }
                                                                        },
                                                                        "required": [
                                                                          "object_type",
                                                                          "key"
                                                                        ],
                                                                        "additionalProperties": false
                                                                      }
                                                                    ]
                                                                  },
                                                                  "fraction": {
                                                                    "type": "string",
                                                                    "pattern": "^(?:0(?:\\.\\d+)?|1(?:\\.0+)?)$"
                                                                  },
                                                                  "amount": {
                                                                    "type": "number",
                                                                    "exclusiveMinimum": 0
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "program",
                                                                  "source_fact",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            ]
                                                          }
                                                        }
                                                      }
                                                    },
                                                    "required": [
                                                      "on"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  "display": {
                                                    "type": "object",
                                                    "properties": {
                                                      "title": {
                                                        "type": "string"
                                                      },
                                                      "description": {
                                                        "type": "string"
                                                      },
                                                      "image_url": {
                                                        "type": "string",
                                                        "format": "uri"
                                                      },
                                                      "icon": {
                                                        "type": "string"
                                                      },
                                                      "color": {
                                                        "type": "string"
                                                      },
                                                      "sort_order": {
                                                        "default": 0,
                                                        "type": "integer",
                                                        "minimum": -9007199254740991,
                                                        "maximum": 9007199254740991
                                                      },
                                                      "hidden": {
                                                        "default": false,
                                                        "type": "boolean"
                                                      },
                                                      "locales": {
                                                        "default": {},
                                                        "type": "object",
                                                        "propertyNames": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
                                                        },
                                                        "additionalProperties": {
                                                          "type": "object",
                                                          "properties": {
                                                            "title": {
                                                              "type": "string"
                                                            },
                                                            "description": {
                                                              "type": "string"
                                                            }
                                                          },
                                                          "additionalProperties": false
                                                        }
                                                      }
                                                    },
                                                    "additionalProperties": false
                                                  },
                                                  "enrollment": {
                                                    "type": "object",
                                                    "properties": {
                                                      "mode": {
                                                        "default": "automatic",
                                                        "type": "string",
                                                        "enum": [
                                                          "automatic",
                                                          "explicit"
                                                        ]
                                                      }
                                                    },
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "schema",
                                                  "kind",
                                                  "semantics",
                                                  "definition",
                                                  "qualification",
                                                  "calendar",
                                                  "trust",
                                                  "correction",
                                                  "reward",
                                                  "display",
                                                  "enrollment"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "schema": {
                                                    "type": "string",
                                                    "const": "orishare.program/v2"
                                                  },
                                                  "kind": {
                                                    "type": "string",
                                                    "enum": [
                                                      "tier",
                                                      "quest",
                                                      "campaign",
                                                      "reward",
                                                      "streak",
                                                      "badge",
                                                      "leaderboard",
                                                      "referral"
                                                    ]
                                                  },
                                                  "semantics": {
                                                    "type": "string",
                                                    "const": "native_v2"
                                                  },
                                                  "definition": {
                                                    "oneOf": [
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "streak"
                                                          },
                                                          "qualification": {
                                                            "type": "object",
                                                            "properties": {
                                                              "aggregation": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "count",
                                                                  "sum"
                                                                ]
                                                              },
                                                              "minimum": {
                                                                "type": "string",
                                                                "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                              }
                                                            },
                                                            "required": [
                                                              "aggregation",
                                                              "minimum"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          "freezes": {
                                                            "type": "object",
                                                            "properties": {
                                                              "ceiling": {
                                                                "type": "integer",
                                                                "minimum": 0,
                                                                "maximum": 1000
                                                              },
                                                              "auto_use": {
                                                                "default": true,
                                                                "type": "boolean"
                                                              },
                                                              "purchase": {
                                                                "type": "object",
                                                                "properties": {
                                                                  "currency": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "amount_minor": {
                                                                    "type": "string",
                                                                    "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "currency",
                                                                  "amount_minor"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            },
                                                            "required": [
                                                              "ceiling"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          "milestones": {
                                                            "maxItems": 64,
                                                            "type": "array",
                                                            "items": {
                                                              "type": "object",
                                                              "properties": {
                                                                "key": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                },
                                                                "threshold": {
                                                                  "type": "integer",
                                                                  "minimum": 1,
                                                                  "maximum": 9007199254740991
                                                                },
                                                                "occurrence": {
                                                                  "type": "string",
                                                                  "enum": [
                                                                    "lifetime",
                                                                    "episode"
                                                                  ]
                                                                }
                                                              },
                                                              "required": [
                                                                "key",
                                                                "threshold",
                                                                "occurrence"
                                                              ],
                                                              "additionalProperties": false
                                                            }
                                                          },
                                                          "repair": {
                                                            "type": "object",
                                                            "properties": {
                                                              "price": {
                                                                "type": "object",
                                                                "properties": {
                                                                  "currency": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "amount_minor": {
                                                                    "type": "string",
                                                                    "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "currency",
                                                                  "amount_minor"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              "window_periods": {
                                                                "type": "integer",
                                                                "minimum": 1,
                                                                "maximum": 30
                                                              },
                                                              "maximum_per_days": {
                                                                "type": "object",
                                                                "properties": {
                                                                  "count": {
                                                                    "type": "integer",
                                                                    "minimum": 1,
                                                                    "maximum": 1000
                                                                  },
                                                                  "days": {
                                                                    "type": "integer",
                                                                    "minimum": 1,
                                                                    "maximum": 366
                                                                  }
                                                                },
                                                                "required": [
                                                                  "count",
                                                                  "days"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            },
                                                            "required": [
                                                              "price",
                                                              "window_periods"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          "protected_weekdays": {
                                                            "minItems": 1,
                                                            "maxItems": 6,
                                                            "type": "array",
                                                            "items": {
                                                              "type": "integer",
                                                              "minimum": 0,
                                                              "maximum": 6
                                                            }
                                                          }
                                                        },
                                                        "required": [
                                                          "kind",
                                                          "qualification",
                                                          "freezes",
                                                          "milestones"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "badge"
                                                          },
                                                          "qualification": {
                                                            "oneOf": [
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "aggregation": {
                                                                    "type": "string",
                                                                    "const": "count"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "aggregation"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "aggregation": {
                                                                    "type": "string",
                                                                    "const": "sum"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "aggregation"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "aggregation": {
                                                                    "type": "string",
                                                                    "const": "distinct"
                                                                  },
                                                                  "distinct_key": {
                                                                    "type": "string",
                                                                    "maxLength": 255,
                                                                    "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "aggregation",
                                                                  "distinct_key"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            ],
                                                            "type": "object"
                                                          },
                                                          "ranks": {
                                                            "minItems": 1,
                                                            "maxItems": 64,
                                                            "type": "array",
                                                            "items": {
                                                              "type": "object",
                                                              "properties": {
                                                                "key": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                },
                                                                "threshold": {
                                                                  "type": "string",
                                                                  "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                                },
                                                                "display": {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "title": {
                                                                      "type": "string",
                                                                      "maxLength": 255
                                                                    },
                                                                    "description": {
                                                                      "type": "string",
                                                                      "maxLength": 4096
                                                                    }
                                                                  },
                                                                  "additionalProperties": false
                                                                }
                                                              },
                                                              "required": [
                                                                "key",
                                                                "threshold"
                                                              ],
                                                              "additionalProperties": false
                                                            }
                                                          },
                                                          "visibility": {
                                                            "type": "string",
                                                            "enum": [
                                                              "visible",
                                                              "hidden_until_earned"
                                                            ]
                                                          },
                                                          "collection": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                          },
                                                          "repeatable": {
                                                            "type": "boolean"
                                                          },
                                                          "occurrence": {
                                                            "oneOf": [
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "lifetime"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "period"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "season"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "verified_fact"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            ],
                                                            "type": "object"
                                                          }
                                                        },
                                                        "required": [
                                                          "kind",
                                                          "qualification",
                                                          "ranks",
                                                          "visibility",
                                                          "repeatable",
                                                          "occurrence"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "quest"
                                                          },
                                                          "steps": {
                                                            "minItems": 1,
                                                            "maxItems": 32,
                                                            "type": "array",
                                                            "items": {
                                                              "type": "object",
                                                              "properties": {
                                                                "key": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                },
                                                                "aggregation": {
                                                                  "type": "string",
                                                                  "enum": [
                                                                    "count",
                                                                    "sum",
                                                                    "distinct"
                                                                  ]
                                                                },
                                                                "target": {
                                                                  "type": "string",
                                                                  "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                                },
                                                                "distinct_key": {
                                                                  "type": "string",
                                                                  "maxLength": 255,
                                                                  "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                                                },
                                                                "display": {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "title": {
                                                                      "type": "string",
                                                                      "maxLength": 255
                                                                    },
                                                                    "description": {
                                                                      "type": "string",
                                                                      "maxLength": 4096
                                                                    }
                                                                  },
                                                                  "additionalProperties": false
                                                                },
                                                                "available_from": {
                                                                  "type": "string",
                                                                  "format": "date-time",
                                                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                                },
                                                                "deadline": {
                                                                  "type": "string",
                                                                  "format": "date-time",
                                                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                                }
                                                              },
                                                              "required": [
                                                                "key",
                                                                "aggregation",
                                                                "target",
                                                                "display"
                                                              ],
                                                              "additionalProperties": false
                                                            }
                                                          },
                                                          "prerequisites": {
                                                            "maxItems": 64,
                                                            "type": "array",
                                                            "items": {
                                                              "type": "object",
                                                              "properties": {
                                                                "step": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                },
                                                                "requires": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                }
                                                              },
                                                              "required": [
                                                                "step",
                                                                "requires"
                                                              ],
                                                              "additionalProperties": false
                                                            }
                                                          },
                                                          "collection": {
                                                            "type": "string",
                                                            "enum": [
                                                              "auto_collect",
                                                              "claim"
                                                            ]
                                                          },
                                                          "repeatable": {
                                                            "type": "boolean"
                                                          },
                                                          "claim_deadline": {
                                                            "type": "string",
                                                            "format": "date-time",
                                                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                          },
                                                          "chain": {
                                                            "type": "object",
                                                            "properties": {
                                                              "kind": {
                                                                "type": "string",
                                                                "const": "program"
                                                              },
                                                              "key": {
                                                                "type": "string",
                                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                              },
                                                              "version": {
                                                                "type": "integer",
                                                                "minimum": 1,
                                                                "maximum": 9007199254740991
                                                              },
                                                              "digest": {
                                                                "type": "string",
                                                                "pattern": "^[a-f0-9]{64}$"
                                                              }
                                                            },
                                                            "required": [
                                                              "kind",
                                                              "key",
                                                              "version",
                                                              "digest"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          "rotation": {
                                                            "type": "object",
                                                            "properties": {
                                                              "candidates": {
                                                                "minItems": 1,
                                                                "maxItems": 100,
                                                                "type": "array",
                                                                "items": {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "kind": {
                                                                      "type": "string",
                                                                      "const": "program"
                                                                    },
                                                                    "key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "version": {
                                                                      "type": "integer",
                                                                      "minimum": 1,
                                                                      "maximum": 9007199254740991
                                                                    },
                                                                    "digest": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-f0-9]{64}$"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "kind",
                                                                    "key",
                                                                    "version",
                                                                    "digest"
                                                                  ],
                                                                  "additionalProperties": false
                                                                }
                                                              },
                                                              "select": {
                                                                "type": "integer",
                                                                "minimum": 1,
                                                                "maximum": 100
                                                              }
                                                            },
                                                            "required": [
                                                              "candidates",
                                                              "select"
                                                            ],
                                                            "additionalProperties": false
                                                          }
                                                        },
                                                        "required": [
                                                          "kind",
                                                          "steps",
                                                          "prerequisites",
                                                          "collection",
                                                          "repeatable"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "tier"
                                                          },
                                                          "currency": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                          },
                                                          "basis": {
                                                            "oneOf": [
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "lifetime_earned"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "balance"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "earned_rolling_days"
                                                                  },
                                                                  "days": {
                                                                    "type": "integer",
                                                                    "minimum": 1,
                                                                    "maximum": 9007199254740991
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "days"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            ],
                                                            "type": "object"
                                                          },
                                                          "downgrade_check": {
                                                            "type": "string",
                                                            "enum": [
                                                              "daily",
                                                              "monthly",
                                                              "never"
                                                            ]
                                                          },
                                                          "levels": {
                                                            "minItems": 1,
                                                            "maxItems": 1000,
                                                            "type": "array",
                                                            "items": {
                                                              "type": "object",
                                                              "properties": {
                                                                "key": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                },
                                                                "threshold": {
                                                                  "type": "string",
                                                                  "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                                },
                                                                "display": {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "title": {
                                                                      "type": "string",
                                                                      "maxLength": 255
                                                                    },
                                                                    "description": {
                                                                      "type": "string",
                                                                      "maxLength": 4096
                                                                    }
                                                                  },
                                                                  "additionalProperties": false
                                                                }
                                                              },
                                                              "required": [
                                                                "key",
                                                                "threshold",
                                                                "display"
                                                              ],
                                                              "additionalProperties": false
                                                            }
                                                          },
                                                          "occurrence": {
                                                            "oneOf": [
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "lifetime"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "season"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "prestige"
                                                                  },
                                                                  "maximum_runs": {
                                                                    "type": "integer",
                                                                    "minimum": 1,
                                                                    "maximum": 9007199254740991
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "maximum_runs"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            ],
                                                            "type": "object"
                                                          }
                                                        },
                                                        "required": [
                                                          "kind",
                                                          "currency",
                                                          "basis",
                                                          "downgrade_check",
                                                          "levels",
                                                          "occurrence"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "leaderboard"
                                                          },
                                                          "aggregation": {
                                                            "type": "string",
                                                            "enum": [
                                                              "sum",
                                                              "max",
                                                              "latest_verified"
                                                            ]
                                                          },
                                                          "input": {
                                                            "type": "object",
                                                            "properties": {
                                                              "minimum": {
                                                                "type": "string",
                                                                "pattern": "^(0|-?[1-9][0-9]{0,18})$"
                                                              },
                                                              "maximum": {
                                                                "type": "string",
                                                                "pattern": "^(0|-?[1-9][0-9]{0,18})$"
                                                              }
                                                            },
                                                            "required": [
                                                              "minimum",
                                                              "maximum"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          "order": {
                                                            "type": "string",
                                                            "enum": [
                                                              "ascending",
                                                              "descending"
                                                            ]
                                                          },
                                                          "scope": {
                                                            "oneOf": [
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "global"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "segment"
                                                                  },
                                                                  "segment": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "segment"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "group_key"
                                                                  },
                                                                  "key": {
                                                                    "type": "string",
                                                                    "maxLength": 255,
                                                                    "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "key"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            ],
                                                            "type": "object"
                                                          },
                                                          "rank": {
                                                            "type": "string",
                                                            "const": "ordinal"
                                                          },
                                                          "privacy": {
                                                            "type": "object",
                                                            "properties": {
                                                              "display": {
                                                                "type": "string",
                                                                "const": "pseudonymous"
                                                              },
                                                              "opt_out": {
                                                                "type": "boolean",
                                                                "const": true
                                                              },
                                                              "anonymous_entries": {
                                                                "type": "boolean",
                                                                "const": false
                                                              }
                                                            },
                                                            "required": [
                                                              "display",
                                                              "opt_out",
                                                              "anonymous_entries"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          "prizes": {
                                                            "maxItems": 100,
                                                            "type": "array",
                                                            "items": {
                                                              "type": "object",
                                                              "properties": {
                                                                "key": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                },
                                                                "from": {
                                                                  "type": "integer",
                                                                  "minimum": 1,
                                                                  "maximum": 1000
                                                                },
                                                                "through": {
                                                                  "type": "integer",
                                                                  "minimum": 1,
                                                                  "maximum": 1000
                                                                },
                                                                "awards": {
                                                                  "minItems": 1,
                                                                  "maxItems": 16,
                                                                  "type": "array",
                                                                  "items": {
                                                                    "oneOf": [
                                                                      {
                                                                        "type": "object",
                                                                        "properties": {
                                                                          "currency": {
                                                                            "type": "string",
                                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                          },
                                                                          "amount_minor": {
                                                                            "type": "string",
                                                                            "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                                          },
                                                                          "type": {
                                                                            "type": "string",
                                                                            "const": "currency"
                                                                          }
                                                                        },
                                                                        "required": [
                                                                          "currency",
                                                                          "amount_minor",
                                                                          "type"
                                                                        ],
                                                                        "additionalProperties": false
                                                                      },
                                                                      {
                                                                        "type": "object",
                                                                        "properties": {
                                                                          "type": {
                                                                            "type": "string",
                                                                            "const": "reward"
                                                                          },
                                                                          "reward": {
                                                                            "type": "string",
                                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                          },
                                                                          "quantity": {
                                                                            "type": "number",
                                                                            "const": 1
                                                                          }
                                                                        },
                                                                        "required": [
                                                                          "type",
                                                                          "reward",
                                                                          "quantity"
                                                                        ],
                                                                        "additionalProperties": false
                                                                      },
                                                                      {
                                                                        "type": "object",
                                                                        "properties": {
                                                                          "type": {
                                                                            "type": "string",
                                                                            "const": "item"
                                                                          },
                                                                          "item": {
                                                                            "type": "string",
                                                                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                                          },
                                                                          "quantity": {
                                                                            "type": "integer",
                                                                            "minimum": 1,
                                                                            "maximum": 1000
                                                                          }
                                                                        },
                                                                        "required": [
                                                                          "type",
                                                                          "item",
                                                                          "quantity"
                                                                        ],
                                                                        "additionalProperties": false
                                                                      }
                                                                    ],
                                                                    "type": "object"
                                                                  }
                                                                }
                                                              },
                                                              "required": [
                                                                "key",
                                                                "from",
                                                                "through",
                                                                "awards"
                                                              ],
                                                              "additionalProperties": false
                                                            }
                                                          },
                                                          "score_source": {
                                                            "oneOf": [
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "contributions"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "currency_earned"
                                                                  },
                                                                  "currency": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "currency"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "currency_balance"
                                                                  },
                                                                  "currency": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "currency"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            ],
                                                            "type": "object"
                                                          }
                                                        },
                                                        "required": [
                                                          "kind",
                                                          "aggregation",
                                                          "input",
                                                          "order",
                                                          "scope",
                                                          "rank",
                                                          "privacy",
                                                          "prizes"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "referral"
                                                          },
                                                          "attribution_window_seconds": {
                                                            "type": "integer",
                                                            "minimum": 1,
                                                            "maximum": 9007199254740991
                                                          },
                                                          "account_eligibility": {
                                                            "type": "string",
                                                            "enum": [
                                                              "new",
                                                              "existing",
                                                              "any"
                                                            ]
                                                          },
                                                          "new_account_window_seconds": {
                                                            "type": "integer",
                                                            "minimum": 1,
                                                            "maximum": 9007199254740991
                                                          },
                                                          "allow_anonymous_claim": {
                                                            "type": "boolean"
                                                          },
                                                          "qualifying_event": {
                                                            "type": "string",
                                                            "maxLength": 255,
                                                            "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                          },
                                                          "minimum": {
                                                            "type": "object",
                                                            "properties": {
                                                              "currency": {
                                                                "type": "string",
                                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                              },
                                                              "amount_minor": {
                                                                "type": "string",
                                                                "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                              }
                                                            },
                                                            "required": [
                                                              "currency",
                                                              "amount_minor"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          "cooling_off_seconds": {
                                                            "type": "integer",
                                                            "minimum": 0,
                                                            "maximum": 9007199254740991
                                                          },
                                                          "rewards": {
                                                            "type": "object",
                                                            "properties": {
                                                              "referrer": {
                                                                "minItems": 1,
                                                                "maxItems": 16,
                                                                "type": "array",
                                                                "items": {
                                                                  "oneOf": [
                                                                    {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "string",
                                                                          "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                                        },
                                                                        "type": {
                                                                          "type": "string",
                                                                          "const": "currency"
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor",
                                                                        "type"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    },
                                                                    {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "type": {
                                                                          "type": "string",
                                                                          "const": "reward"
                                                                        },
                                                                        "reward": {
                                                                          "type": "string",
                                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                        },
                                                                        "quantity": {
                                                                          "type": "number",
                                                                          "const": 1
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "type",
                                                                        "reward",
                                                                        "quantity"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    },
                                                                    {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "type": {
                                                                          "type": "string",
                                                                          "const": "item"
                                                                        },
                                                                        "item": {
                                                                          "type": "string",
                                                                          "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                                        },
                                                                        "quantity": {
                                                                          "type": "integer",
                                                                          "minimum": 1,
                                                                          "maximum": 1000
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "type",
                                                                        "item",
                                                                        "quantity"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  ],
                                                                  "type": "object"
                                                                }
                                                              },
                                                              "referred": {
                                                                "minItems": 1,
                                                                "maxItems": 16,
                                                                "type": "array",
                                                                "items": {
                                                                  "oneOf": [
                                                                    {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "string",
                                                                          "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                                        },
                                                                        "type": {
                                                                          "type": "string",
                                                                          "const": "currency"
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor",
                                                                        "type"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    },
                                                                    {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "type": {
                                                                          "type": "string",
                                                                          "const": "reward"
                                                                        },
                                                                        "reward": {
                                                                          "type": "string",
                                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                        },
                                                                        "quantity": {
                                                                          "type": "number",
                                                                          "const": 1
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "type",
                                                                        "reward",
                                                                        "quantity"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    },
                                                                    {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "type": {
                                                                          "type": "string",
                                                                          "const": "item"
                                                                        },
                                                                        "item": {
                                                                          "type": "string",
                                                                          "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                                        },
                                                                        "quantity": {
                                                                          "type": "integer",
                                                                          "minimum": 1,
                                                                          "maximum": 1000
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "type",
                                                                        "item",
                                                                        "quantity"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  ],
                                                                  "type": "object"
                                                                }
                                                              }
                                                            },
                                                            "required": [
                                                              "referrer",
                                                              "referred"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          "caps": {
                                                            "type": "object",
                                                            "properties": {
                                                              "per_referrer": {
                                                                "type": "integer",
                                                                "minimum": 1,
                                                                "maximum": 9007199254740991
                                                              },
                                                              "per_environment": {
                                                                "type": "integer",
                                                                "minimum": 1,
                                                                "maximum": 9007199254740991
                                                              }
                                                            },
                                                            "required": [
                                                              "per_referrer",
                                                              "per_environment"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          "refund": {
                                                            "type": "string",
                                                            "const": "proportional_then_invalidate"
                                                          },
                                                          "approval": {
                                                            "oneOf": [
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "mode": {
                                                                    "type": "string",
                                                                    "const": "review"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "mode"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "mode": {
                                                                    "type": "string",
                                                                    "const": "automatic"
                                                                  },
                                                                  "period_seconds": {
                                                                    "type": "integer",
                                                                    "minimum": 1,
                                                                    "maximum": 2678400
                                                                  },
                                                                  "max_per_referrer_per_period": {
                                                                    "type": "integer",
                                                                    "minimum": 1,
                                                                    "maximum": 9007199254740991
                                                                  },
                                                                  "max_per_period": {
                                                                    "type": "integer",
                                                                    "minimum": 1,
                                                                    "maximum": 9007199254740991
                                                                  }
                                                                },
                                                                "required": [
                                                                  "mode",
                                                                  "period_seconds",
                                                                  "max_per_referrer_per_period",
                                                                  "max_per_period"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            ],
                                                            "type": "object"
                                                          }
                                                        },
                                                        "required": [
                                                          "kind",
                                                          "attribution_window_seconds",
                                                          "account_eligibility",
                                                          "allow_anonymous_claim",
                                                          "qualifying_event",
                                                          "minimum",
                                                          "cooling_off_seconds",
                                                          "rewards",
                                                          "caps",
                                                          "refund"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "campaign"
                                                          },
                                                          "priority": {
                                                            "type": "integer",
                                                            "minimum": -2147483648,
                                                            "maximum": 2147483647
                                                          }
                                                        },
                                                        "required": [
                                                          "kind",
                                                          "priority"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "reward"
                                                          },
                                                          "reward": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                          }
                                                        },
                                                        "required": [
                                                          "kind",
                                                          "reward"
                                                        ],
                                                        "additionalProperties": false
                                                      }
                                                    ],
                                                    "type": "object"
                                                  },
                                                  "qualification": {
                                                    "type": "object",
                                                    "properties": {
                                                      "sources": {
                                                        "type": "array",
                                                        "items": {
                                                          "type": "object",
                                                          "properties": {
                                                            "event": {
                                                              "type": "string",
                                                              "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                            },
                                                            "conditions": {
                                                              "$ref": "#/components/schemas/__schema3"
                                                            },
                                                            "value": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "number"
                                                                },
                                                                {
                                                                  "type": "string",
                                                                  "minLength": 1
                                                                }
                                                              ]
                                                            },
                                                            "step": {
                                                              "type": "string",
                                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                            },
                                                            "occurrence": {
                                                              "default": "lifetime",
                                                              "type": "string",
                                                              "enum": [
                                                                "lifetime",
                                                                "period"
                                                              ]
                                                            }
                                                          },
                                                          "required": [
                                                            "event"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "audience": {
                                                        "type": "array",
                                                        "items": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        }
                                                      },
                                                      "starts_at": {
                                                        "type": "string",
                                                        "format": "date-time",
                                                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                      },
                                                      "ends_at": {
                                                        "type": "string",
                                                        "format": "date-time",
                                                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                      },
                                                      "campaign": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      }
                                                    },
                                                    "required": [
                                                      "sources"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  "calendar": {
                                                    "type": "object",
                                                    "properties": {
                                                      "schema": {
                                                        "type": "string",
                                                        "const": "orishare.calendar/v1"
                                                      },
                                                      "period": {
                                                        "anyOf": [
                                                          {
                                                            "type": "string",
                                                            "enum": [
                                                              "none",
                                                              "day",
                                                              "week",
                                                              "month",
                                                              "year"
                                                            ]
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "kind": {
                                                                "type": "string",
                                                                "const": "season"
                                                              },
                                                              "starts_at": {
                                                                "type": "string",
                                                                "format": "date-time",
                                                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                              },
                                                              "ends_at": {
                                                                "type": "string",
                                                                "format": "date-time",
                                                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                              }
                                                            },
                                                            "required": [
                                                              "kind",
                                                              "starts_at",
                                                              "ends_at"
                                                            ],
                                                            "additionalProperties": false
                                                          }
                                                        ]
                                                      },
                                                      "run_per_period": {
                                                        "type": "boolean"
                                                      },
                                                      "timezone_source": {
                                                        "type": "string",
                                                        "enum": [
                                                          "environment",
                                                          "customer",
                                                          "fixed"
                                                        ]
                                                      },
                                                      "timezone": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      },
                                                      "day_start_offset_minutes": {
                                                        "default": 0,
                                                        "type": "integer",
                                                        "minimum": 0,
                                                        "maximum": 1439
                                                      },
                                                      "ambiguous_local_time": {
                                                        "type": "string",
                                                        "const": "earlier"
                                                      },
                                                      "nonexistent_local_time": {
                                                        "type": "string",
                                                        "const": "next_valid"
                                                      },
                                                      "event_time": {
                                                        "type": "object",
                                                        "properties": {
                                                          "merchant": {
                                                            "type": "string",
                                                            "const": "occurred_at"
                                                          },
                                                          "client": {
                                                            "anyOf": [
                                                              {
                                                                "type": "string",
                                                                "const": "received_at"
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "offline_seconds": {
                                                                    "type": "integer",
                                                                    "minimum": 0,
                                                                    "maximum": 9007199254740991
                                                                  }
                                                                },
                                                                "required": [
                                                                  "offline_seconds"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            ]
                                                          }
                                                        },
                                                        "required": [
                                                          "merchant",
                                                          "client"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      "grace_seconds": {
                                                        "default": 0,
                                                        "type": "integer",
                                                        "minimum": 0,
                                                        "maximum": 9007199254740991
                                                      },
                                                      "max_lateness_seconds": {
                                                        "default": 0,
                                                        "type": "integer",
                                                        "minimum": 0,
                                                        "maximum": 9007199254740991
                                                      },
                                                      "settlement_delay_seconds": {
                                                        "default": 0,
                                                        "type": "integer",
                                                        "minimum": 0,
                                                        "maximum": 9007199254740991
                                                      },
                                                      "after_finalization": {
                                                        "type": "string",
                                                        "const": "correction_only"
                                                      }
                                                    },
                                                    "required": [
                                                      "schema",
                                                      "period",
                                                      "run_per_period",
                                                      "timezone_source",
                                                      "ambiguous_local_time",
                                                      "nonexistent_local_time",
                                                      "event_time",
                                                      "after_finalization"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  "trust": {
                                                    "type": "object",
                                                    "properties": {
                                                      "minimum_trust": {
                                                        "type": "string",
                                                        "enum": [
                                                          "anonymous_claim",
                                                          "customer_claim",
                                                          "merchant_asserted",
                                                          "verified_evidence",
                                                          "legacy_unknown"
                                                        ]
                                                      },
                                                      "allowed_sources": {
                                                        "minItems": 1,
                                                        "type": "array",
                                                        "items": {
                                                          "type": "string",
                                                          "enum": [
                                                            "publishable_event",
                                                            "secret_key_event",
                                                            "verified_connector",
                                                            "operator_command",
                                                            "customer_command",
                                                            "import",
                                                            "program_transition",
                                                            "schedule"
                                                          ]
                                                        }
                                                      },
                                                      "on_insufficient": {
                                                        "type": "string",
                                                        "enum": [
                                                          "ignore",
                                                          "progress_without_reward"
                                                        ]
                                                      },
                                                      "liability_caps": {
                                                        "type": "array",
                                                        "items": {
                                                          "type": "object",
                                                          "properties": {
                                                            "trust": {
                                                              "type": "string",
                                                              "enum": [
                                                                "anonymous_claim",
                                                                "customer_claim",
                                                                "merchant_asserted",
                                                                "verified_evidence",
                                                                "legacy_unknown"
                                                              ]
                                                            },
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "scope": {
                                                              "type": "string",
                                                              "enum": [
                                                                "customer",
                                                                "environment"
                                                              ]
                                                            },
                                                            "window": {
                                                              "type": "string",
                                                              "enum": [
                                                                "day",
                                                                "month",
                                                                "lifetime"
                                                              ]
                                                            },
                                                            "maximum_minor": {
                                                              "type": "integer",
                                                              "minimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "trust",
                                                            "currency",
                                                            "scope",
                                                            "window",
                                                            "maximum_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "recognition_caps": {
                                                        "type": "array",
                                                        "items": {
                                                          "type": "object",
                                                          "properties": {
                                                            "trust": {
                                                              "type": "string",
                                                              "enum": [
                                                                "anonymous_claim",
                                                                "customer_claim",
                                                                "merchant_asserted",
                                                                "verified_evidence",
                                                                "legacy_unknown"
                                                              ]
                                                            },
                                                            "per": {
                                                              "type": "string",
                                                              "enum": [
                                                                "period",
                                                                "day"
                                                              ]
                                                            },
                                                            "contributions": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            },
                                                            "value": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "trust",
                                                            "per"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "allow_legacy_unknown": {
                                                        "type": "boolean",
                                                        "const": false
                                                      }
                                                    },
                                                    "required": [
                                                      "minimum_trust",
                                                      "allowed_sources",
                                                      "on_insufficient",
                                                      "liability_caps",
                                                      "recognition_caps",
                                                      "allow_legacy_unknown"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  "correction": {
                                                    "type": "object",
                                                    "properties": {
                                                      "qualification": {
                                                        "default": "reverse",
                                                        "type": "string",
                                                        "enum": [
                                                          "reverse",
                                                          "keep"
                                                        ]
                                                      },
                                                      "spendable": {
                                                        "type": "string",
                                                        "const": "reverse"
                                                      },
                                                      "xp": {
                                                        "default": "reverse",
                                                        "type": "string",
                                                        "enum": [
                                                          "reverse",
                                                          "keep"
                                                        ]
                                                      },
                                                      "recognition": {
                                                        "default": "keep",
                                                        "type": "string",
                                                        "enum": [
                                                          "keep",
                                                          "revoke_on_fraud"
                                                        ]
                                                      },
                                                      "after_finalization": {
                                                        "default": "correcting_revision",
                                                        "type": "string",
                                                        "const": "correcting_revision"
                                                      },
                                                      "allowance_on_refund": {
                                                        "default": "consumed",
                                                        "type": "string",
                                                        "enum": [
                                                          "consumed",
                                                          "release_on_verified_void"
                                                        ]
                                                      }
                                                    },
                                                    "required": [
                                                      "spendable"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  "reward": {
                                                    "type": "object",
                                                    "properties": {
                                                      "on": {
                                                        "type": "object",
                                                        "propertyNames": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]*(?::[a-z0-9_]+)?$"
                                                        },
                                                        "additionalProperties": {
                                                          "type": "array",
                                                          "items": {
                                                            "anyOf": [
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "points.award"
                                                                  },
                                                                  "currency": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "amount": {
                                                                    "anyOf": [
                                                                      {
                                                                        "type": "number"
                                                                      },
                                                                      {
                                                                        "type": "string",
                                                                        "minLength": 1
                                                                      }
                                                                    ]
                                                                  },
                                                                  "reason": {
                                                                    "type": "string",
                                                                    "maxLength": 200
                                                                  },
                                                                  "confirm_after": {
                                                                    "type": "string",
                                                                    "pattern": "^\\d+[smhdw]$"
                                                                  },
                                                                  "expires_after": {
                                                                    "type": "string",
                                                                    "pattern": "^\\d+[smhdw]$"
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "currency",
                                                                  "amount",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "points.deduct"
                                                                  },
                                                                  "currency": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "amount": {
                                                                    "anyOf": [
                                                                      {
                                                                        "type": "number"
                                                                      },
                                                                      {
                                                                        "type": "string",
                                                                        "minLength": 1
                                                                      }
                                                                    ]
                                                                  },
                                                                  "reason": {
                                                                    "type": "string",
                                                                    "maxLength": 200
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "currency",
                                                                  "amount",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "points.reverse"
                                                                  },
                                                                  "currency": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "match": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "event": {
                                                                        "type": "string",
                                                                        "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                                      },
                                                                      "on": {
                                                                        "type": "string",
                                                                        "minLength": 1
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "event",
                                                                      "on"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  },
                                                                  "fraction": {
                                                                    "anyOf": [
                                                                      {
                                                                        "type": "number"
                                                                      },
                                                                      {
                                                                        "type": "string",
                                                                        "minLength": 1
                                                                      }
                                                                    ]
                                                                  },
                                                                  "amount": {
                                                                    "anyOf": [
                                                                      {
                                                                        "type": "number"
                                                                      },
                                                                      {
                                                                        "type": "string",
                                                                        "minLength": 1
                                                                      }
                                                                    ]
                                                                  },
                                                                  "reason": {
                                                                    "type": "string",
                                                                    "maxLength": 200
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "currency",
                                                                  "match",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "reward.issue"
                                                                  },
                                                                  "reward": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "reward",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "tier.evaluate"
                                                                  },
                                                                  "program": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "program",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "attribute.set"
                                                                  },
                                                                  "attribute": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "value": {
                                                                    "type": [
                                                                      "string",
                                                                      "number",
                                                                      "boolean",
                                                                      "null"
                                                                    ]
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "attribute",
                                                                  "value",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "webhook.emit"
                                                                  },
                                                                  "event": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                                  },
                                                                  "payload": {
                                                                    "type": "object",
                                                                    "propertyNames": {
                                                                      "type": "string"
                                                                    },
                                                                    "additionalProperties": {
                                                                      "anyOf": [
                                                                        {
                                                                          "type": [
                                                                            "string",
                                                                            "number",
                                                                            "boolean"
                                                                          ]
                                                                        },
                                                                        {
                                                                          "type": "null"
                                                                        },
                                                                        {
                                                                          "type": "array",
                                                                          "items": {
                                                                            "type": [
                                                                              "string",
                                                                              "number",
                                                                              "boolean"
                                                                            ]
                                                                          }
                                                                        }
                                                                      ]
                                                                    }
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "event",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "badge.contribute"
                                                                  },
                                                                  "badge": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "value": {
                                                                    "anyOf": [
                                                                      {
                                                                        "type": "number"
                                                                      },
                                                                      {
                                                                        "type": "string",
                                                                        "minLength": 1
                                                                      }
                                                                    ]
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "badge",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "badge.grant"
                                                                  },
                                                                  "badge": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "rank": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "occurrence": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "badge",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "streak.contribute"
                                                                  },
                                                                  "streak": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "value": {
                                                                    "anyOf": [
                                                                      {
                                                                        "type": "number"
                                                                      },
                                                                      {
                                                                        "type": "string",
                                                                        "minLength": 1
                                                                      }
                                                                    ]
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "streak",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "streak.freeze_grant"
                                                                  },
                                                                  "streak": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "quantity": {
                                                                    "type": "integer",
                                                                    "exclusiveMinimum": 0,
                                                                    "maximum": 9007199254740991
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "streak",
                                                                  "quantity",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "quest.contribute"
                                                                  },
                                                                  "quest": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "step": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "value": {
                                                                    "anyOf": [
                                                                      {
                                                                        "type": "number"
                                                                      },
                                                                      {
                                                                        "type": "string",
                                                                        "minLength": 1
                                                                      }
                                                                    ]
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "quest",
                                                                  "step",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "quest.enroll"
                                                                  },
                                                                  "quest": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "quest",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "leaderboard.contribute"
                                                                  },
                                                                  "leaderboard": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "value": {
                                                                    "anyOf": [
                                                                      {
                                                                        "type": "number"
                                                                      },
                                                                      {
                                                                        "type": "string",
                                                                        "minLength": 1
                                                                      }
                                                                    ]
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "leaderboard",
                                                                  "value",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "program.reverse_contribution"
                                                                  },
                                                                  "program": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  },
                                                                  "source_fact": {
                                                                    "anyOf": [
                                                                      {
                                                                        "type": "object",
                                                                        "properties": {
                                                                          "fact_id": {
                                                                            "type": "string",
                                                                            "pattern": "^[A-Za-z0-9_-]+$"
                                                                          }
                                                                        },
                                                                        "required": [
                                                                          "fact_id"
                                                                        ],
                                                                        "additionalProperties": false
                                                                      },
                                                                      {
                                                                        "type": "object",
                                                                        "properties": {
                                                                          "object_type": {
                                                                            "type": "string",
                                                                            "pattern": "^[A-Za-z0-9_-]+$"
                                                                          },
                                                                          "key": {
                                                                            "minItems": 1,
                                                                            "type": "array",
                                                                            "items": {
                                                                              "type": "string",
                                                                              "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_-]*(?:\\.[A-Za-z_][A-Za-z0-9_-]*)*$"
                                                                            }
                                                                          }
                                                                        },
                                                                        "required": [
                                                                          "object_type",
                                                                          "key"
                                                                        ],
                                                                        "additionalProperties": false
                                                                      }
                                                                    ]
                                                                  },
                                                                  "fraction": {
                                                                    "type": "string",
                                                                    "pattern": "^(?:0(?:\\.\\d+)?|1(?:\\.0+)?)$"
                                                                  },
                                                                  "amount": {
                                                                    "type": "number",
                                                                    "exclusiveMinimum": 0
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "program",
                                                                  "source_fact",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "coupon.issue"
                                                                  },
                                                                  "offer": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "key": {
                                                                        "type": "string",
                                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                      },
                                                                      "version": {
                                                                        "type": "integer",
                                                                        "minimum": 1,
                                                                        "maximum": 9007199254740991
                                                                      },
                                                                      "digest": {
                                                                        "type": "string",
                                                                        "pattern": "^[a-f0-9]{64}$"
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "key",
                                                                      "version",
                                                                      "digest"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "offer",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "discount.quote"
                                                                  },
                                                                  "offer": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "key": {
                                                                        "type": "string",
                                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                      },
                                                                      "version": {
                                                                        "type": "integer",
                                                                        "minimum": 1,
                                                                        "maximum": 9007199254740991
                                                                      },
                                                                      "digest": {
                                                                        "type": "string",
                                                                        "pattern": "^[a-f0-9]{64}$"
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "key",
                                                                      "version",
                                                                      "digest"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "offer",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              {
                                                                "type": "object",
                                                                "properties": {
                                                                  "type": {
                                                                    "type": "string",
                                                                    "const": "item.grant"
                                                                  },
                                                                  "item": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                                  },
                                                                  "quantity": {
                                                                    "default": 1,
                                                                    "type": "integer",
                                                                    "minimum": 1,
                                                                    "maximum": 1000
                                                                  },
                                                                  "effect_key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "liability": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "currency": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "amount_minor": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "currency",
                                                                      "amount_minor"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "type",
                                                                  "item",
                                                                  "effect_key"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            ]
                                                          }
                                                        }
                                                      }
                                                    },
                                                    "required": [
                                                      "on"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  "display": {
                                                    "type": "object",
                                                    "properties": {
                                                      "title": {
                                                        "type": "string"
                                                      },
                                                      "description": {
                                                        "type": "string"
                                                      },
                                                      "image_url": {
                                                        "type": "string",
                                                        "format": "uri"
                                                      },
                                                      "icon": {
                                                        "type": "string"
                                                      },
                                                      "color": {
                                                        "type": "string"
                                                      },
                                                      "sort_order": {
                                                        "default": 0,
                                                        "type": "integer",
                                                        "minimum": -9007199254740991,
                                                        "maximum": 9007199254740991
                                                      },
                                                      "hidden": {
                                                        "default": false,
                                                        "type": "boolean"
                                                      },
                                                      "locales": {
                                                        "default": {},
                                                        "type": "object",
                                                        "propertyNames": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
                                                        },
                                                        "additionalProperties": {
                                                          "type": "object",
                                                          "properties": {
                                                            "title": {
                                                              "type": "string"
                                                            },
                                                            "description": {
                                                              "type": "string"
                                                            }
                                                          },
                                                          "additionalProperties": false
                                                        }
                                                      }
                                                    },
                                                    "additionalProperties": false
                                                  },
                                                  "enrollment": {
                                                    "type": "object",
                                                    "properties": {
                                                      "mode": {
                                                        "default": "automatic",
                                                        "type": "string",
                                                        "enum": [
                                                          "automatic",
                                                          "explicit"
                                                        ]
                                                      }
                                                    },
                                                    "additionalProperties": false
                                                  },
                                                  "season": {
                                                    "type": "object",
                                                    "properties": {
                                                      "kind": {
                                                        "type": "string",
                                                        "const": "season"
                                                      },
                                                      "key": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      },
                                                      "version": {
                                                        "type": "integer",
                                                        "minimum": 1,
                                                        "maximum": 9007199254740991
                                                      },
                                                      "digest": {
                                                        "type": "string",
                                                        "pattern": "^[a-f0-9]{64}$"
                                                      }
                                                    },
                                                    "required": [
                                                      "kind",
                                                      "key",
                                                      "version",
                                                      "digest"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  "dependencies": {
                                                    "default": [],
                                                    "maxItems": 64,
                                                    "type": "array",
                                                    "items": {
                                                      "type": "object",
                                                      "properties": {
                                                        "kind": {
                                                          "type": "string",
                                                          "enum": [
                                                            "program",
                                                            "currency",
                                                            "season",
                                                            "reward",
                                                            "counter",
                                                            "segment",
                                                            "campaign",
                                                            "offer",
                                                            "asset"
                                                          ]
                                                        },
                                                        "key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "version": {
                                                          "type": "integer",
                                                          "minimum": 1,
                                                          "maximum": 9007199254740991
                                                        },
                                                        "digest": {
                                                          "type": "string",
                                                          "pattern": "^[a-f0-9]{64}$"
                                                        }
                                                      },
                                                      "required": [
                                                        "kind",
                                                        "key",
                                                        "version",
                                                        "digest"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  }
                                                },
                                                "required": [
                                                  "schema",
                                                  "kind",
                                                  "semantics",
                                                  "definition",
                                                  "qualification",
                                                  "calendar",
                                                  "trust",
                                                  "correction",
                                                  "reward",
                                                  "display",
                                                  "enrollment"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ]
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "draft_bindings": {
                                        "default": [],
                                        "maxItems": 256,
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "path": {
                                              "minItems": 1,
                                              "maxItems": 32,
                                              "type": "array",
                                              "items": {
                                                "anyOf": [
                                                  {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 9007199254740991
                                                  }
                                                ]
                                              }
                                            },
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "program",
                                                "currency",
                                                "rule",
                                                "tier_level"
                                              ]
                                            },
                                            "key": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 255
                                            }
                                          },
                                          "required": [
                                            "path",
                                            "kind",
                                            "key"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "versions": {
                                        "maxItems": 1000,
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "version": {
                                              "type": "integer",
                                              "exclusiveMinimum": 0,
                                              "maximum": 9007199254740991
                                            },
                                            "digest": {
                                              "type": "string",
                                              "pattern": "^[a-f0-9]{64}$"
                                            },
                                            "definition": {
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "schema": {
                                                      "type": "string",
                                                      "const": "orishare.program/v1"
                                                    },
                                                    "kind": {
                                                      "type": "string",
                                                      "enum": [
                                                        "tier",
                                                        "quest",
                                                        "campaign",
                                                        "reward",
                                                        "streak",
                                                        "badge",
                                                        "leaderboard",
                                                        "referral"
                                                      ]
                                                    },
                                                    "semantics": {
                                                      "type": "string",
                                                      "enum": [
                                                        "native_v2",
                                                        "compat_v1"
                                                      ]
                                                    },
                                                    "definition": {
                                                      "oneOf": [
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "tier"
                                                            },
                                                            "legacy": {
                                                              "type": "object",
                                                              "propertyNames": {
                                                                "type": "string"
                                                              },
                                                              "additionalProperties": {
                                                                "$ref": "#/components/schemas/__schema2"
                                                              }
                                                            },
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                            },
                                                            "basis": {
                                                              "oneOf": [
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "lifetime_earned"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "balance"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "earned_rolling_days"
                                                                    },
                                                                    "days": {
                                                                      "type": "integer",
                                                                      "exclusiveMinimum": 0,
                                                                      "maximum": 9007199254740991
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "days"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "earned_calendar_year"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "earned_anniversary_year"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type"
                                                                  ],
                                                                  "additionalProperties": false
                                                                }
                                                              ],
                                                              "type": "object"
                                                            },
                                                            "downgrade_check": {
                                                              "type": "string",
                                                              "enum": [
                                                                "daily",
                                                                "monthly",
                                                                "never"
                                                              ]
                                                            },
                                                            "levels": {
                                                              "minItems": 1,
                                                              "type": "array",
                                                              "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                  "key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "threshold": {
                                                                    "type": "integer",
                                                                    "minimum": 0,
                                                                    "maximum": 9007199254740991
                                                                  }
                                                                },
                                                                "required": [
                                                                  "key",
                                                                  "threshold"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            }
                                                          },
                                                          "required": [
                                                            "kind",
                                                            "currency",
                                                            "basis",
                                                            "downgrade_check",
                                                            "levels"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "quest"
                                                            },
                                                            "legacy": {
                                                              "type": "object",
                                                              "propertyNames": {
                                                                "type": "string"
                                                              },
                                                              "additionalProperties": {
                                                                "$ref": "#/components/schemas/__schema2"
                                                              }
                                                            },
                                                            "steps": {
                                                              "minItems": 1,
                                                              "type": "array",
                                                              "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                  "key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "aggregation": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                      "count",
                                                                      "sum"
                                                                    ]
                                                                  },
                                                                  "target": {
                                                                    "type": "integer",
                                                                    "exclusiveMinimum": 0,
                                                                    "maximum": 9007199254740991
                                                                  }
                                                                },
                                                                "required": [
                                                                  "key",
                                                                  "aggregation",
                                                                  "target"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            },
                                                            "repeatable": {
                                                              "type": "boolean"
                                                            }
                                                          },
                                                          "required": [
                                                            "kind",
                                                            "steps",
                                                            "repeatable"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "campaign"
                                                            },
                                                            "legacy": {
                                                              "type": "object",
                                                              "propertyNames": {
                                                                "type": "string"
                                                              },
                                                              "additionalProperties": {
                                                                "$ref": "#/components/schemas/__schema2"
                                                              }
                                                            },
                                                            "priority": {
                                                              "default": 0,
                                                              "type": "integer",
                                                              "minimum": -9007199254740991,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "kind"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "reward"
                                                            },
                                                            "legacy": {
                                                              "type": "object",
                                                              "propertyNames": {
                                                                "type": "string"
                                                              },
                                                              "additionalProperties": {
                                                                "$ref": "#/components/schemas/__schema2"
                                                              }
                                                            },
                                                            "reward": {
                                                              "type": "string",
                                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                            }
                                                          },
                                                          "required": [
                                                            "kind",
                                                            "reward"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "streak"
                                                            },
                                                            "target": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            },
                                                            "freezes": {
                                                              "default": 0,
                                                              "type": "integer",
                                                              "minimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "kind",
                                                            "target"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "badge"
                                                            },
                                                            "repeatable": {
                                                              "default": false,
                                                              "type": "boolean"
                                                            }
                                                          },
                                                          "required": [
                                                            "kind"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "leaderboard"
                                                            },
                                                            "aggregation": {
                                                              "type": "string",
                                                              "enum": [
                                                                "sum",
                                                                "max",
                                                                "count"
                                                              ]
                                                            },
                                                            "order": {
                                                              "type": "string",
                                                              "enum": [
                                                                "ascending",
                                                                "descending"
                                                              ]
                                                            }
                                                          },
                                                          "required": [
                                                            "kind",
                                                            "aggregation",
                                                            "order"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "referral"
                                                            },
                                                            "target": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "kind",
                                                            "target"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      ],
                                                      "type": "object"
                                                    },
                                                    "qualification": {
                                                      "type": "object",
                                                      "properties": {
                                                        "sources": {
                                                          "type": "array",
                                                          "items": {
                                                            "type": "object",
                                                            "properties": {
                                                              "event": {
                                                                "type": "string",
                                                                "minLength": 1
                                                              },
                                                              "conditions": {
                                                                "$ref": "#/components/schemas/__schema3"
                                                              },
                                                              "value": {
                                                                "anyOf": [
                                                                  {
                                                                    "type": "number"
                                                                  },
                                                                  {
                                                                    "type": "string",
                                                                    "minLength": 1
                                                                  }
                                                                ]
                                                              },
                                                              "step": {
                                                                "type": "string",
                                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                              },
                                                              "occurrence": {
                                                                "default": "lifetime",
                                                                "type": "string",
                                                                "enum": [
                                                                  "lifetime",
                                                                  "period"
                                                                ]
                                                              }
                                                            },
                                                            "required": [
                                                              "event"
                                                            ],
                                                            "additionalProperties": false
                                                          }
                                                        },
                                                        "audience": {
                                                          "type": "array",
                                                          "items": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                          }
                                                        },
                                                        "starts_at": {
                                                          "type": "string",
                                                          "format": "date-time",
                                                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                        },
                                                        "ends_at": {
                                                          "type": "string",
                                                          "format": "date-time",
                                                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                        },
                                                        "campaign": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        }
                                                      },
                                                      "required": [
                                                        "sources"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "calendar": {
                                                      "type": "object",
                                                      "properties": {
                                                        "schema": {
                                                          "type": "string",
                                                          "const": "orishare.calendar/v1"
                                                        },
                                                        "period": {
                                                          "anyOf": [
                                                            {
                                                              "type": "string",
                                                              "enum": [
                                                                "none",
                                                                "day",
                                                                "week",
                                                                "month",
                                                                "year"
                                                              ]
                                                            },
                                                            {
                                                              "type": "object",
                                                              "properties": {
                                                                "kind": {
                                                                  "type": "string",
                                                                  "const": "season"
                                                                },
                                                                "starts_at": {
                                                                  "type": "string",
                                                                  "format": "date-time",
                                                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                                },
                                                                "ends_at": {
                                                                  "type": "string",
                                                                  "format": "date-time",
                                                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                                }
                                                              },
                                                              "required": [
                                                                "kind",
                                                                "starts_at",
                                                                "ends_at"
                                                              ],
                                                              "additionalProperties": false
                                                            }
                                                          ]
                                                        },
                                                        "run_per_period": {
                                                          "type": "boolean"
                                                        },
                                                        "timezone_source": {
                                                          "type": "string",
                                                          "enum": [
                                                            "environment",
                                                            "customer",
                                                            "fixed"
                                                          ]
                                                        },
                                                        "timezone": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "day_start_offset_minutes": {
                                                          "default": 0,
                                                          "type": "integer",
                                                          "minimum": 0,
                                                          "maximum": 1439
                                                        },
                                                        "ambiguous_local_time": {
                                                          "type": "string",
                                                          "const": "earlier"
                                                        },
                                                        "nonexistent_local_time": {
                                                          "type": "string",
                                                          "const": "next_valid"
                                                        },
                                                        "event_time": {
                                                          "type": "object",
                                                          "properties": {
                                                            "merchant": {
                                                              "type": "string",
                                                              "const": "occurred_at"
                                                            },
                                                            "client": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "string",
                                                                  "const": "received_at"
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "offline_seconds": {
                                                                      "type": "integer",
                                                                      "minimum": 0,
                                                                      "maximum": 9007199254740991
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "offline_seconds"
                                                                  ],
                                                                  "additionalProperties": false
                                                                }
                                                              ]
                                                            }
                                                          },
                                                          "required": [
                                                            "merchant",
                                                            "client"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        "grace_seconds": {
                                                          "default": 0,
                                                          "type": "integer",
                                                          "minimum": 0,
                                                          "maximum": 9007199254740991
                                                        },
                                                        "max_lateness_seconds": {
                                                          "default": 0,
                                                          "type": "integer",
                                                          "minimum": 0,
                                                          "maximum": 9007199254740991
                                                        },
                                                        "settlement_delay_seconds": {
                                                          "default": 0,
                                                          "type": "integer",
                                                          "minimum": 0,
                                                          "maximum": 9007199254740991
                                                        },
                                                        "after_finalization": {
                                                          "type": "string",
                                                          "const": "correction_only"
                                                        }
                                                      },
                                                      "required": [
                                                        "schema",
                                                        "period",
                                                        "run_per_period",
                                                        "timezone_source",
                                                        "ambiguous_local_time",
                                                        "nonexistent_local_time",
                                                        "event_time",
                                                        "after_finalization"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "trust": {
                                                      "type": "object",
                                                      "properties": {
                                                        "minimum_trust": {
                                                          "type": "string",
                                                          "enum": [
                                                            "anonymous_claim",
                                                            "customer_claim",
                                                            "merchant_asserted",
                                                            "verified_evidence",
                                                            "legacy_unknown"
                                                          ]
                                                        },
                                                        "allowed_sources": {
                                                          "minItems": 1,
                                                          "type": "array",
                                                          "items": {
                                                            "type": "string",
                                                            "enum": [
                                                              "publishable_event",
                                                              "secret_key_event",
                                                              "verified_connector",
                                                              "operator_command",
                                                              "customer_command",
                                                              "import",
                                                              "program_transition",
                                                              "schedule"
                                                            ]
                                                          }
                                                        },
                                                        "on_insufficient": {
                                                          "type": "string",
                                                          "enum": [
                                                            "ignore",
                                                            "progress_without_reward"
                                                          ]
                                                        },
                                                        "liability_caps": {
                                                          "type": "array",
                                                          "items": {
                                                            "type": "object",
                                                            "properties": {
                                                              "trust": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "anonymous_claim",
                                                                  "customer_claim",
                                                                  "merchant_asserted",
                                                                  "verified_evidence",
                                                                  "legacy_unknown"
                                                                ]
                                                              },
                                                              "currency": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "scope": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "customer",
                                                                  "environment"
                                                                ]
                                                              },
                                                              "window": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "day",
                                                                  "month",
                                                                  "lifetime"
                                                                ]
                                                              },
                                                              "maximum_minor": {
                                                                "type": "integer",
                                                                "minimum": 0,
                                                                "maximum": 9007199254740991
                                                              }
                                                            },
                                                            "required": [
                                                              "trust",
                                                              "currency",
                                                              "scope",
                                                              "window",
                                                              "maximum_minor"
                                                            ],
                                                            "additionalProperties": false
                                                          }
                                                        },
                                                        "recognition_caps": {
                                                          "type": "array",
                                                          "items": {
                                                            "type": "object",
                                                            "properties": {
                                                              "trust": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "anonymous_claim",
                                                                  "customer_claim",
                                                                  "merchant_asserted",
                                                                  "verified_evidence",
                                                                  "legacy_unknown"
                                                                ]
                                                              },
                                                              "per": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "period",
                                                                  "day"
                                                                ]
                                                              },
                                                              "contributions": {
                                                                "type": "integer",
                                                                "exclusiveMinimum": 0,
                                                                "maximum": 9007199254740991
                                                              },
                                                              "value": {
                                                                "type": "integer",
                                                                "exclusiveMinimum": 0,
                                                                "maximum": 9007199254740991
                                                              }
                                                            },
                                                            "required": [
                                                              "trust",
                                                              "per"
                                                            ],
                                                            "additionalProperties": false
                                                          }
                                                        },
                                                        "allow_legacy_unknown": {
                                                          "type": "boolean",
                                                          "const": false
                                                        }
                                                      },
                                                      "required": [
                                                        "minimum_trust",
                                                        "allowed_sources",
                                                        "on_insufficient",
                                                        "liability_caps",
                                                        "recognition_caps",
                                                        "allow_legacy_unknown"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "correction": {
                                                      "type": "object",
                                                      "properties": {
                                                        "qualification": {
                                                          "default": "reverse",
                                                          "type": "string",
                                                          "enum": [
                                                            "reverse",
                                                            "keep"
                                                          ]
                                                        },
                                                        "spendable": {
                                                          "type": "string",
                                                          "const": "reverse"
                                                        },
                                                        "xp": {
                                                          "default": "reverse",
                                                          "type": "string",
                                                          "enum": [
                                                            "reverse",
                                                            "keep"
                                                          ]
                                                        },
                                                        "recognition": {
                                                          "default": "keep",
                                                          "type": "string",
                                                          "enum": [
                                                            "keep",
                                                            "revoke_on_fraud"
                                                          ]
                                                        },
                                                        "after_finalization": {
                                                          "default": "correcting_revision",
                                                          "type": "string",
                                                          "const": "correcting_revision"
                                                        },
                                                        "allowance_on_refund": {
                                                          "default": "consumed",
                                                          "type": "string",
                                                          "enum": [
                                                            "consumed",
                                                            "release_on_verified_void"
                                                          ]
                                                        }
                                                      },
                                                      "required": [
                                                        "spendable"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "reward": {
                                                      "type": "object",
                                                      "properties": {
                                                        "on": {
                                                          "type": "object",
                                                          "propertyNames": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]*(?::[a-z0-9_]+)?$"
                                                          },
                                                          "additionalProperties": {
                                                            "type": "array",
                                                            "items": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "points.award"
                                                                    },
                                                                    "currency": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "amount": {
                                                                      "anyOf": [
                                                                        {
                                                                          "type": "number"
                                                                        },
                                                                        {
                                                                          "type": "string",
                                                                          "minLength": 1
                                                                        }
                                                                      ]
                                                                    },
                                                                    "reason": {
                                                                      "type": "string",
                                                                      "maxLength": 200
                                                                    },
                                                                    "confirm_after": {
                                                                      "type": "string",
                                                                      "pattern": "^\\d+[smhdw]$"
                                                                    },
                                                                    "expires_after": {
                                                                      "type": "string",
                                                                      "pattern": "^\\d+[smhdw]$"
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "currency",
                                                                    "amount",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "points.deduct"
                                                                    },
                                                                    "currency": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "amount": {
                                                                      "anyOf": [
                                                                        {
                                                                          "type": "number"
                                                                        },
                                                                        {
                                                                          "type": "string",
                                                                          "minLength": 1
                                                                        }
                                                                      ]
                                                                    },
                                                                    "reason": {
                                                                      "type": "string",
                                                                      "maxLength": 200
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "currency",
                                                                    "amount",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "points.reverse"
                                                                    },
                                                                    "currency": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "match": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "event": {
                                                                          "type": "string",
                                                                          "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                                        },
                                                                        "on": {
                                                                          "type": "string",
                                                                          "minLength": 1
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "event",
                                                                        "on"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    },
                                                                    "fraction": {
                                                                      "anyOf": [
                                                                        {
                                                                          "type": "number"
                                                                        },
                                                                        {
                                                                          "type": "string",
                                                                          "minLength": 1
                                                                        }
                                                                      ]
                                                                    },
                                                                    "amount": {
                                                                      "anyOf": [
                                                                        {
                                                                          "type": "number"
                                                                        },
                                                                        {
                                                                          "type": "string",
                                                                          "minLength": 1
                                                                        }
                                                                      ]
                                                                    },
                                                                    "reason": {
                                                                      "type": "string",
                                                                      "maxLength": 200
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "currency",
                                                                    "match",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "reward.issue"
                                                                    },
                                                                    "reward": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "reward",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "tier.evaluate"
                                                                    },
                                                                    "program": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "program",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "attribute.set"
                                                                    },
                                                                    "attribute": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "value": {
                                                                      "type": [
                                                                        "string",
                                                                        "number",
                                                                        "boolean",
                                                                        "null"
                                                                      ]
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "attribute",
                                                                    "value",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "webhook.emit"
                                                                    },
                                                                    "event": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                                    },
                                                                    "payload": {
                                                                      "type": "object",
                                                                      "propertyNames": {
                                                                        "type": "string"
                                                                      },
                                                                      "additionalProperties": {
                                                                        "anyOf": [
                                                                          {
                                                                            "type": [
                                                                              "string",
                                                                              "number",
                                                                              "boolean"
                                                                            ]
                                                                          },
                                                                          {
                                                                            "type": "null"
                                                                          },
                                                                          {
                                                                            "type": "array",
                                                                            "items": {
                                                                              "type": [
                                                                                "string",
                                                                                "number",
                                                                                "boolean"
                                                                              ]
                                                                            }
                                                                          }
                                                                        ]
                                                                      }
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "event",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "badge.grant"
                                                                    },
                                                                    "badge": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "occurrence": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "badge",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "streak.contribute"
                                                                    },
                                                                    "streak": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "value": {
                                                                      "anyOf": [
                                                                        {
                                                                          "type": "number"
                                                                        },
                                                                        {
                                                                          "type": "string",
                                                                          "minLength": 1
                                                                        }
                                                                      ]
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "streak",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "streak.freeze_grant"
                                                                    },
                                                                    "streak": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "quantity": {
                                                                      "type": "integer",
                                                                      "exclusiveMinimum": 0,
                                                                      "maximum": 9007199254740991
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "streak",
                                                                    "quantity",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "quest.contribute"
                                                                    },
                                                                    "quest": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "step": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "value": {
                                                                      "anyOf": [
                                                                        {
                                                                          "type": "number"
                                                                        },
                                                                        {
                                                                          "type": "string",
                                                                          "minLength": 1
                                                                        }
                                                                      ]
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "quest",
                                                                    "step",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "quest.enroll"
                                                                    },
                                                                    "quest": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "quest",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "leaderboard.contribute"
                                                                    },
                                                                    "leaderboard": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "value": {
                                                                      "anyOf": [
                                                                        {
                                                                          "type": "number"
                                                                        },
                                                                        {
                                                                          "type": "string",
                                                                          "minLength": 1
                                                                        }
                                                                      ]
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "leaderboard",
                                                                    "value",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "program.reverse_contribution"
                                                                    },
                                                                    "program": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "source_fact": {
                                                                      "anyOf": [
                                                                        {
                                                                          "type": "object",
                                                                          "properties": {
                                                                            "fact_id": {
                                                                              "type": "string",
                                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                                            }
                                                                          },
                                                                          "required": [
                                                                            "fact_id"
                                                                          ],
                                                                          "additionalProperties": false
                                                                        },
                                                                        {
                                                                          "type": "object",
                                                                          "properties": {
                                                                            "object_type": {
                                                                              "type": "string",
                                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                                            },
                                                                            "key": {
                                                                              "minItems": 1,
                                                                              "type": "array",
                                                                              "items": {
                                                                                "type": "string",
                                                                                "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_-]*(?:\\.[A-Za-z_][A-Za-z0-9_-]*)*$"
                                                                              }
                                                                            }
                                                                          },
                                                                          "required": [
                                                                            "object_type",
                                                                            "key"
                                                                          ],
                                                                          "additionalProperties": false
                                                                        }
                                                                      ]
                                                                    },
                                                                    "fraction": {
                                                                      "type": "string",
                                                                      "pattern": "^(?:0(?:\\.\\d+)?|1(?:\\.0+)?)$"
                                                                    },
                                                                    "amount": {
                                                                      "type": "number",
                                                                      "exclusiveMinimum": 0
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "program",
                                                                    "source_fact",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                }
                                                              ]
                                                            }
                                                          }
                                                        }
                                                      },
                                                      "required": [
                                                        "on"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "display": {
                                                      "type": "object",
                                                      "properties": {
                                                        "title": {
                                                          "type": "string"
                                                        },
                                                        "description": {
                                                          "type": "string"
                                                        },
                                                        "image_url": {
                                                          "type": "string",
                                                          "format": "uri"
                                                        },
                                                        "icon": {
                                                          "type": "string"
                                                        },
                                                        "color": {
                                                          "type": "string"
                                                        },
                                                        "sort_order": {
                                                          "default": 0,
                                                          "type": "integer",
                                                          "minimum": -9007199254740991,
                                                          "maximum": 9007199254740991
                                                        },
                                                        "hidden": {
                                                          "default": false,
                                                          "type": "boolean"
                                                        },
                                                        "locales": {
                                                          "default": {},
                                                          "type": "object",
                                                          "propertyNames": {
                                                            "type": "string",
                                                            "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
                                                          },
                                                          "additionalProperties": {
                                                            "type": "object",
                                                            "properties": {
                                                              "title": {
                                                                "type": "string"
                                                              },
                                                              "description": {
                                                                "type": "string"
                                                              }
                                                            },
                                                            "additionalProperties": false
                                                          }
                                                        }
                                                      },
                                                      "additionalProperties": false
                                                    },
                                                    "enrollment": {
                                                      "type": "object",
                                                      "properties": {
                                                        "mode": {
                                                          "default": "automatic",
                                                          "type": "string",
                                                          "enum": [
                                                            "automatic",
                                                            "explicit"
                                                          ]
                                                        }
                                                      },
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "schema",
                                                    "kind",
                                                    "semantics",
                                                    "definition",
                                                    "qualification",
                                                    "calendar",
                                                    "trust",
                                                    "correction",
                                                    "reward",
                                                    "display",
                                                    "enrollment"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "schema": {
                                                      "type": "string",
                                                      "const": "orishare.program/v2"
                                                    },
                                                    "kind": {
                                                      "type": "string",
                                                      "enum": [
                                                        "tier",
                                                        "quest",
                                                        "campaign",
                                                        "reward",
                                                        "streak",
                                                        "badge",
                                                        "leaderboard",
                                                        "referral"
                                                      ]
                                                    },
                                                    "semantics": {
                                                      "type": "string",
                                                      "const": "native_v2"
                                                    },
                                                    "definition": {
                                                      "oneOf": [
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "streak"
                                                            },
                                                            "qualification": {
                                                              "type": "object",
                                                              "properties": {
                                                                "aggregation": {
                                                                  "type": "string",
                                                                  "enum": [
                                                                    "count",
                                                                    "sum"
                                                                  ]
                                                                },
                                                                "minimum": {
                                                                  "type": "string",
                                                                  "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                                }
                                                              },
                                                              "required": [
                                                                "aggregation",
                                                                "minimum"
                                                              ],
                                                              "additionalProperties": false
                                                            },
                                                            "freezes": {
                                                              "type": "object",
                                                              "properties": {
                                                                "ceiling": {
                                                                  "type": "integer",
                                                                  "minimum": 0,
                                                                  "maximum": 1000
                                                                },
                                                                "auto_use": {
                                                                  "default": true,
                                                                  "type": "boolean"
                                                                },
                                                                "purchase": {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "currency": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "amount_minor": {
                                                                      "type": "string",
                                                                      "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "currency",
                                                                    "amount_minor"
                                                                  ],
                                                                  "additionalProperties": false
                                                                }
                                                              },
                                                              "required": [
                                                                "ceiling"
                                                              ],
                                                              "additionalProperties": false
                                                            },
                                                            "milestones": {
                                                              "maxItems": 64,
                                                              "type": "array",
                                                              "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                  "key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "threshold": {
                                                                    "type": "integer",
                                                                    "minimum": 1,
                                                                    "maximum": 9007199254740991
                                                                  },
                                                                  "occurrence": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                      "lifetime",
                                                                      "episode"
                                                                    ]
                                                                  }
                                                                },
                                                                "required": [
                                                                  "key",
                                                                  "threshold",
                                                                  "occurrence"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            },
                                                            "repair": {
                                                              "type": "object",
                                                              "properties": {
                                                                "price": {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "currency": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "amount_minor": {
                                                                      "type": "string",
                                                                      "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "currency",
                                                                    "amount_minor"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                "window_periods": {
                                                                  "type": "integer",
                                                                  "minimum": 1,
                                                                  "maximum": 30
                                                                },
                                                                "maximum_per_days": {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "count": {
                                                                      "type": "integer",
                                                                      "minimum": 1,
                                                                      "maximum": 1000
                                                                    },
                                                                    "days": {
                                                                      "type": "integer",
                                                                      "minimum": 1,
                                                                      "maximum": 366
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "count",
                                                                    "days"
                                                                  ],
                                                                  "additionalProperties": false
                                                                }
                                                              },
                                                              "required": [
                                                                "price",
                                                                "window_periods"
                                                              ],
                                                              "additionalProperties": false
                                                            },
                                                            "protected_weekdays": {
                                                              "minItems": 1,
                                                              "maxItems": 6,
                                                              "type": "array",
                                                              "items": {
                                                                "type": "integer",
                                                                "minimum": 0,
                                                                "maximum": 6
                                                              }
                                                            }
                                                          },
                                                          "required": [
                                                            "kind",
                                                            "qualification",
                                                            "freezes",
                                                            "milestones"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "badge"
                                                            },
                                                            "qualification": {
                                                              "oneOf": [
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "aggregation": {
                                                                      "type": "string",
                                                                      "const": "count"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "aggregation"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "aggregation": {
                                                                      "type": "string",
                                                                      "const": "sum"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "aggregation"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "aggregation": {
                                                                      "type": "string",
                                                                      "const": "distinct"
                                                                    },
                                                                    "distinct_key": {
                                                                      "type": "string",
                                                                      "maxLength": 255,
                                                                      "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "aggregation",
                                                                    "distinct_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                }
                                                              ],
                                                              "type": "object"
                                                            },
                                                            "ranks": {
                                                              "minItems": 1,
                                                              "maxItems": 64,
                                                              "type": "array",
                                                              "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                  "key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "threshold": {
                                                                    "type": "string",
                                                                    "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                                  },
                                                                  "display": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "title": {
                                                                        "type": "string",
                                                                        "maxLength": 255
                                                                      },
                                                                      "description": {
                                                                        "type": "string",
                                                                        "maxLength": 4096
                                                                      }
                                                                    },
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "key",
                                                                  "threshold"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            },
                                                            "visibility": {
                                                              "type": "string",
                                                              "enum": [
                                                                "visible",
                                                                "hidden_until_earned"
                                                              ]
                                                            },
                                                            "collection": {
                                                              "type": "string",
                                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                            },
                                                            "repeatable": {
                                                              "type": "boolean"
                                                            },
                                                            "occurrence": {
                                                              "oneOf": [
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "lifetime"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "period"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "season"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "verified_fact"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type"
                                                                  ],
                                                                  "additionalProperties": false
                                                                }
                                                              ],
                                                              "type": "object"
                                                            }
                                                          },
                                                          "required": [
                                                            "kind",
                                                            "qualification",
                                                            "ranks",
                                                            "visibility",
                                                            "repeatable",
                                                            "occurrence"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "quest"
                                                            },
                                                            "steps": {
                                                              "minItems": 1,
                                                              "maxItems": 32,
                                                              "type": "array",
                                                              "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                  "key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "aggregation": {
                                                                    "type": "string",
                                                                    "enum": [
                                                                      "count",
                                                                      "sum",
                                                                      "distinct"
                                                                    ]
                                                                  },
                                                                  "target": {
                                                                    "type": "string",
                                                                    "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                                  },
                                                                  "distinct_key": {
                                                                    "type": "string",
                                                                    "maxLength": 255,
                                                                    "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                                                  },
                                                                  "display": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "title": {
                                                                        "type": "string",
                                                                        "maxLength": 255
                                                                      },
                                                                      "description": {
                                                                        "type": "string",
                                                                        "maxLength": 4096
                                                                      }
                                                                    },
                                                                    "additionalProperties": false
                                                                  },
                                                                  "available_from": {
                                                                    "type": "string",
                                                                    "format": "date-time",
                                                                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                                  },
                                                                  "deadline": {
                                                                    "type": "string",
                                                                    "format": "date-time",
                                                                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "key",
                                                                  "aggregation",
                                                                  "target",
                                                                  "display"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            },
                                                            "prerequisites": {
                                                              "maxItems": 64,
                                                              "type": "array",
                                                              "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                  "step": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "requires": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "step",
                                                                  "requires"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            },
                                                            "collection": {
                                                              "type": "string",
                                                              "enum": [
                                                                "auto_collect",
                                                                "claim"
                                                              ]
                                                            },
                                                            "repeatable": {
                                                              "type": "boolean"
                                                            },
                                                            "claim_deadline": {
                                                              "type": "string",
                                                              "format": "date-time",
                                                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                            },
                                                            "chain": {
                                                              "type": "object",
                                                              "properties": {
                                                                "kind": {
                                                                  "type": "string",
                                                                  "const": "program"
                                                                },
                                                                "key": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                },
                                                                "version": {
                                                                  "type": "integer",
                                                                  "minimum": 1,
                                                                  "maximum": 9007199254740991
                                                                },
                                                                "digest": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-f0-9]{64}$"
                                                                }
                                                              },
                                                              "required": [
                                                                "kind",
                                                                "key",
                                                                "version",
                                                                "digest"
                                                              ],
                                                              "additionalProperties": false
                                                            },
                                                            "rotation": {
                                                              "type": "object",
                                                              "properties": {
                                                                "candidates": {
                                                                  "minItems": 1,
                                                                  "maxItems": 100,
                                                                  "type": "array",
                                                                  "items": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "kind": {
                                                                        "type": "string",
                                                                        "const": "program"
                                                                      },
                                                                      "key": {
                                                                        "type": "string",
                                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                      },
                                                                      "version": {
                                                                        "type": "integer",
                                                                        "minimum": 1,
                                                                        "maximum": 9007199254740991
                                                                      },
                                                                      "digest": {
                                                                        "type": "string",
                                                                        "pattern": "^[a-f0-9]{64}$"
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "kind",
                                                                      "key",
                                                                      "version",
                                                                      "digest"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "select": {
                                                                  "type": "integer",
                                                                  "minimum": 1,
                                                                  "maximum": 100
                                                                }
                                                              },
                                                              "required": [
                                                                "candidates",
                                                                "select"
                                                              ],
                                                              "additionalProperties": false
                                                            }
                                                          },
                                                          "required": [
                                                            "kind",
                                                            "steps",
                                                            "prerequisites",
                                                            "collection",
                                                            "repeatable"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "tier"
                                                            },
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                            },
                                                            "basis": {
                                                              "oneOf": [
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "lifetime_earned"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "balance"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "earned_rolling_days"
                                                                    },
                                                                    "days": {
                                                                      "type": "integer",
                                                                      "minimum": 1,
                                                                      "maximum": 9007199254740991
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "days"
                                                                  ],
                                                                  "additionalProperties": false
                                                                }
                                                              ],
                                                              "type": "object"
                                                            },
                                                            "downgrade_check": {
                                                              "type": "string",
                                                              "enum": [
                                                                "daily",
                                                                "monthly",
                                                                "never"
                                                              ]
                                                            },
                                                            "levels": {
                                                              "minItems": 1,
                                                              "maxItems": 1000,
                                                              "type": "array",
                                                              "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                  "key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "threshold": {
                                                                    "type": "string",
                                                                    "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                                  },
                                                                  "display": {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "title": {
                                                                        "type": "string",
                                                                        "maxLength": 255
                                                                      },
                                                                      "description": {
                                                                        "type": "string",
                                                                        "maxLength": 4096
                                                                      }
                                                                    },
                                                                    "additionalProperties": false
                                                                  }
                                                                },
                                                                "required": [
                                                                  "key",
                                                                  "threshold",
                                                                  "display"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            },
                                                            "occurrence": {
                                                              "oneOf": [
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "lifetime"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "season"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "prestige"
                                                                    },
                                                                    "maximum_runs": {
                                                                      "type": "integer",
                                                                      "minimum": 1,
                                                                      "maximum": 9007199254740991
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "maximum_runs"
                                                                  ],
                                                                  "additionalProperties": false
                                                                }
                                                              ],
                                                              "type": "object"
                                                            }
                                                          },
                                                          "required": [
                                                            "kind",
                                                            "currency",
                                                            "basis",
                                                            "downgrade_check",
                                                            "levels",
                                                            "occurrence"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "leaderboard"
                                                            },
                                                            "aggregation": {
                                                              "type": "string",
                                                              "enum": [
                                                                "sum",
                                                                "max",
                                                                "latest_verified"
                                                              ]
                                                            },
                                                            "input": {
                                                              "type": "object",
                                                              "properties": {
                                                                "minimum": {
                                                                  "type": "string",
                                                                  "pattern": "^(0|-?[1-9][0-9]{0,18})$"
                                                                },
                                                                "maximum": {
                                                                  "type": "string",
                                                                  "pattern": "^(0|-?[1-9][0-9]{0,18})$"
                                                                }
                                                              },
                                                              "required": [
                                                                "minimum",
                                                                "maximum"
                                                              ],
                                                              "additionalProperties": false
                                                            },
                                                            "order": {
                                                              "type": "string",
                                                              "enum": [
                                                                "ascending",
                                                                "descending"
                                                              ]
                                                            },
                                                            "scope": {
                                                              "oneOf": [
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "global"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "segment"
                                                                    },
                                                                    "segment": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "segment"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "group_key"
                                                                    },
                                                                    "key": {
                                                                      "type": "string",
                                                                      "maxLength": 255,
                                                                      "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                }
                                                              ],
                                                              "type": "object"
                                                            },
                                                            "rank": {
                                                              "type": "string",
                                                              "const": "ordinal"
                                                            },
                                                            "privacy": {
                                                              "type": "object",
                                                              "properties": {
                                                                "display": {
                                                                  "type": "string",
                                                                  "const": "pseudonymous"
                                                                },
                                                                "opt_out": {
                                                                  "type": "boolean",
                                                                  "const": true
                                                                },
                                                                "anonymous_entries": {
                                                                  "type": "boolean",
                                                                  "const": false
                                                                }
                                                              },
                                                              "required": [
                                                                "display",
                                                                "opt_out",
                                                                "anonymous_entries"
                                                              ],
                                                              "additionalProperties": false
                                                            },
                                                            "prizes": {
                                                              "maxItems": 100,
                                                              "type": "array",
                                                              "items": {
                                                                "type": "object",
                                                                "properties": {
                                                                  "key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "from": {
                                                                    "type": "integer",
                                                                    "minimum": 1,
                                                                    "maximum": 1000
                                                                  },
                                                                  "through": {
                                                                    "type": "integer",
                                                                    "minimum": 1,
                                                                    "maximum": 1000
                                                                  },
                                                                  "awards": {
                                                                    "minItems": 1,
                                                                    "maxItems": 16,
                                                                    "type": "array",
                                                                    "items": {
                                                                      "oneOf": [
                                                                        {
                                                                          "type": "object",
                                                                          "properties": {
                                                                            "currency": {
                                                                              "type": "string",
                                                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                            },
                                                                            "amount_minor": {
                                                                              "type": "string",
                                                                              "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                                            },
                                                                            "type": {
                                                                              "type": "string",
                                                                              "const": "currency"
                                                                            }
                                                                          },
                                                                          "required": [
                                                                            "currency",
                                                                            "amount_minor",
                                                                            "type"
                                                                          ],
                                                                          "additionalProperties": false
                                                                        },
                                                                        {
                                                                          "type": "object",
                                                                          "properties": {
                                                                            "type": {
                                                                              "type": "string",
                                                                              "const": "reward"
                                                                            },
                                                                            "reward": {
                                                                              "type": "string",
                                                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                            },
                                                                            "quantity": {
                                                                              "type": "number",
                                                                              "const": 1
                                                                            }
                                                                          },
                                                                          "required": [
                                                                            "type",
                                                                            "reward",
                                                                            "quantity"
                                                                          ],
                                                                          "additionalProperties": false
                                                                        },
                                                                        {
                                                                          "type": "object",
                                                                          "properties": {
                                                                            "type": {
                                                                              "type": "string",
                                                                              "const": "item"
                                                                            },
                                                                            "item": {
                                                                              "type": "string",
                                                                              "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                                            },
                                                                            "quantity": {
                                                                              "type": "integer",
                                                                              "minimum": 1,
                                                                              "maximum": 1000
                                                                            }
                                                                          },
                                                                          "required": [
                                                                            "type",
                                                                            "item",
                                                                            "quantity"
                                                                          ],
                                                                          "additionalProperties": false
                                                                        }
                                                                      ],
                                                                      "type": "object"
                                                                    }
                                                                  }
                                                                },
                                                                "required": [
                                                                  "key",
                                                                  "from",
                                                                  "through",
                                                                  "awards"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            },
                                                            "score_source": {
                                                              "oneOf": [
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "contributions"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "currency_earned"
                                                                    },
                                                                    "currency": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "currency"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "currency_balance"
                                                                    },
                                                                    "currency": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "currency"
                                                                  ],
                                                                  "additionalProperties": false
                                                                }
                                                              ],
                                                              "type": "object"
                                                            }
                                                          },
                                                          "required": [
                                                            "kind",
                                                            "aggregation",
                                                            "input",
                                                            "order",
                                                            "scope",
                                                            "rank",
                                                            "privacy",
                                                            "prizes"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "referral"
                                                            },
                                                            "attribution_window_seconds": {
                                                              "type": "integer",
                                                              "minimum": 1,
                                                              "maximum": 9007199254740991
                                                            },
                                                            "account_eligibility": {
                                                              "type": "string",
                                                              "enum": [
                                                                "new",
                                                                "existing",
                                                                "any"
                                                              ]
                                                            },
                                                            "new_account_window_seconds": {
                                                              "type": "integer",
                                                              "minimum": 1,
                                                              "maximum": 9007199254740991
                                                            },
                                                            "allow_anonymous_claim": {
                                                              "type": "boolean"
                                                            },
                                                            "qualifying_event": {
                                                              "type": "string",
                                                              "maxLength": 255,
                                                              "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                            },
                                                            "minimum": {
                                                              "type": "object",
                                                              "properties": {
                                                                "currency": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                },
                                                                "amount_minor": {
                                                                  "type": "string",
                                                                  "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                                }
                                                              },
                                                              "required": [
                                                                "currency",
                                                                "amount_minor"
                                                              ],
                                                              "additionalProperties": false
                                                            },
                                                            "cooling_off_seconds": {
                                                              "type": "integer",
                                                              "minimum": 0,
                                                              "maximum": 9007199254740991
                                                            },
                                                            "rewards": {
                                                              "type": "object",
                                                              "properties": {
                                                                "referrer": {
                                                                  "minItems": 1,
                                                                  "maxItems": 16,
                                                                  "type": "array",
                                                                  "items": {
                                                                    "oneOf": [
                                                                      {
                                                                        "type": "object",
                                                                        "properties": {
                                                                          "currency": {
                                                                            "type": "string",
                                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                          },
                                                                          "amount_minor": {
                                                                            "type": "string",
                                                                            "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                                          },
                                                                          "type": {
                                                                            "type": "string",
                                                                            "const": "currency"
                                                                          }
                                                                        },
                                                                        "required": [
                                                                          "currency",
                                                                          "amount_minor",
                                                                          "type"
                                                                        ],
                                                                        "additionalProperties": false
                                                                      },
                                                                      {
                                                                        "type": "object",
                                                                        "properties": {
                                                                          "type": {
                                                                            "type": "string",
                                                                            "const": "reward"
                                                                          },
                                                                          "reward": {
                                                                            "type": "string",
                                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                          },
                                                                          "quantity": {
                                                                            "type": "number",
                                                                            "const": 1
                                                                          }
                                                                        },
                                                                        "required": [
                                                                          "type",
                                                                          "reward",
                                                                          "quantity"
                                                                        ],
                                                                        "additionalProperties": false
                                                                      },
                                                                      {
                                                                        "type": "object",
                                                                        "properties": {
                                                                          "type": {
                                                                            "type": "string",
                                                                            "const": "item"
                                                                          },
                                                                          "item": {
                                                                            "type": "string",
                                                                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                                          },
                                                                          "quantity": {
                                                                            "type": "integer",
                                                                            "minimum": 1,
                                                                            "maximum": 1000
                                                                          }
                                                                        },
                                                                        "required": [
                                                                          "type",
                                                                          "item",
                                                                          "quantity"
                                                                        ],
                                                                        "additionalProperties": false
                                                                      }
                                                                    ],
                                                                    "type": "object"
                                                                  }
                                                                },
                                                                "referred": {
                                                                  "minItems": 1,
                                                                  "maxItems": 16,
                                                                  "type": "array",
                                                                  "items": {
                                                                    "oneOf": [
                                                                      {
                                                                        "type": "object",
                                                                        "properties": {
                                                                          "currency": {
                                                                            "type": "string",
                                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                          },
                                                                          "amount_minor": {
                                                                            "type": "string",
                                                                            "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                                          },
                                                                          "type": {
                                                                            "type": "string",
                                                                            "const": "currency"
                                                                          }
                                                                        },
                                                                        "required": [
                                                                          "currency",
                                                                          "amount_minor",
                                                                          "type"
                                                                        ],
                                                                        "additionalProperties": false
                                                                      },
                                                                      {
                                                                        "type": "object",
                                                                        "properties": {
                                                                          "type": {
                                                                            "type": "string",
                                                                            "const": "reward"
                                                                          },
                                                                          "reward": {
                                                                            "type": "string",
                                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                          },
                                                                          "quantity": {
                                                                            "type": "number",
                                                                            "const": 1
                                                                          }
                                                                        },
                                                                        "required": [
                                                                          "type",
                                                                          "reward",
                                                                          "quantity"
                                                                        ],
                                                                        "additionalProperties": false
                                                                      },
                                                                      {
                                                                        "type": "object",
                                                                        "properties": {
                                                                          "type": {
                                                                            "type": "string",
                                                                            "const": "item"
                                                                          },
                                                                          "item": {
                                                                            "type": "string",
                                                                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                                          },
                                                                          "quantity": {
                                                                            "type": "integer",
                                                                            "minimum": 1,
                                                                            "maximum": 1000
                                                                          }
                                                                        },
                                                                        "required": [
                                                                          "type",
                                                                          "item",
                                                                          "quantity"
                                                                        ],
                                                                        "additionalProperties": false
                                                                      }
                                                                    ],
                                                                    "type": "object"
                                                                  }
                                                                }
                                                              },
                                                              "required": [
                                                                "referrer",
                                                                "referred"
                                                              ],
                                                              "additionalProperties": false
                                                            },
                                                            "caps": {
                                                              "type": "object",
                                                              "properties": {
                                                                "per_referrer": {
                                                                  "type": "integer",
                                                                  "minimum": 1,
                                                                  "maximum": 9007199254740991
                                                                },
                                                                "per_environment": {
                                                                  "type": "integer",
                                                                  "minimum": 1,
                                                                  "maximum": 9007199254740991
                                                                }
                                                              },
                                                              "required": [
                                                                "per_referrer",
                                                                "per_environment"
                                                              ],
                                                              "additionalProperties": false
                                                            },
                                                            "refund": {
                                                              "type": "string",
                                                              "const": "proportional_then_invalidate"
                                                            },
                                                            "approval": {
                                                              "oneOf": [
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "mode": {
                                                                      "type": "string",
                                                                      "const": "review"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "mode"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "mode": {
                                                                      "type": "string",
                                                                      "const": "automatic"
                                                                    },
                                                                    "period_seconds": {
                                                                      "type": "integer",
                                                                      "minimum": 1,
                                                                      "maximum": 2678400
                                                                    },
                                                                    "max_per_referrer_per_period": {
                                                                      "type": "integer",
                                                                      "minimum": 1,
                                                                      "maximum": 9007199254740991
                                                                    },
                                                                    "max_per_period": {
                                                                      "type": "integer",
                                                                      "minimum": 1,
                                                                      "maximum": 9007199254740991
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "mode",
                                                                    "period_seconds",
                                                                    "max_per_referrer_per_period",
                                                                    "max_per_period"
                                                                  ],
                                                                  "additionalProperties": false
                                                                }
                                                              ],
                                                              "type": "object"
                                                            }
                                                          },
                                                          "required": [
                                                            "kind",
                                                            "attribution_window_seconds",
                                                            "account_eligibility",
                                                            "allow_anonymous_claim",
                                                            "qualifying_event",
                                                            "minimum",
                                                            "cooling_off_seconds",
                                                            "rewards",
                                                            "caps",
                                                            "refund"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "campaign"
                                                            },
                                                            "priority": {
                                                              "type": "integer",
                                                              "minimum": -2147483648,
                                                              "maximum": 2147483647
                                                            }
                                                          },
                                                          "required": [
                                                            "kind",
                                                            "priority"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "reward"
                                                            },
                                                            "reward": {
                                                              "type": "string",
                                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                            }
                                                          },
                                                          "required": [
                                                            "kind",
                                                            "reward"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      ],
                                                      "type": "object"
                                                    },
                                                    "qualification": {
                                                      "type": "object",
                                                      "properties": {
                                                        "sources": {
                                                          "type": "array",
                                                          "items": {
                                                            "type": "object",
                                                            "properties": {
                                                              "event": {
                                                                "type": "string",
                                                                "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                              },
                                                              "conditions": {
                                                                "$ref": "#/components/schemas/__schema3"
                                                              },
                                                              "value": {
                                                                "anyOf": [
                                                                  {
                                                                    "type": "number"
                                                                  },
                                                                  {
                                                                    "type": "string",
                                                                    "minLength": 1
                                                                  }
                                                                ]
                                                              },
                                                              "step": {
                                                                "type": "string",
                                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                              },
                                                              "occurrence": {
                                                                "default": "lifetime",
                                                                "type": "string",
                                                                "enum": [
                                                                  "lifetime",
                                                                  "period"
                                                                ]
                                                              }
                                                            },
                                                            "required": [
                                                              "event"
                                                            ],
                                                            "additionalProperties": false
                                                          }
                                                        },
                                                        "audience": {
                                                          "type": "array",
                                                          "items": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                          }
                                                        },
                                                        "starts_at": {
                                                          "type": "string",
                                                          "format": "date-time",
                                                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                        },
                                                        "ends_at": {
                                                          "type": "string",
                                                          "format": "date-time",
                                                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                        },
                                                        "campaign": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        }
                                                      },
                                                      "required": [
                                                        "sources"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "calendar": {
                                                      "type": "object",
                                                      "properties": {
                                                        "schema": {
                                                          "type": "string",
                                                          "const": "orishare.calendar/v1"
                                                        },
                                                        "period": {
                                                          "anyOf": [
                                                            {
                                                              "type": "string",
                                                              "enum": [
                                                                "none",
                                                                "day",
                                                                "week",
                                                                "month",
                                                                "year"
                                                              ]
                                                            },
                                                            {
                                                              "type": "object",
                                                              "properties": {
                                                                "kind": {
                                                                  "type": "string",
                                                                  "const": "season"
                                                                },
                                                                "starts_at": {
                                                                  "type": "string",
                                                                  "format": "date-time",
                                                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                                },
                                                                "ends_at": {
                                                                  "type": "string",
                                                                  "format": "date-time",
                                                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                                }
                                                              },
                                                              "required": [
                                                                "kind",
                                                                "starts_at",
                                                                "ends_at"
                                                              ],
                                                              "additionalProperties": false
                                                            }
                                                          ]
                                                        },
                                                        "run_per_period": {
                                                          "type": "boolean"
                                                        },
                                                        "timezone_source": {
                                                          "type": "string",
                                                          "enum": [
                                                            "environment",
                                                            "customer",
                                                            "fixed"
                                                          ]
                                                        },
                                                        "timezone": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        "day_start_offset_minutes": {
                                                          "default": 0,
                                                          "type": "integer",
                                                          "minimum": 0,
                                                          "maximum": 1439
                                                        },
                                                        "ambiguous_local_time": {
                                                          "type": "string",
                                                          "const": "earlier"
                                                        },
                                                        "nonexistent_local_time": {
                                                          "type": "string",
                                                          "const": "next_valid"
                                                        },
                                                        "event_time": {
                                                          "type": "object",
                                                          "properties": {
                                                            "merchant": {
                                                              "type": "string",
                                                              "const": "occurred_at"
                                                            },
                                                            "client": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "string",
                                                                  "const": "received_at"
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "offline_seconds": {
                                                                      "type": "integer",
                                                                      "minimum": 0,
                                                                      "maximum": 9007199254740991
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "offline_seconds"
                                                                  ],
                                                                  "additionalProperties": false
                                                                }
                                                              ]
                                                            }
                                                          },
                                                          "required": [
                                                            "merchant",
                                                            "client"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        "grace_seconds": {
                                                          "default": 0,
                                                          "type": "integer",
                                                          "minimum": 0,
                                                          "maximum": 9007199254740991
                                                        },
                                                        "max_lateness_seconds": {
                                                          "default": 0,
                                                          "type": "integer",
                                                          "minimum": 0,
                                                          "maximum": 9007199254740991
                                                        },
                                                        "settlement_delay_seconds": {
                                                          "default": 0,
                                                          "type": "integer",
                                                          "minimum": 0,
                                                          "maximum": 9007199254740991
                                                        },
                                                        "after_finalization": {
                                                          "type": "string",
                                                          "const": "correction_only"
                                                        }
                                                      },
                                                      "required": [
                                                        "schema",
                                                        "period",
                                                        "run_per_period",
                                                        "timezone_source",
                                                        "ambiguous_local_time",
                                                        "nonexistent_local_time",
                                                        "event_time",
                                                        "after_finalization"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "trust": {
                                                      "type": "object",
                                                      "properties": {
                                                        "minimum_trust": {
                                                          "type": "string",
                                                          "enum": [
                                                            "anonymous_claim",
                                                            "customer_claim",
                                                            "merchant_asserted",
                                                            "verified_evidence",
                                                            "legacy_unknown"
                                                          ]
                                                        },
                                                        "allowed_sources": {
                                                          "minItems": 1,
                                                          "type": "array",
                                                          "items": {
                                                            "type": "string",
                                                            "enum": [
                                                              "publishable_event",
                                                              "secret_key_event",
                                                              "verified_connector",
                                                              "operator_command",
                                                              "customer_command",
                                                              "import",
                                                              "program_transition",
                                                              "schedule"
                                                            ]
                                                          }
                                                        },
                                                        "on_insufficient": {
                                                          "type": "string",
                                                          "enum": [
                                                            "ignore",
                                                            "progress_without_reward"
                                                          ]
                                                        },
                                                        "liability_caps": {
                                                          "type": "array",
                                                          "items": {
                                                            "type": "object",
                                                            "properties": {
                                                              "trust": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "anonymous_claim",
                                                                  "customer_claim",
                                                                  "merchant_asserted",
                                                                  "verified_evidence",
                                                                  "legacy_unknown"
                                                                ]
                                                              },
                                                              "currency": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "scope": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "customer",
                                                                  "environment"
                                                                ]
                                                              },
                                                              "window": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "day",
                                                                  "month",
                                                                  "lifetime"
                                                                ]
                                                              },
                                                              "maximum_minor": {
                                                                "type": "integer",
                                                                "minimum": 0,
                                                                "maximum": 9007199254740991
                                                              }
                                                            },
                                                            "required": [
                                                              "trust",
                                                              "currency",
                                                              "scope",
                                                              "window",
                                                              "maximum_minor"
                                                            ],
                                                            "additionalProperties": false
                                                          }
                                                        },
                                                        "recognition_caps": {
                                                          "type": "array",
                                                          "items": {
                                                            "type": "object",
                                                            "properties": {
                                                              "trust": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "anonymous_claim",
                                                                  "customer_claim",
                                                                  "merchant_asserted",
                                                                  "verified_evidence",
                                                                  "legacy_unknown"
                                                                ]
                                                              },
                                                              "per": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "period",
                                                                  "day"
                                                                ]
                                                              },
                                                              "contributions": {
                                                                "type": "integer",
                                                                "exclusiveMinimum": 0,
                                                                "maximum": 9007199254740991
                                                              },
                                                              "value": {
                                                                "type": "integer",
                                                                "exclusiveMinimum": 0,
                                                                "maximum": 9007199254740991
                                                              }
                                                            },
                                                            "required": [
                                                              "trust",
                                                              "per"
                                                            ],
                                                            "additionalProperties": false
                                                          }
                                                        },
                                                        "allow_legacy_unknown": {
                                                          "type": "boolean",
                                                          "const": false
                                                        }
                                                      },
                                                      "required": [
                                                        "minimum_trust",
                                                        "allowed_sources",
                                                        "on_insufficient",
                                                        "liability_caps",
                                                        "recognition_caps",
                                                        "allow_legacy_unknown"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "correction": {
                                                      "type": "object",
                                                      "properties": {
                                                        "qualification": {
                                                          "default": "reverse",
                                                          "type": "string",
                                                          "enum": [
                                                            "reverse",
                                                            "keep"
                                                          ]
                                                        },
                                                        "spendable": {
                                                          "type": "string",
                                                          "const": "reverse"
                                                        },
                                                        "xp": {
                                                          "default": "reverse",
                                                          "type": "string",
                                                          "enum": [
                                                            "reverse",
                                                            "keep"
                                                          ]
                                                        },
                                                        "recognition": {
                                                          "default": "keep",
                                                          "type": "string",
                                                          "enum": [
                                                            "keep",
                                                            "revoke_on_fraud"
                                                          ]
                                                        },
                                                        "after_finalization": {
                                                          "default": "correcting_revision",
                                                          "type": "string",
                                                          "const": "correcting_revision"
                                                        },
                                                        "allowance_on_refund": {
                                                          "default": "consumed",
                                                          "type": "string",
                                                          "enum": [
                                                            "consumed",
                                                            "release_on_verified_void"
                                                          ]
                                                        }
                                                      },
                                                      "required": [
                                                        "spendable"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "reward": {
                                                      "type": "object",
                                                      "properties": {
                                                        "on": {
                                                          "type": "object",
                                                          "propertyNames": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]*(?::[a-z0-9_]+)?$"
                                                          },
                                                          "additionalProperties": {
                                                            "type": "array",
                                                            "items": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "points.award"
                                                                    },
                                                                    "currency": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "amount": {
                                                                      "anyOf": [
                                                                        {
                                                                          "type": "number"
                                                                        },
                                                                        {
                                                                          "type": "string",
                                                                          "minLength": 1
                                                                        }
                                                                      ]
                                                                    },
                                                                    "reason": {
                                                                      "type": "string",
                                                                      "maxLength": 200
                                                                    },
                                                                    "confirm_after": {
                                                                      "type": "string",
                                                                      "pattern": "^\\d+[smhdw]$"
                                                                    },
                                                                    "expires_after": {
                                                                      "type": "string",
                                                                      "pattern": "^\\d+[smhdw]$"
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "currency",
                                                                    "amount",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "points.deduct"
                                                                    },
                                                                    "currency": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "amount": {
                                                                      "anyOf": [
                                                                        {
                                                                          "type": "number"
                                                                        },
                                                                        {
                                                                          "type": "string",
                                                                          "minLength": 1
                                                                        }
                                                                      ]
                                                                    },
                                                                    "reason": {
                                                                      "type": "string",
                                                                      "maxLength": 200
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "currency",
                                                                    "amount",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "points.reverse"
                                                                    },
                                                                    "currency": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "match": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "event": {
                                                                          "type": "string",
                                                                          "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                                        },
                                                                        "on": {
                                                                          "type": "string",
                                                                          "minLength": 1
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "event",
                                                                        "on"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    },
                                                                    "fraction": {
                                                                      "anyOf": [
                                                                        {
                                                                          "type": "number"
                                                                        },
                                                                        {
                                                                          "type": "string",
                                                                          "minLength": 1
                                                                        }
                                                                      ]
                                                                    },
                                                                    "amount": {
                                                                      "anyOf": [
                                                                        {
                                                                          "type": "number"
                                                                        },
                                                                        {
                                                                          "type": "string",
                                                                          "minLength": 1
                                                                        }
                                                                      ]
                                                                    },
                                                                    "reason": {
                                                                      "type": "string",
                                                                      "maxLength": 200
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "currency",
                                                                    "match",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "reward.issue"
                                                                    },
                                                                    "reward": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "reward",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "tier.evaluate"
                                                                    },
                                                                    "program": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "program",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "attribute.set"
                                                                    },
                                                                    "attribute": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "value": {
                                                                      "type": [
                                                                        "string",
                                                                        "number",
                                                                        "boolean",
                                                                        "null"
                                                                      ]
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "attribute",
                                                                    "value",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "webhook.emit"
                                                                    },
                                                                    "event": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                                    },
                                                                    "payload": {
                                                                      "type": "object",
                                                                      "propertyNames": {
                                                                        "type": "string"
                                                                      },
                                                                      "additionalProperties": {
                                                                        "anyOf": [
                                                                          {
                                                                            "type": [
                                                                              "string",
                                                                              "number",
                                                                              "boolean"
                                                                            ]
                                                                          },
                                                                          {
                                                                            "type": "null"
                                                                          },
                                                                          {
                                                                            "type": "array",
                                                                            "items": {
                                                                              "type": [
                                                                                "string",
                                                                                "number",
                                                                                "boolean"
                                                                              ]
                                                                            }
                                                                          }
                                                                        ]
                                                                      }
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "event",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "badge.contribute"
                                                                    },
                                                                    "badge": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "value": {
                                                                      "anyOf": [
                                                                        {
                                                                          "type": "number"
                                                                        },
                                                                        {
                                                                          "type": "string",
                                                                          "minLength": 1
                                                                        }
                                                                      ]
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "badge",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "badge.grant"
                                                                    },
                                                                    "badge": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "rank": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "occurrence": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "badge",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "streak.contribute"
                                                                    },
                                                                    "streak": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "value": {
                                                                      "anyOf": [
                                                                        {
                                                                          "type": "number"
                                                                        },
                                                                        {
                                                                          "type": "string",
                                                                          "minLength": 1
                                                                        }
                                                                      ]
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "streak",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "streak.freeze_grant"
                                                                    },
                                                                    "streak": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "quantity": {
                                                                      "type": "integer",
                                                                      "exclusiveMinimum": 0,
                                                                      "maximum": 9007199254740991
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "streak",
                                                                    "quantity",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "quest.contribute"
                                                                    },
                                                                    "quest": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "step": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "value": {
                                                                      "anyOf": [
                                                                        {
                                                                          "type": "number"
                                                                        },
                                                                        {
                                                                          "type": "string",
                                                                          "minLength": 1
                                                                        }
                                                                      ]
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "quest",
                                                                    "step",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "quest.enroll"
                                                                    },
                                                                    "quest": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "quest",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "leaderboard.contribute"
                                                                    },
                                                                    "leaderboard": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "value": {
                                                                      "anyOf": [
                                                                        {
                                                                          "type": "number"
                                                                        },
                                                                        {
                                                                          "type": "string",
                                                                          "minLength": 1
                                                                        }
                                                                      ]
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "leaderboard",
                                                                    "value",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "program.reverse_contribution"
                                                                    },
                                                                    "program": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "source_fact": {
                                                                      "anyOf": [
                                                                        {
                                                                          "type": "object",
                                                                          "properties": {
                                                                            "fact_id": {
                                                                              "type": "string",
                                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                                            }
                                                                          },
                                                                          "required": [
                                                                            "fact_id"
                                                                          ],
                                                                          "additionalProperties": false
                                                                        },
                                                                        {
                                                                          "type": "object",
                                                                          "properties": {
                                                                            "object_type": {
                                                                              "type": "string",
                                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                                            },
                                                                            "key": {
                                                                              "minItems": 1,
                                                                              "type": "array",
                                                                              "items": {
                                                                                "type": "string",
                                                                                "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_-]*(?:\\.[A-Za-z_][A-Za-z0-9_-]*)*$"
                                                                              }
                                                                            }
                                                                          },
                                                                          "required": [
                                                                            "object_type",
                                                                            "key"
                                                                          ],
                                                                          "additionalProperties": false
                                                                        }
                                                                      ]
                                                                    },
                                                                    "fraction": {
                                                                      "type": "string",
                                                                      "pattern": "^(?:0(?:\\.\\d+)?|1(?:\\.0+)?)$"
                                                                    },
                                                                    "amount": {
                                                                      "type": "number",
                                                                      "exclusiveMinimum": 0
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "program",
                                                                    "source_fact",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "coupon.issue"
                                                                    },
                                                                    "offer": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "key": {
                                                                          "type": "string",
                                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                        },
                                                                        "version": {
                                                                          "type": "integer",
                                                                          "minimum": 1,
                                                                          "maximum": 9007199254740991
                                                                        },
                                                                        "digest": {
                                                                          "type": "string",
                                                                          "pattern": "^[a-f0-9]{64}$"
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "key",
                                                                        "version",
                                                                        "digest"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "offer",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "discount.quote"
                                                                    },
                                                                    "offer": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "key": {
                                                                          "type": "string",
                                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                        },
                                                                        "version": {
                                                                          "type": "integer",
                                                                          "minimum": 1,
                                                                          "maximum": 9007199254740991
                                                                        },
                                                                        "digest": {
                                                                          "type": "string",
                                                                          "pattern": "^[a-f0-9]{64}$"
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "key",
                                                                        "version",
                                                                        "digest"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "offer",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "type": {
                                                                      "type": "string",
                                                                      "const": "item.grant"
                                                                    },
                                                                    "item": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                                    },
                                                                    "quantity": {
                                                                      "default": 1,
                                                                      "type": "integer",
                                                                      "minimum": 1,
                                                                      "maximum": 1000
                                                                    },
                                                                    "effect_key": {
                                                                      "type": "string",
                                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                    },
                                                                    "liability": {
                                                                      "type": "object",
                                                                      "properties": {
                                                                        "currency": {
                                                                          "type": "string",
                                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                                        },
                                                                        "amount_minor": {
                                                                          "type": "integer",
                                                                          "exclusiveMinimum": 0,
                                                                          "maximum": 9007199254740991
                                                                        }
                                                                      },
                                                                      "required": [
                                                                        "currency",
                                                                        "amount_minor"
                                                                      ],
                                                                      "additionalProperties": false
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "type",
                                                                    "item",
                                                                    "effect_key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                }
                                                              ]
                                                            }
                                                          }
                                                        }
                                                      },
                                                      "required": [
                                                        "on"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "display": {
                                                      "type": "object",
                                                      "properties": {
                                                        "title": {
                                                          "type": "string"
                                                        },
                                                        "description": {
                                                          "type": "string"
                                                        },
                                                        "image_url": {
                                                          "type": "string",
                                                          "format": "uri"
                                                        },
                                                        "icon": {
                                                          "type": "string"
                                                        },
                                                        "color": {
                                                          "type": "string"
                                                        },
                                                        "sort_order": {
                                                          "default": 0,
                                                          "type": "integer",
                                                          "minimum": -9007199254740991,
                                                          "maximum": 9007199254740991
                                                        },
                                                        "hidden": {
                                                          "default": false,
                                                          "type": "boolean"
                                                        },
                                                        "locales": {
                                                          "default": {},
                                                          "type": "object",
                                                          "propertyNames": {
                                                            "type": "string",
                                                            "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
                                                          },
                                                          "additionalProperties": {
                                                            "type": "object",
                                                            "properties": {
                                                              "title": {
                                                                "type": "string"
                                                              },
                                                              "description": {
                                                                "type": "string"
                                                              }
                                                            },
                                                            "additionalProperties": false
                                                          }
                                                        }
                                                      },
                                                      "additionalProperties": false
                                                    },
                                                    "enrollment": {
                                                      "type": "object",
                                                      "properties": {
                                                        "mode": {
                                                          "default": "automatic",
                                                          "type": "string",
                                                          "enum": [
                                                            "automatic",
                                                            "explicit"
                                                          ]
                                                        }
                                                      },
                                                      "additionalProperties": false
                                                    },
                                                    "season": {
                                                      "type": "object",
                                                      "properties": {
                                                        "kind": {
                                                          "type": "string",
                                                          "const": "season"
                                                        },
                                                        "key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "version": {
                                                          "type": "integer",
                                                          "minimum": 1,
                                                          "maximum": 9007199254740991
                                                        },
                                                        "digest": {
                                                          "type": "string",
                                                          "pattern": "^[a-f0-9]{64}$"
                                                        }
                                                      },
                                                      "required": [
                                                        "kind",
                                                        "key",
                                                        "version",
                                                        "digest"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "dependencies": {
                                                      "default": [],
                                                      "maxItems": 64,
                                                      "type": "array",
                                                      "items": {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "enum": [
                                                              "program",
                                                              "currency",
                                                              "season",
                                                              "reward",
                                                              "counter",
                                                              "segment",
                                                              "campaign",
                                                              "offer",
                                                              "asset"
                                                            ]
                                                          },
                                                          "key": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                          },
                                                          "version": {
                                                            "type": "integer",
                                                            "minimum": 1,
                                                            "maximum": 9007199254740991
                                                          },
                                                          "digest": {
                                                            "type": "string",
                                                            "pattern": "^[a-f0-9]{64}$"
                                                          }
                                                        },
                                                        "required": [
                                                          "kind",
                                                          "key",
                                                          "version",
                                                          "digest"
                                                        ],
                                                        "additionalProperties": false
                                                      }
                                                    }
                                                  },
                                                  "required": [
                                                    "schema",
                                                    "kind",
                                                    "semantics",
                                                    "definition",
                                                    "qualification",
                                                    "calendar",
                                                    "trust",
                                                    "correction",
                                                    "reward",
                                                    "display",
                                                    "enrollment"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ]
                                            },
                                            "bindings": {
                                              "default": [],
                                              "maxItems": 256,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "path": {
                                                    "minItems": 1,
                                                    "maxItems": 32,
                                                    "type": "array",
                                                    "items": {
                                                      "anyOf": [
                                                        {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        {
                                                          "type": "integer",
                                                          "minimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      ]
                                                    }
                                                  },
                                                  "kind": {
                                                    "type": "string",
                                                    "enum": [
                                                      "program",
                                                      "currency",
                                                      "rule",
                                                      "tier_level"
                                                    ]
                                                  },
                                                  "key": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 255
                                                  }
                                                },
                                                "required": [
                                                  "path",
                                                  "kind",
                                                  "key"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "dependencies": {
                                              "maxItems": 64,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "kind": {
                                                    "type": "string",
                                                    "enum": [
                                                      "program",
                                                      "currency",
                                                      "reward",
                                                      "season",
                                                      "event_definition",
                                                      "counter_definition",
                                                      "segment",
                                                      "campaign"
                                                    ]
                                                  },
                                                  "key": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 255
                                                  },
                                                  "usage": {
                                                    "type": "string",
                                                    "enum": [
                                                      "qualification",
                                                      "reward",
                                                      "presentation",
                                                      "transition"
                                                    ]
                                                  },
                                                  "version": {
                                                    "type": "integer",
                                                    "exclusiveMinimum": 0,
                                                    "maximum": 9007199254740991
                                                  },
                                                  "digest": {
                                                    "type": "string",
                                                    "pattern": "^[a-f0-9]{64}$"
                                                  },
                                                  "currency_terms": {
                                                    "type": "object",
                                                    "properties": {
                                                      "version": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      },
                                                      "code": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      },
                                                      "name": {
                                                        "type": "string",
                                                        "minLength": 1,
                                                        "maxLength": 255
                                                      },
                                                      "precision": {
                                                        "type": "integer",
                                                        "minimum": 0,
                                                        "maximum": 6
                                                      },
                                                      "expiration_policy": {
                                                        "type": "object",
                                                        "properties": {
                                                          "type": {
                                                            "type": "string",
                                                            "enum": [
                                                              "never",
                                                              "days"
                                                            ]
                                                          },
                                                          "days": {
                                                            "type": "integer",
                                                            "exclusiveMinimum": 0,
                                                            "maximum": 9007199254740991
                                                          }
                                                        },
                                                        "required": [
                                                          "type"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      "negative_balance": {
                                                        "type": "string",
                                                        "enum": [
                                                          "allow",
                                                          "forbid"
                                                        ]
                                                      },
                                                      "capabilities": {
                                                        "anyOf": [
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "spendable": {
                                                                "type": "boolean"
                                                              },
                                                              "transferable": {
                                                                "type": "boolean"
                                                              },
                                                              "qualification": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "none",
                                                                  "earned",
                                                                  "xp"
                                                                ]
                                                              },
                                                              "expiry_policy": {
                                                                "anyOf": [
                                                                  {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "type": {
                                                                        "type": "string",
                                                                        "const": "none"
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "type"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  },
                                                                  {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "type": {
                                                                        "type": "string",
                                                                        "const": "after"
                                                                      },
                                                                      "seconds": {
                                                                        "type": "integer",
                                                                        "exclusiveMinimum": 0,
                                                                        "maximum": 9007199254740991
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "type",
                                                                      "seconds"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                ]
                                                              }
                                                            },
                                                            "required": [
                                                              "spendable",
                                                              "transferable",
                                                              "qualification",
                                                              "expiry_policy"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "null"
                                                          }
                                                        ]
                                                      }
                                                    },
                                                    "required": [
                                                      "version",
                                                      "code",
                                                      "name",
                                                      "precision",
                                                      "expiration_policy",
                                                      "negative_balance",
                                                      "capabilities"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  "reward_terms": {
                                                    "type": "object",
                                                    "properties": {
                                                      "version": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      },
                                                      "name": {
                                                        "type": "string",
                                                        "minLength": 1,
                                                        "maxLength": 255
                                                      },
                                                      "cost": {
                                                        "type": "string",
                                                        "pattern": "^(0|[1-9][0-9]*)$"
                                                      },
                                                      "currency_id": {
                                                        "type": [
                                                          "string",
                                                          "null"
                                                        ]
                                                      },
                                                      "availability": {
                                                        "anyOf": [
                                                          {
                                                            "type": "integer",
                                                            "minimum": 0,
                                                            "maximum": 9007199254740991
                                                          },
                                                          {
                                                            "type": "null"
                                                          }
                                                        ]
                                                      },
                                                      "expiry_after": {
                                                        "type": [
                                                          "string",
                                                          "null"
                                                        ]
                                                      },
                                                      "status": {
                                                        "type": "string",
                                                        "enum": [
                                                          "active",
                                                          "archived"
                                                        ]
                                                      }
                                                    },
                                                    "required": [
                                                      "version",
                                                      "name",
                                                      "cost",
                                                      "currency_id",
                                                      "availability",
                                                      "expiry_after",
                                                      "status"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "kind",
                                                  "key",
                                                  "usage"
                                                ],
                                                "additionalProperties": false
                                              }
                                            }
                                          },
                                          "required": [
                                            "version",
                                            "digest",
                                            "dependencies"
                                          ],
                                          "additionalProperties": false
                                        }
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "key",
                                      "name",
                                      "status",
                                      "head",
                                      "versions"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "seasons": {
                                  "maxItems": 1000,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "key": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                      },
                                      "name": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 255
                                      },
                                      "status": {
                                        "type": "string",
                                        "enum": [
                                          "draft",
                                          "active",
                                          "archived"
                                        ]
                                      },
                                      "scheduling": {
                                        "type": "string",
                                        "enum": [
                                          "active",
                                          "stopped"
                                        ]
                                      },
                                      "head": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "version": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              },
                                              "digest": {
                                                "type": "string",
                                                "pattern": "^[a-f0-9]{64}$"
                                              }
                                            },
                                            "required": [
                                              "version",
                                              "digest"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "versions": {
                                        "maxItems": 1000,
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "version": {
                                              "type": "integer",
                                              "exclusiveMinimum": 0,
                                              "maximum": 9007199254740991
                                            },
                                            "digest": {
                                              "type": "string",
                                              "pattern": "^[a-f0-9]{64}$"
                                            },
                                            "definition": {
                                              "type": "object",
                                              "properties": {
                                                "schema": {
                                                  "type": "string",
                                                  "const": "orishare.season/v1"
                                                },
                                                "starts_at": {
                                                  "type": "string",
                                                  "format": "date-time",
                                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                },
                                                "ends_at": {
                                                  "type": "string",
                                                  "format": "date-time",
                                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                },
                                                "display": {
                                                  "type": "object",
                                                  "properties": {
                                                    "title": {
                                                      "type": "string"
                                                    },
                                                    "description": {
                                                      "type": "string"
                                                    },
                                                    "image_url": {
                                                      "type": "string",
                                                      "format": "uri"
                                                    },
                                                    "icon": {
                                                      "type": "string"
                                                    },
                                                    "color": {
                                                      "type": "string"
                                                    },
                                                    "sort_order": {
                                                      "default": 0,
                                                      "type": "integer",
                                                      "minimum": -9007199254740991,
                                                      "maximum": 9007199254740991
                                                    },
                                                    "hidden": {
                                                      "default": false,
                                                      "type": "boolean"
                                                    },
                                                    "locales": {
                                                      "default": {},
                                                      "type": "object",
                                                      "propertyNames": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
                                                      },
                                                      "additionalProperties": {
                                                        "type": "object",
                                                        "properties": {
                                                          "title": {
                                                            "type": "string"
                                                          },
                                                          "description": {
                                                            "type": "string"
                                                          }
                                                        },
                                                        "additionalProperties": false
                                                      }
                                                    }
                                                  },
                                                  "additionalProperties": false
                                                },
                                                "eligibility": {
                                                  "type": "object",
                                                  "properties": {
                                                    "audience": {
                                                      "maxItems": 64,
                                                      "type": "array",
                                                      "items": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      }
                                                    }
                                                  },
                                                  "required": [
                                                    "audience"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "admission": {
                                                  "type": "object",
                                                  "properties": {
                                                    "grace_seconds": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 9007199254740991
                                                    },
                                                    "max_lateness_seconds": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "grace_seconds",
                                                    "max_lateness_seconds"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "settlement": {
                                                  "type": "object",
                                                  "properties": {
                                                    "delay_seconds": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "delay_seconds"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "schema",
                                                "starts_at",
                                                "ends_at",
                                                "display",
                                                "eligibility",
                                                "admission",
                                                "settlement"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "version",
                                            "digest",
                                            "definition"
                                          ],
                                          "additionalProperties": false
                                        }
                                      }
                                    },
                                    "required": [
                                      "key",
                                      "name",
                                      "status",
                                      "head",
                                      "versions"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "rules": {
                                  "maxItems": 1000,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "key": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                      },
                                      "name": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 255
                                      },
                                      "campaign": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "priority": {
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "status": {
                                        "type": "string",
                                        "enum": [
                                          "draft",
                                          "published",
                                          "paused",
                                          "archived"
                                        ]
                                      },
                                      "head": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "version": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              },
                                              "digest": {
                                                "type": "string",
                                                "pattern": "^[a-f0-9]{64}$"
                                              }
                                            },
                                            "required": [
                                              "version",
                                              "digest"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "draft": {
                                        "anyOf": [
                                          {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "schema": {
                                                    "type": "string",
                                                    "const": "orishare.rule/v1"
                                                  },
                                                  "trigger": {
                                                    "type": "object",
                                                    "properties": {
                                                      "event": {
                                                        "type": "string",
                                                        "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                      }
                                                    },
                                                    "required": [
                                                      "event"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  "conditions": {
                                                    "$ref": "#/components/schemas/__schema1"
                                                  },
                                                  "limits": {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "object",
                                                      "properties": {
                                                        "id": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "scope": {
                                                          "minItems": 1,
                                                          "type": "array",
                                                          "items": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        },
                                                        "max": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        },
                                                        "window": {
                                                          "type": "string",
                                                          "enum": [
                                                            "none",
                                                            "day",
                                                            "week",
                                                            "month",
                                                            "year"
                                                          ]
                                                        }
                                                      },
                                                      "required": [
                                                        "scope",
                                                        "max"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "actions": {
                                                    "minItems": 1,
                                                    "type": "array",
                                                    "items": {
                                                      "oneOf": [
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "points.award"
                                                            },
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "number"
                                                                },
                                                                {
                                                                  "type": "string",
                                                                  "minLength": 1
                                                                }
                                                              ]
                                                            },
                                                            "reason": {
                                                              "type": "string",
                                                              "maxLength": 200
                                                            },
                                                            "confirm_after": {
                                                              "type": "string",
                                                              "pattern": "^\\d+[smhdw]$"
                                                            },
                                                            "expires_after": {
                                                              "type": "string",
                                                              "pattern": "^\\d+[smhdw]$"
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "currency",
                                                            "amount"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "points.deduct"
                                                            },
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "number"
                                                                },
                                                                {
                                                                  "type": "string",
                                                                  "minLength": 1
                                                                }
                                                              ]
                                                            },
                                                            "reason": {
                                                              "type": "string",
                                                              "maxLength": 200
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "currency",
                                                            "amount"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "points.reverse"
                                                            },
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "match": {
                                                              "type": "object",
                                                              "properties": {
                                                                "event": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                                },
                                                                "on": {
                                                                  "type": "string",
                                                                  "minLength": 1
                                                                }
                                                              },
                                                              "required": [
                                                                "event",
                                                                "on"
                                                              ],
                                                              "additionalProperties": false
                                                            },
                                                            "fraction": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "number"
                                                                },
                                                                {
                                                                  "type": "string",
                                                                  "minLength": 1
                                                                }
                                                              ]
                                                            },
                                                            "amount": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "number"
                                                                },
                                                                {
                                                                  "type": "string",
                                                                  "minLength": 1
                                                                }
                                                              ]
                                                            },
                                                            "reason": {
                                                              "type": "string",
                                                              "maxLength": 200
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "currency",
                                                            "match"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "reward.issue"
                                                            },
                                                            "reward": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "reward"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "tier.evaluate"
                                                            },
                                                            "program": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "program"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "attribute.set"
                                                            },
                                                            "attribute": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "value": {
                                                              "type": [
                                                                "string",
                                                                "number",
                                                                "boolean",
                                                                "null"
                                                              ]
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "attribute",
                                                            "value"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "webhook.emit"
                                                            },
                                                            "event": {
                                                              "type": "string",
                                                              "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                            },
                                                            "payload": {
                                                              "type": "object",
                                                              "propertyNames": {
                                                                "type": "string"
                                                              },
                                                              "additionalProperties": {
                                                                "anyOf": [
                                                                  {
                                                                    "type": [
                                                                      "string",
                                                                      "number",
                                                                      "boolean"
                                                                    ]
                                                                  },
                                                                  {
                                                                    "type": "null"
                                                                  },
                                                                  {
                                                                    "type": "array",
                                                                    "items": {
                                                                      "type": [
                                                                        "string",
                                                                        "number",
                                                                        "boolean"
                                                                      ]
                                                                    }
                                                                  }
                                                                ]
                                                              }
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "event"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "counter.release"
                                                            },
                                                            "rule": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "limit": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "rule",
                                                            "limit"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      ],
                                                      "type": "object"
                                                    }
                                                  },
                                                  "priority": {
                                                    "type": "integer",
                                                    "minimum": -9007199254740991,
                                                    "maximum": 9007199254740991
                                                  }
                                                },
                                                "required": [
                                                  "schema",
                                                  "trigger",
                                                  "actions"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "schema": {
                                                    "type": "string",
                                                    "const": "orishare.rule/v2"
                                                  },
                                                  "trigger": {
                                                    "oneOf": [
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "customer_event"
                                                          },
                                                          "event": {
                                                            "type": "string",
                                                            "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                          }
                                                        },
                                                        "required": [
                                                          "kind",
                                                          "event"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "program_transition"
                                                          },
                                                          "program": {
                                                            "type": "string",
                                                            "pattern": "^[A-Za-z0-9_-]+$"
                                                          },
                                                          "type": {
                                                            "type": "string",
                                                            "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                          }
                                                        },
                                                        "required": [
                                                          "kind",
                                                          "program",
                                                          "type"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "schedule"
                                                          },
                                                          "schedule": {
                                                            "type": "object",
                                                            "properties": {
                                                              "key": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "kind": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "inactivity",
                                                                  "period_deadline",
                                                                  "entitlement_expiry",
                                                                  "every",
                                                                  "date_attribute"
                                                                ]
                                                              },
                                                              "attribute": {
                                                                "type": "string",
                                                                "pattern": "^[a-z][a-z0-9_]{0,31}$"
                                                              },
                                                              "min_notice": {
                                                                "type": "string",
                                                                "pattern": "^\\d+[smhdw]$"
                                                              },
                                                              "program": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "event": {
                                                                "type": "string",
                                                                "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                              },
                                                              "offset": {
                                                                "type": "string",
                                                                "pattern": "^\\d+[smhdw]$"
                                                              },
                                                              "every": {
                                                                "type": "string",
                                                                "enum": [
                                                                  "day",
                                                                  "week",
                                                                  "month"
                                                                ]
                                                              },
                                                              "at": {
                                                                "type": "string",
                                                                "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d)?$"
                                                              },
                                                              "eligibility": {
                                                                "$ref": "#/components/schemas/__schema3"
                                                              },
                                                              "audience": {
                                                                "type": "array",
                                                                "items": {
                                                                  "type": "string",
                                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                                }
                                                              },
                                                              "cooldown": {
                                                                "type": "string",
                                                                "pattern": "^\\d+[smhdw]$"
                                                              }
                                                            },
                                                            "required": [
                                                              "key",
                                                              "kind"
                                                            ],
                                                            "additionalProperties": false
                                                          }
                                                        },
                                                        "required": [
                                                          "kind",
                                                          "schedule"
                                                        ],
                                                        "additionalProperties": false
                                                      }
                                                    ],
                                                    "type": "object"
                                                  },
                                                  "conditions": {
                                                    "$ref": "#/components/schemas/__schema3"
                                                  },
                                                  "limits": {
                                                    "type": "array",
                                                    "items": {
                                                      "type": "object",
                                                      "properties": {
                                                        "id": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "scope": {
                                                          "minItems": 1,
                                                          "type": "array",
                                                          "items": {
                                                            "type": "string",
                                                            "minLength": 1
                                                          }
                                                        },
                                                        "max": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        },
                                                        "window": {
                                                          "type": "string",
                                                          "enum": [
                                                            "none",
                                                            "day",
                                                            "week",
                                                            "month",
                                                            "year"
                                                          ]
                                                        }
                                                      },
                                                      "required": [
                                                        "scope",
                                                        "max"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "actions": {
                                                    "minItems": 1,
                                                    "type": "array",
                                                    "items": {
                                                      "oneOf": [
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "points.award"
                                                            },
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "number"
                                                                },
                                                                {
                                                                  "type": "string",
                                                                  "minLength": 1
                                                                }
                                                              ]
                                                            },
                                                            "reason": {
                                                              "type": "string",
                                                              "maxLength": 200
                                                            },
                                                            "confirm_after": {
                                                              "type": "string",
                                                              "pattern": "^\\d+[smhdw]$"
                                                            },
                                                            "expires_after": {
                                                              "type": "string",
                                                              "pattern": "^\\d+[smhdw]$"
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "currency",
                                                            "amount"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "points.deduct"
                                                            },
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "number"
                                                                },
                                                                {
                                                                  "type": "string",
                                                                  "minLength": 1
                                                                }
                                                              ]
                                                            },
                                                            "reason": {
                                                              "type": "string",
                                                              "maxLength": 200
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "currency",
                                                            "amount"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "points.reverse"
                                                            },
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "match": {
                                                              "type": "object",
                                                              "properties": {
                                                                "event": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                                },
                                                                "on": {
                                                                  "type": "string",
                                                                  "minLength": 1
                                                                }
                                                              },
                                                              "required": [
                                                                "event",
                                                                "on"
                                                              ],
                                                              "additionalProperties": false
                                                            },
                                                            "fraction": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "number"
                                                                },
                                                                {
                                                                  "type": "string",
                                                                  "minLength": 1
                                                                }
                                                              ]
                                                            },
                                                            "amount": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "number"
                                                                },
                                                                {
                                                                  "type": "string",
                                                                  "minLength": 1
                                                                }
                                                              ]
                                                            },
                                                            "reason": {
                                                              "type": "string",
                                                              "maxLength": 200
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "currency",
                                                            "match"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "reward.issue"
                                                            },
                                                            "reward": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "reward"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "tier.evaluate"
                                                            },
                                                            "program": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "program"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "attribute.set"
                                                            },
                                                            "attribute": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "value": {
                                                              "type": [
                                                                "string",
                                                                "number",
                                                                "boolean",
                                                                "null"
                                                              ]
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "attribute",
                                                            "value"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "webhook.emit"
                                                            },
                                                            "event": {
                                                              "type": "string",
                                                              "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                            },
                                                            "payload": {
                                                              "type": "object",
                                                              "propertyNames": {
                                                                "type": "string"
                                                              },
                                                              "additionalProperties": {
                                                                "anyOf": [
                                                                  {
                                                                    "type": [
                                                                      "string",
                                                                      "number",
                                                                      "boolean"
                                                                    ]
                                                                  },
                                                                  {
                                                                    "type": "null"
                                                                  },
                                                                  {
                                                                    "type": "array",
                                                                    "items": {
                                                                      "type": [
                                                                        "string",
                                                                        "number",
                                                                        "boolean"
                                                                      ]
                                                                    }
                                                                  }
                                                                ]
                                                              }
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "event"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "counter.release"
                                                            },
                                                            "rule": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "limit": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "rule",
                                                            "limit"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "badge.contribute"
                                                            },
                                                            "badge": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "value": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "number"
                                                                },
                                                                {
                                                                  "type": "string",
                                                                  "minLength": 1
                                                                }
                                                              ]
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "badge"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "badge.grant"
                                                            },
                                                            "badge": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "rank": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "occurrence": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "badge"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "streak.contribute"
                                                            },
                                                            "streak": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "value": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "number"
                                                                },
                                                                {
                                                                  "type": "string",
                                                                  "minLength": 1
                                                                }
                                                              ]
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "streak"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "streak.freeze_grant"
                                                            },
                                                            "streak": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "quantity": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "streak",
                                                            "quantity"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "quest.contribute"
                                                            },
                                                            "quest": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "step": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "value": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "number"
                                                                },
                                                                {
                                                                  "type": "string",
                                                                  "minLength": 1
                                                                }
                                                              ]
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "quest",
                                                            "step"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "quest.enroll"
                                                            },
                                                            "quest": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "quest"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "leaderboard.contribute"
                                                            },
                                                            "leaderboard": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "value": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "number"
                                                                },
                                                                {
                                                                  "type": "string",
                                                                  "minLength": 1
                                                                }
                                                              ]
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "leaderboard",
                                                            "value"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "program.reverse_contribution"
                                                            },
                                                            "program": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "source_fact": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "fact_id": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "fact_id"
                                                                  ],
                                                                  "additionalProperties": false
                                                                },
                                                                {
                                                                  "type": "object",
                                                                  "properties": {
                                                                    "object_type": {
                                                                      "type": "string",
                                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                                    },
                                                                    "key": {
                                                                      "minItems": 1,
                                                                      "type": "array",
                                                                      "items": {
                                                                        "type": "string",
                                                                        "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_-]*(?:\\.[A-Za-z_][A-Za-z0-9_-]*)*$"
                                                                      }
                                                                    }
                                                                  },
                                                                  "required": [
                                                                    "object_type",
                                                                    "key"
                                                                  ],
                                                                  "additionalProperties": false
                                                                }
                                                              ]
                                                            },
                                                            "fraction": {
                                                              "type": "string",
                                                              "pattern": "^(?:0(?:\\.\\d+)?|1(?:\\.0+)?)$"
                                                            },
                                                            "amount": {
                                                              "type": "number",
                                                              "exclusiveMinimum": 0
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "program",
                                                            "source_fact"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "coupon.issue"
                                                            },
                                                            "offer": {
                                                              "type": "object",
                                                              "properties": {
                                                                "key": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                },
                                                                "version": {
                                                                  "type": "integer",
                                                                  "minimum": 1,
                                                                  "maximum": 9007199254740991
                                                                },
                                                                "digest": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-f0-9]{64}$"
                                                                }
                                                              },
                                                              "required": [
                                                                "key",
                                                                "version",
                                                                "digest"
                                                              ],
                                                              "additionalProperties": false
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "offer"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "discount.quote"
                                                            },
                                                            "offer": {
                                                              "type": "object",
                                                              "properties": {
                                                                "key": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                },
                                                                "version": {
                                                                  "type": "integer",
                                                                  "minimum": 1,
                                                                  "maximum": 9007199254740991
                                                                },
                                                                "digest": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-f0-9]{64}$"
                                                                }
                                                              },
                                                              "required": [
                                                                "key",
                                                                "version",
                                                                "digest"
                                                              ],
                                                              "additionalProperties": false
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "offer"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "item.grant"
                                                            },
                                                            "item": {
                                                              "type": "string",
                                                              "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                            },
                                                            "quantity": {
                                                              "default": 1,
                                                              "type": "integer",
                                                              "minimum": 1,
                                                              "maximum": 1000
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "item"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "friend_streak.activity"
                                                            },
                                                            "friend_streak": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "friend_streak"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "friend_quest.contribute"
                                                            },
                                                            "friend_quest": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "number"
                                                                },
                                                                {
                                                                  "type": "string",
                                                                  "minLength": 1
                                                                }
                                                              ]
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "friend_quest"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "team_quest.contribute"
                                                            },
                                                            "team_quest": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount": {
                                                              "anyOf": [
                                                                {
                                                                  "type": "number"
                                                                },
                                                                {
                                                                  "type": "string",
                                                                  "minLength": 1
                                                                }
                                                              ]
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "team_quest"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      ],
                                                      "type": "object"
                                                    }
                                                  },
                                                  "priority": {
                                                    "type": "integer",
                                                    "minimum": -9007199254740991,
                                                    "maximum": 9007199254740991
                                                  },
                                                  "trust": {
                                                    "type": "object",
                                                    "properties": {
                                                      "minimum": {
                                                        "type": "string",
                                                        "enum": [
                                                          "anonymous_claim",
                                                          "customer_claim",
                                                          "merchant_asserted",
                                                          "verified_evidence",
                                                          "legacy_unknown"
                                                        ]
                                                      }
                                                    },
                                                    "required": [
                                                      "minimum"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "schema",
                                                  "trigger",
                                                  "actions"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ]
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "draft_bindings": {
                                        "default": [],
                                        "maxItems": 256,
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "path": {
                                              "minItems": 1,
                                              "maxItems": 32,
                                              "type": "array",
                                              "items": {
                                                "anyOf": [
                                                  {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 9007199254740991
                                                  }
                                                ]
                                              }
                                            },
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "program",
                                                "currency",
                                                "rule",
                                                "tier_level"
                                              ]
                                            },
                                            "key": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 255
                                            }
                                          },
                                          "required": [
                                            "path",
                                            "kind",
                                            "key"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "versions": {
                                        "maxItems": 1000,
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "version": {
                                              "type": "integer",
                                              "exclusiveMinimum": 0,
                                              "maximum": 9007199254740991
                                            },
                                            "digest": {
                                              "type": "string",
                                              "pattern": "^[a-f0-9]{64}$"
                                            },
                                            "definition": {
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "schema": {
                                                      "type": "string",
                                                      "const": "orishare.rule/v1"
                                                    },
                                                    "trigger": {
                                                      "type": "object",
                                                      "properties": {
                                                        "event": {
                                                          "type": "string",
                                                          "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                        }
                                                      },
                                                      "required": [
                                                        "event"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "conditions": {
                                                      "$ref": "#/components/schemas/__schema1"
                                                    },
                                                    "limits": {
                                                      "type": "array",
                                                      "items": {
                                                        "type": "object",
                                                        "properties": {
                                                          "id": {
                                                            "type": "string",
                                                            "pattern": "^[A-Za-z0-9_-]+$"
                                                          },
                                                          "scope": {
                                                            "minItems": 1,
                                                            "type": "array",
                                                            "items": {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          },
                                                          "max": {
                                                            "type": "integer",
                                                            "exclusiveMinimum": 0,
                                                            "maximum": 9007199254740991
                                                          },
                                                          "window": {
                                                            "type": "string",
                                                            "enum": [
                                                              "none",
                                                              "day",
                                                              "week",
                                                              "month",
                                                              "year"
                                                            ]
                                                          }
                                                        },
                                                        "required": [
                                                          "scope",
                                                          "max"
                                                        ],
                                                        "additionalProperties": false
                                                      }
                                                    },
                                                    "actions": {
                                                      "minItems": 1,
                                                      "type": "array",
                                                      "items": {
                                                        "oneOf": [
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "points.award"
                                                              },
                                                              "currency": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "amount": {
                                                                "anyOf": [
                                                                  {
                                                                    "type": "number"
                                                                  },
                                                                  {
                                                                    "type": "string",
                                                                    "minLength": 1
                                                                  }
                                                                ]
                                                              },
                                                              "reason": {
                                                                "type": "string",
                                                                "maxLength": 200
                                                              },
                                                              "confirm_after": {
                                                                "type": "string",
                                                                "pattern": "^\\d+[smhdw]$"
                                                              },
                                                              "expires_after": {
                                                                "type": "string",
                                                                "pattern": "^\\d+[smhdw]$"
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "currency",
                                                              "amount"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "points.deduct"
                                                              },
                                                              "currency": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "amount": {
                                                                "anyOf": [
                                                                  {
                                                                    "type": "number"
                                                                  },
                                                                  {
                                                                    "type": "string",
                                                                    "minLength": 1
                                                                  }
                                                                ]
                                                              },
                                                              "reason": {
                                                                "type": "string",
                                                                "maxLength": 200
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "currency",
                                                              "amount"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "points.reverse"
                                                              },
                                                              "currency": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "match": {
                                                                "type": "object",
                                                                "properties": {
                                                                  "event": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                                  },
                                                                  "on": {
                                                                    "type": "string",
                                                                    "minLength": 1
                                                                  }
                                                                },
                                                                "required": [
                                                                  "event",
                                                                  "on"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              "fraction": {
                                                                "anyOf": [
                                                                  {
                                                                    "type": "number"
                                                                  },
                                                                  {
                                                                    "type": "string",
                                                                    "minLength": 1
                                                                  }
                                                                ]
                                                              },
                                                              "amount": {
                                                                "anyOf": [
                                                                  {
                                                                    "type": "number"
                                                                  },
                                                                  {
                                                                    "type": "string",
                                                                    "minLength": 1
                                                                  }
                                                                ]
                                                              },
                                                              "reason": {
                                                                "type": "string",
                                                                "maxLength": 200
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "currency",
                                                              "match"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "reward.issue"
                                                              },
                                                              "reward": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "reward"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "tier.evaluate"
                                                              },
                                                              "program": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "program"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "attribute.set"
                                                              },
                                                              "attribute": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "value": {
                                                                "type": [
                                                                  "string",
                                                                  "number",
                                                                  "boolean",
                                                                  "null"
                                                                ]
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "attribute",
                                                              "value"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "webhook.emit"
                                                              },
                                                              "event": {
                                                                "type": "string",
                                                                "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                              },
                                                              "payload": {
                                                                "type": "object",
                                                                "propertyNames": {
                                                                  "type": "string"
                                                                },
                                                                "additionalProperties": {
                                                                  "anyOf": [
                                                                    {
                                                                      "type": [
                                                                        "string",
                                                                        "number",
                                                                        "boolean"
                                                                      ]
                                                                    },
                                                                    {
                                                                      "type": "null"
                                                                    },
                                                                    {
                                                                      "type": "array",
                                                                      "items": {
                                                                        "type": [
                                                                          "string",
                                                                          "number",
                                                                          "boolean"
                                                                        ]
                                                                      }
                                                                    }
                                                                  ]
                                                                }
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "event"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "counter.release"
                                                              },
                                                              "rule": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "limit": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "rule",
                                                              "limit"
                                                            ],
                                                            "additionalProperties": false
                                                          }
                                                        ],
                                                        "type": "object"
                                                      }
                                                    },
                                                    "priority": {
                                                      "type": "integer",
                                                      "minimum": -9007199254740991,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "schema",
                                                    "trigger",
                                                    "actions"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "schema": {
                                                      "type": "string",
                                                      "const": "orishare.rule/v2"
                                                    },
                                                    "trigger": {
                                                      "oneOf": [
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "customer_event"
                                                            },
                                                            "event": {
                                                              "type": "string",
                                                              "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                            }
                                                          },
                                                          "required": [
                                                            "kind",
                                                            "event"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "program_transition"
                                                            },
                                                            "program": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "type": {
                                                              "type": "string",
                                                              "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                            }
                                                          },
                                                          "required": [
                                                            "kind",
                                                            "program",
                                                            "type"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "kind": {
                                                              "type": "string",
                                                              "const": "schedule"
                                                            },
                                                            "schedule": {
                                                              "type": "object",
                                                              "properties": {
                                                                "key": {
                                                                  "type": "string",
                                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                                },
                                                                "kind": {
                                                                  "type": "string",
                                                                  "enum": [
                                                                    "inactivity",
                                                                    "period_deadline",
                                                                    "entitlement_expiry",
                                                                    "every",
                                                                    "date_attribute"
                                                                  ]
                                                                },
                                                                "attribute": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-z][a-z0-9_]{0,31}$"
                                                                },
                                                                "min_notice": {
                                                                  "type": "string",
                                                                  "pattern": "^\\d+[smhdw]$"
                                                                },
                                                                "program": {
                                                                  "type": "string",
                                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                                },
                                                                "event": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                                },
                                                                "offset": {
                                                                  "type": "string",
                                                                  "pattern": "^\\d+[smhdw]$"
                                                                },
                                                                "every": {
                                                                  "type": "string",
                                                                  "enum": [
                                                                    "day",
                                                                    "week",
                                                                    "month"
                                                                  ]
                                                                },
                                                                "at": {
                                                                  "type": "string",
                                                                  "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d)?$"
                                                                },
                                                                "eligibility": {
                                                                  "$ref": "#/components/schemas/__schema3"
                                                                },
                                                                "audience": {
                                                                  "type": "array",
                                                                  "items": {
                                                                    "type": "string",
                                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                                  }
                                                                },
                                                                "cooldown": {
                                                                  "type": "string",
                                                                  "pattern": "^\\d+[smhdw]$"
                                                                }
                                                              },
                                                              "required": [
                                                                "key",
                                                                "kind"
                                                              ],
                                                              "additionalProperties": false
                                                            }
                                                          },
                                                          "required": [
                                                            "kind",
                                                            "schedule"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      ],
                                                      "type": "object"
                                                    },
                                                    "conditions": {
                                                      "$ref": "#/components/schemas/__schema3"
                                                    },
                                                    "limits": {
                                                      "type": "array",
                                                      "items": {
                                                        "type": "object",
                                                        "properties": {
                                                          "id": {
                                                            "type": "string",
                                                            "pattern": "^[A-Za-z0-9_-]+$"
                                                          },
                                                          "scope": {
                                                            "minItems": 1,
                                                            "type": "array",
                                                            "items": {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          },
                                                          "max": {
                                                            "type": "integer",
                                                            "exclusiveMinimum": 0,
                                                            "maximum": 9007199254740991
                                                          },
                                                          "window": {
                                                            "type": "string",
                                                            "enum": [
                                                              "none",
                                                              "day",
                                                              "week",
                                                              "month",
                                                              "year"
                                                            ]
                                                          }
                                                        },
                                                        "required": [
                                                          "scope",
                                                          "max"
                                                        ],
                                                        "additionalProperties": false
                                                      }
                                                    },
                                                    "actions": {
                                                      "minItems": 1,
                                                      "type": "array",
                                                      "items": {
                                                        "oneOf": [
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "points.award"
                                                              },
                                                              "currency": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "amount": {
                                                                "anyOf": [
                                                                  {
                                                                    "type": "number"
                                                                  },
                                                                  {
                                                                    "type": "string",
                                                                    "minLength": 1
                                                                  }
                                                                ]
                                                              },
                                                              "reason": {
                                                                "type": "string",
                                                                "maxLength": 200
                                                              },
                                                              "confirm_after": {
                                                                "type": "string",
                                                                "pattern": "^\\d+[smhdw]$"
                                                              },
                                                              "expires_after": {
                                                                "type": "string",
                                                                "pattern": "^\\d+[smhdw]$"
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "currency",
                                                              "amount"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "points.deduct"
                                                              },
                                                              "currency": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "amount": {
                                                                "anyOf": [
                                                                  {
                                                                    "type": "number"
                                                                  },
                                                                  {
                                                                    "type": "string",
                                                                    "minLength": 1
                                                                  }
                                                                ]
                                                              },
                                                              "reason": {
                                                                "type": "string",
                                                                "maxLength": 200
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "currency",
                                                              "amount"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "points.reverse"
                                                              },
                                                              "currency": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "match": {
                                                                "type": "object",
                                                                "properties": {
                                                                  "event": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                                  },
                                                                  "on": {
                                                                    "type": "string",
                                                                    "minLength": 1
                                                                  }
                                                                },
                                                                "required": [
                                                                  "event",
                                                                  "on"
                                                                ],
                                                                "additionalProperties": false
                                                              },
                                                              "fraction": {
                                                                "anyOf": [
                                                                  {
                                                                    "type": "number"
                                                                  },
                                                                  {
                                                                    "type": "string",
                                                                    "minLength": 1
                                                                  }
                                                                ]
                                                              },
                                                              "amount": {
                                                                "anyOf": [
                                                                  {
                                                                    "type": "number"
                                                                  },
                                                                  {
                                                                    "type": "string",
                                                                    "minLength": 1
                                                                  }
                                                                ]
                                                              },
                                                              "reason": {
                                                                "type": "string",
                                                                "maxLength": 200
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "currency",
                                                              "match"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "reward.issue"
                                                              },
                                                              "reward": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "reward"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "tier.evaluate"
                                                              },
                                                              "program": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "program"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "attribute.set"
                                                              },
                                                              "attribute": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "value": {
                                                                "type": [
                                                                  "string",
                                                                  "number",
                                                                  "boolean",
                                                                  "null"
                                                                ]
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "attribute",
                                                              "value"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "webhook.emit"
                                                              },
                                                              "event": {
                                                                "type": "string",
                                                                "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                              },
                                                              "payload": {
                                                                "type": "object",
                                                                "propertyNames": {
                                                                  "type": "string"
                                                                },
                                                                "additionalProperties": {
                                                                  "anyOf": [
                                                                    {
                                                                      "type": [
                                                                        "string",
                                                                        "number",
                                                                        "boolean"
                                                                      ]
                                                                    },
                                                                    {
                                                                      "type": "null"
                                                                    },
                                                                    {
                                                                      "type": "array",
                                                                      "items": {
                                                                        "type": [
                                                                          "string",
                                                                          "number",
                                                                          "boolean"
                                                                        ]
                                                                      }
                                                                    }
                                                                  ]
                                                                }
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "event"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "counter.release"
                                                              },
                                                              "rule": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "limit": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "rule",
                                                              "limit"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "badge.contribute"
                                                              },
                                                              "badge": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "value": {
                                                                "anyOf": [
                                                                  {
                                                                    "type": "number"
                                                                  },
                                                                  {
                                                                    "type": "string",
                                                                    "minLength": 1
                                                                  }
                                                                ]
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "badge"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "badge.grant"
                                                              },
                                                              "badge": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "rank": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "occurrence": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "badge"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "streak.contribute"
                                                              },
                                                              "streak": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "value": {
                                                                "anyOf": [
                                                                  {
                                                                    "type": "number"
                                                                  },
                                                                  {
                                                                    "type": "string",
                                                                    "minLength": 1
                                                                  }
                                                                ]
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "streak"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "streak.freeze_grant"
                                                              },
                                                              "streak": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "quantity": {
                                                                "type": "integer",
                                                                "exclusiveMinimum": 0,
                                                                "maximum": 9007199254740991
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "streak",
                                                              "quantity"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "quest.contribute"
                                                              },
                                                              "quest": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "step": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "value": {
                                                                "anyOf": [
                                                                  {
                                                                    "type": "number"
                                                                  },
                                                                  {
                                                                    "type": "string",
                                                                    "minLength": 1
                                                                  }
                                                                ]
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "quest",
                                                              "step"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "quest.enroll"
                                                              },
                                                              "quest": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "quest"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "leaderboard.contribute"
                                                              },
                                                              "leaderboard": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "value": {
                                                                "anyOf": [
                                                                  {
                                                                    "type": "number"
                                                                  },
                                                                  {
                                                                    "type": "string",
                                                                    "minLength": 1
                                                                  }
                                                                ]
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "leaderboard",
                                                              "value"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "program.reverse_contribution"
                                                              },
                                                              "program": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "source_fact": {
                                                                "anyOf": [
                                                                  {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "fact_id": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "fact_id"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  },
                                                                  {
                                                                    "type": "object",
                                                                    "properties": {
                                                                      "object_type": {
                                                                        "type": "string",
                                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                                      },
                                                                      "key": {
                                                                        "minItems": 1,
                                                                        "type": "array",
                                                                        "items": {
                                                                          "type": "string",
                                                                          "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_-]*(?:\\.[A-Za-z_][A-Za-z0-9_-]*)*$"
                                                                        }
                                                                      }
                                                                    },
                                                                    "required": [
                                                                      "object_type",
                                                                      "key"
                                                                    ],
                                                                    "additionalProperties": false
                                                                  }
                                                                ]
                                                              },
                                                              "fraction": {
                                                                "type": "string",
                                                                "pattern": "^(?:0(?:\\.\\d+)?|1(?:\\.0+)?)$"
                                                              },
                                                              "amount": {
                                                                "type": "number",
                                                                "exclusiveMinimum": 0
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "program",
                                                              "source_fact"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "coupon.issue"
                                                              },
                                                              "offer": {
                                                                "type": "object",
                                                                "properties": {
                                                                  "key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "version": {
                                                                    "type": "integer",
                                                                    "minimum": 1,
                                                                    "maximum": 9007199254740991
                                                                  },
                                                                  "digest": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-f0-9]{64}$"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "key",
                                                                  "version",
                                                                  "digest"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "offer"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "discount.quote"
                                                              },
                                                              "offer": {
                                                                "type": "object",
                                                                "properties": {
                                                                  "key": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                  },
                                                                  "version": {
                                                                    "type": "integer",
                                                                    "minimum": 1,
                                                                    "maximum": 9007199254740991
                                                                  },
                                                                  "digest": {
                                                                    "type": "string",
                                                                    "pattern": "^[a-f0-9]{64}$"
                                                                  }
                                                                },
                                                                "required": [
                                                                  "key",
                                                                  "version",
                                                                  "digest"
                                                                ],
                                                                "additionalProperties": false
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "offer"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "item.grant"
                                                              },
                                                              "item": {
                                                                "type": "string",
                                                                "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                              },
                                                              "quantity": {
                                                                "default": 1,
                                                                "type": "integer",
                                                                "minimum": 1,
                                                                "maximum": 1000
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "item"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "friend_streak.activity"
                                                              },
                                                              "friend_streak": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "friend_streak"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "friend_quest.contribute"
                                                              },
                                                              "friend_quest": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "amount": {
                                                                "anyOf": [
                                                                  {
                                                                    "type": "number"
                                                                  },
                                                                  {
                                                                    "type": "string",
                                                                    "minLength": 1
                                                                  }
                                                                ]
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "friend_quest"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "team_quest.contribute"
                                                              },
                                                              "team_quest": {
                                                                "type": "string",
                                                                "pattern": "^[A-Za-z0-9_-]+$"
                                                              },
                                                              "amount": {
                                                                "anyOf": [
                                                                  {
                                                                    "type": "number"
                                                                  },
                                                                  {
                                                                    "type": "string",
                                                                    "minLength": 1
                                                                  }
                                                                ]
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "team_quest"
                                                            ],
                                                            "additionalProperties": false
                                                          }
                                                        ],
                                                        "type": "object"
                                                      }
                                                    },
                                                    "priority": {
                                                      "type": "integer",
                                                      "minimum": -9007199254740991,
                                                      "maximum": 9007199254740991
                                                    },
                                                    "trust": {
                                                      "type": "object",
                                                      "properties": {
                                                        "minimum": {
                                                          "type": "string",
                                                          "enum": [
                                                            "anonymous_claim",
                                                            "customer_claim",
                                                            "merchant_asserted",
                                                            "verified_evidence",
                                                            "legacy_unknown"
                                                          ]
                                                        }
                                                      },
                                                      "required": [
                                                        "minimum"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "schema",
                                                    "trigger",
                                                    "actions"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ]
                                            },
                                            "bindings": {
                                              "default": [],
                                              "maxItems": 256,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "path": {
                                                    "minItems": 1,
                                                    "maxItems": 32,
                                                    "type": "array",
                                                    "items": {
                                                      "anyOf": [
                                                        {
                                                          "type": "string",
                                                          "minLength": 1
                                                        },
                                                        {
                                                          "type": "integer",
                                                          "minimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      ]
                                                    }
                                                  },
                                                  "kind": {
                                                    "type": "string",
                                                    "enum": [
                                                      "program",
                                                      "currency",
                                                      "rule",
                                                      "tier_level"
                                                    ]
                                                  },
                                                  "key": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 255
                                                  }
                                                },
                                                "required": [
                                                  "path",
                                                  "kind",
                                                  "key"
                                                ],
                                                "additionalProperties": false
                                              }
                                            }
                                          },
                                          "required": [
                                            "version",
                                            "digest"
                                          ],
                                          "additionalProperties": false
                                        }
                                      }
                                    },
                                    "required": [
                                      "key",
                                      "name",
                                      "campaign",
                                      "priority",
                                      "status",
                                      "head",
                                      "versions"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "catalogues": {
                                  "maxItems": 1000,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "key": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                      },
                                      "name": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 255
                                      },
                                      "status": {
                                        "type": "string",
                                        "enum": [
                                          "active",
                                          "disabled"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "key",
                                      "name",
                                      "status"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "offers": {
                                  "maxItems": 10000,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "catalogue": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                      },
                                      "key": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                      },
                                      "version": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "digest": {
                                        "type": "string",
                                        "pattern": "^[a-f0-9]{64}$"
                                      },
                                      "terms": {
                                        "type": "object",
                                        "properties": {
                                          "display": {
                                            "type": "object",
                                            "properties": {
                                              "title": {
                                                "type": "string",
                                                "maxLength": 255
                                              },
                                              "description": {
                                                "type": "string",
                                                "maxLength": 4096
                                              }
                                            },
                                            "additionalProperties": false
                                          },
                                          "currency_id": {
                                            "type": "string",
                                            "pattern": "^[\\x21-\\x7e]{1,255}$"
                                          },
                                          "cost_minor": {
                                            "type": "string",
                                            "pattern": "^(0|[1-9][0-9]{0,18})$"
                                          },
                                          "quantity": {
                                            "type": "number",
                                            "const": 1
                                          },
                                          "eligibility": {
                                            "type": "object",
                                            "properties": {
                                              "audience": {
                                                "maxItems": 64,
                                                "type": "array",
                                                "items": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                }
                                              },
                                              "minimum_assurance": {
                                                "type": "string",
                                                "enum": [
                                                  "anonymous",
                                                  "authenticated_customer"
                                                ]
                                              },
                                              "minimum_tier": {
                                                "type": "object",
                                                "properties": {
                                                  "tier_program": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 255
                                                  },
                                                  "min_level": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 60
                                                  }
                                                },
                                                "required": [
                                                  "tier_program",
                                                  "min_level"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "required": [
                                              "audience",
                                              "minimum_assurance"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "reward": {
                                            "type": "object",
                                            "properties": {
                                              "key": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                              },
                                              "version": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 9007199254740991
                                              },
                                              "digest": {
                                                "type": "string",
                                                "pattern": "^[a-f0-9]{64}$"
                                              }
                                            },
                                            "required": [
                                              "key",
                                              "version",
                                              "digest"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "season": {
                                            "type": "object",
                                            "properties": {
                                              "key": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                              },
                                              "version": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 9007199254740991
                                              },
                                              "digest": {
                                                "type": "string",
                                                "pattern": "^[a-f0-9]{64}$"
                                              }
                                            },
                                            "required": [
                                              "key",
                                              "version",
                                              "digest"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "stock": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "unlimited"
                                                  }
                                                },
                                                "required": [
                                                  "type"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "inventory"
                                                  },
                                                  "inventory_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "inventory_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "code_pool"
                                                  },
                                                  "pool_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "pool_key"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ],
                                            "type": "object"
                                          },
                                          "delivery": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "manual"
                                                  }
                                                },
                                                "required": [
                                                  "type"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "code"
                                                  },
                                                  "pool_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "pool_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "webhook"
                                                  },
                                                  "provider_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "idempotent": {
                                                    "type": "boolean"
                                                  },
                                                  "reconcilable": {
                                                    "type": "boolean"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "provider_key",
                                                  "idempotent",
                                                  "reconcilable"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ],
                                            "type": "object"
                                          },
                                          "quote_ttl_seconds": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 86400
                                          },
                                          "entitlement_ttl_seconds": {
                                            "anyOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 315360000
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "cancellation": {
                                            "type": "string",
                                            "enum": [
                                              "before_commitment",
                                              "proven_reversal"
                                            ]
                                          },
                                          "discount": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "fixed"
                                                  },
                                                  "currency": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "amount_minor": {
                                                    "type": "string",
                                                    "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                  },
                                                  "maximum_minor": {
                                                    "type": "string",
                                                    "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "currency",
                                                  "amount_minor",
                                                  "maximum_minor"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "basis_points"
                                                  },
                                                  "currency": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "basis_points": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 10000
                                                  },
                                                  "maximum_minor": {
                                                    "type": "string",
                                                    "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "currency",
                                                  "basis_points",
                                                  "maximum_minor"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ],
                                            "type": "object"
                                          }
                                        },
                                        "required": [
                                          "display",
                                          "currency_id",
                                          "cost_minor",
                                          "quantity",
                                          "eligibility",
                                          "stock",
                                          "delivery",
                                          "quote_ttl_seconds",
                                          "entitlement_ttl_seconds",
                                          "cancellation"
                                        ],
                                        "additionalProperties": false
                                      },
                                      "bindings": {
                                        "default": [],
                                        "maxItems": 256,
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "path": {
                                              "minItems": 1,
                                              "maxItems": 32,
                                              "type": "array",
                                              "items": {
                                                "anyOf": [
                                                  {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 9007199254740991
                                                  }
                                                ]
                                              }
                                            },
                                            "kind": {
                                              "type": "string",
                                              "enum": [
                                                "program",
                                                "currency",
                                                "rule",
                                                "tier_level"
                                              ]
                                            },
                                            "key": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 255
                                            }
                                          },
                                          "required": [
                                            "path",
                                            "kind",
                                            "key"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "listed": {
                                        "type": "boolean"
                                      },
                                      "revoked": {
                                        "type": "boolean"
                                      }
                                    },
                                    "required": [
                                      "catalogue",
                                      "key",
                                      "version",
                                      "digest",
                                      "terms",
                                      "listed",
                                      "revoked"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "inventories": {
                                  "maxItems": 1000,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "key": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 255
                                      }
                                    },
                                    "required": [
                                      "key"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "code_pools": {
                                  "maxItems": 1000,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "key": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                      },
                                      "inventory": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 255
                                      },
                                      "provider_key": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                      }
                                    },
                                    "required": [
                                      "key",
                                      "inventory",
                                      "provider_key"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "presentation": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "business_type": {
                                          "type": "string",
                                          "enum": [
                                            "game",
                                            "consumer_app",
                                            "store",
                                            "enterprise",
                                            "custom"
                                          ]
                                        },
                                        "default_locale": {
                                          "type": "string"
                                        },
                                        "terminology": {
                                          "type": "object",
                                          "propertyNames": {
                                            "type": "string"
                                          },
                                          "additionalProperties": {
                                            "type": "object",
                                            "properties": {
                                              "singular": {
                                                "type": "string"
                                              },
                                              "plural": {
                                                "type": "string"
                                              },
                                              "locales": {
                                                "type": "object",
                                                "propertyNames": {
                                                  "type": "string"
                                                },
                                                "additionalProperties": {
                                                  "type": "object",
                                                  "properties": {
                                                    "singular": {
                                                      "type": "string"
                                                    },
                                                    "plural": {
                                                      "type": "string"
                                                    }
                                                  },
                                                  "required": [
                                                    "singular",
                                                    "plural"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              }
                                            },
                                            "required": [
                                              "singular",
                                              "plural"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "mechanics": {
                                          "type": "object",
                                          "propertyNames": {
                                            "type": "string"
                                          },
                                          "additionalProperties": {
                                            "type": "string",
                                            "enum": [
                                              "enabled",
                                              "hidden",
                                              "off"
                                            ]
                                          }
                                        }
                                      },
                                      "required": [
                                        "business_type",
                                        "default_locale",
                                        "terminology",
                                        "mechanics"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "trust_policy": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "monetary_currencies": {
                                          "type": "array",
                                          "items": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9_-]+$"
                                          }
                                        },
                                        "caps": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "trust": {
                                                "type": "string",
                                                "enum": [
                                                  "anonymous_claim",
                                                  "customer_claim",
                                                  "merchant_asserted",
                                                  "verified_evidence",
                                                  "legacy_unknown"
                                                ]
                                              },
                                              "currency": {
                                                "type": "string",
                                                "pattern": "^[A-Za-z0-9_-]+$"
                                              },
                                              "scope": {
                                                "type": "string",
                                                "enum": [
                                                  "customer",
                                                  "environment"
                                                ]
                                              },
                                              "window": {
                                                "type": "string",
                                                "enum": [
                                                  "day",
                                                  "month",
                                                  "lifetime"
                                                ]
                                              },
                                              "maximum_minor": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "trust",
                                              "currency",
                                              "scope",
                                              "window",
                                              "maximum_minor"
                                            ],
                                            "additionalProperties": false
                                          }
                                        }
                                      },
                                      "required": [
                                        "monetary_currencies",
                                        "caps"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "assets": {
                                  "default": [],
                                  "maxItems": 1000,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "key": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                      },
                                      "digest": {
                                        "type": "string",
                                        "pattern": "^[a-f0-9]{64}$"
                                      },
                                      "url": {
                                        "type": "string",
                                        "format": "uri"
                                      },
                                      "media_type": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 120
                                      }
                                    },
                                    "required": [
                                      "key",
                                      "digest",
                                      "media_type"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "context": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "business_description": {
                                          "type": [
                                            "string",
                                            "null"
                                          ]
                                        },
                                        "vocabulary": {
                                          "type": "object",
                                          "propertyNames": {
                                            "type": "string"
                                          },
                                          "additionalProperties": {
                                            "$ref": "#/components/schemas/__schema0"
                                          }
                                        },
                                        "glossary": {
                                          "type": "object",
                                          "propertyNames": {
                                            "type": "string"
                                          },
                                          "additionalProperties": {
                                            "$ref": "#/components/schemas/__schema0"
                                          }
                                        }
                                      },
                                      "required": [
                                        "business_description",
                                        "vocabulary",
                                        "glossary"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "schema",
                                "resources",
                                "programs",
                                "seasons",
                                "rules",
                                "catalogues",
                                "offers",
                                "inventories",
                                "code_pools",
                                "presentation",
                                "trust_policy",
                                "context"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "type",
                            "document"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "event_definition.update"
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "definition": {
                              "type": "object",
                              "properties": {
                                "description": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "client_allowed": {
                                  "type": "boolean"
                                },
                                "confirmed_schema": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "propertyNames": {
                                        "type": "string"
                                      },
                                      "additionalProperties": {
                                        "$ref": "#/components/schemas/__schema0"
                                      }
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "schema_enforcement": {
                                  "type": "string",
                                  "enum": [
                                    "off",
                                    "warn",
                                    "enforce"
                                  ]
                                },
                                "minimum_trust": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "enum": [
                                        "anonymous_claim",
                                        "customer_claim",
                                        "merchant_asserted",
                                        "verified_evidence",
                                        "legacy_unknown"
                                      ]
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "fact_policy": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "object_type": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "key": {
                                          "minItems": 1,
                                          "maxItems": 32,
                                          "type": "array",
                                          "items": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)*$"
                                          }
                                        },
                                        "owner": {
                                          "type": "string",
                                          "enum": [
                                            "merchant",
                                            "customer"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "object_type",
                                        "key",
                                        "owner"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "time_policy": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "client": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "const": "received_at"
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "offline_seconds": {
                                                  "type": "integer",
                                                  "minimum": 0,
                                                  "maximum": 2147483647
                                                }
                                              },
                                              "required": [
                                                "offline_seconds"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ]
                                        }
                                      },
                                      "required": [
                                        "client"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "type",
                            "key",
                            "definition"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "segment.update"
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "definition": {
                              "type": "object",
                              "properties": {
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "static",
                                    "dynamic"
                                  ]
                                },
                                "definition": {
                                  "anyOf": [
                                    {
                                      "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "kind",
                                "definition"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "type",
                            "key",
                            "definition"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "presentation.update"
                            },
                            "presentation": {
                              "type": "object",
                              "properties": {
                                "business_type": {
                                  "type": "string",
                                  "enum": [
                                    "game",
                                    "consumer_app",
                                    "store",
                                    "enterprise",
                                    "custom"
                                  ]
                                },
                                "default_locale": {
                                  "type": "string"
                                },
                                "terminology": {
                                  "type": "object",
                                  "propertyNames": {
                                    "type": "string"
                                  },
                                  "additionalProperties": {
                                    "type": "object",
                                    "properties": {
                                      "singular": {
                                        "type": "string"
                                      },
                                      "plural": {
                                        "type": "string"
                                      },
                                      "locales": {
                                        "type": "object",
                                        "propertyNames": {
                                          "type": "string"
                                        },
                                        "additionalProperties": {
                                          "type": "object",
                                          "properties": {
                                            "singular": {
                                              "type": "string"
                                            },
                                            "plural": {
                                              "type": "string"
                                            }
                                          },
                                          "required": [
                                            "singular",
                                            "plural"
                                          ],
                                          "additionalProperties": false
                                        }
                                      }
                                    },
                                    "required": [
                                      "singular",
                                      "plural"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "mechanics": {
                                  "type": "object",
                                  "propertyNames": {
                                    "type": "string"
                                  },
                                  "additionalProperties": {
                                    "type": "string",
                                    "enum": [
                                      "enabled",
                                      "hidden",
                                      "off"
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "business_type",
                                "default_locale",
                                "terminology",
                                "mechanics"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "type",
                            "presentation"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "program.publish_version"
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "version": {
                              "type": "object",
                              "properties": {
                                "version": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "digest": {
                                  "type": "string",
                                  "pattern": "^[a-f0-9]{64}$"
                                },
                                "definition": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "schema": {
                                          "type": "string",
                                          "const": "orishare.program/v1"
                                        },
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "tier",
                                            "quest",
                                            "campaign",
                                            "reward",
                                            "streak",
                                            "badge",
                                            "leaderboard",
                                            "referral"
                                          ]
                                        },
                                        "semantics": {
                                          "type": "string",
                                          "enum": [
                                            "native_v2",
                                            "compat_v1"
                                          ]
                                        },
                                        "definition": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "const": "tier"
                                                },
                                                "legacy": {
                                                  "type": "object",
                                                  "propertyNames": {
                                                    "type": "string"
                                                  },
                                                  "additionalProperties": {
                                                    "$ref": "#/components/schemas/__schema2"
                                                  }
                                                },
                                                "currency": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "basis": {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "lifetime_earned"
                                                        }
                                                      },
                                                      "required": [
                                                        "type"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "balance"
                                                        }
                                                      },
                                                      "required": [
                                                        "type"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "earned_rolling_days"
                                                        },
                                                        "days": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "days"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "earned_calendar_year"
                                                        }
                                                      },
                                                      "required": [
                                                        "type"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "earned_anniversary_year"
                                                        }
                                                      },
                                                      "required": [
                                                        "type"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  ],
                                                  "type": "object"
                                                },
                                                "downgrade_check": {
                                                  "type": "string",
                                                  "enum": [
                                                    "daily",
                                                    "monthly",
                                                    "never"
                                                  ]
                                                },
                                                "levels": {
                                                  "minItems": 1,
                                                  "type": "array",
                                                  "items": {
                                                    "type": "object",
                                                    "properties": {
                                                      "key": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      },
                                                      "threshold": {
                                                        "type": "integer",
                                                        "minimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "key",
                                                      "threshold"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "currency",
                                                "basis",
                                                "downgrade_check",
                                                "levels"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "const": "quest"
                                                },
                                                "legacy": {
                                                  "type": "object",
                                                  "propertyNames": {
                                                    "type": "string"
                                                  },
                                                  "additionalProperties": {
                                                    "$ref": "#/components/schemas/__schema2"
                                                  }
                                                },
                                                "steps": {
                                                  "minItems": 1,
                                                  "type": "array",
                                                  "items": {
                                                    "type": "object",
                                                    "properties": {
                                                      "key": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      },
                                                      "aggregation": {
                                                        "type": "string",
                                                        "enum": [
                                                          "count",
                                                          "sum"
                                                        ]
                                                      },
                                                      "target": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "key",
                                                      "aggregation",
                                                      "target"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "repeatable": {
                                                  "type": "boolean"
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "steps",
                                                "repeatable"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "const": "campaign"
                                                },
                                                "legacy": {
                                                  "type": "object",
                                                  "propertyNames": {
                                                    "type": "string"
                                                  },
                                                  "additionalProperties": {
                                                    "$ref": "#/components/schemas/__schema2"
                                                  }
                                                },
                                                "priority": {
                                                  "default": 0,
                                                  "type": "integer",
                                                  "minimum": -9007199254740991,
                                                  "maximum": 9007199254740991
                                                }
                                              },
                                              "required": [
                                                "kind"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "const": "reward"
                                                },
                                                "legacy": {
                                                  "type": "object",
                                                  "propertyNames": {
                                                    "type": "string"
                                                  },
                                                  "additionalProperties": {
                                                    "$ref": "#/components/schemas/__schema2"
                                                  }
                                                },
                                                "reward": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "reward"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "const": "streak"
                                                },
                                                "target": {
                                                  "type": "integer",
                                                  "exclusiveMinimum": 0,
                                                  "maximum": 9007199254740991
                                                },
                                                "freezes": {
                                                  "default": 0,
                                                  "type": "integer",
                                                  "minimum": 0,
                                                  "maximum": 9007199254740991
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "target"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "const": "badge"
                                                },
                                                "repeatable": {
                                                  "default": false,
                                                  "type": "boolean"
                                                }
                                              },
                                              "required": [
                                                "kind"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "const": "leaderboard"
                                                },
                                                "aggregation": {
                                                  "type": "string",
                                                  "enum": [
                                                    "sum",
                                                    "max",
                                                    "count"
                                                  ]
                                                },
                                                "order": {
                                                  "type": "string",
                                                  "enum": [
                                                    "ascending",
                                                    "descending"
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "aggregation",
                                                "order"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "const": "referral"
                                                },
                                                "target": {
                                                  "type": "integer",
                                                  "exclusiveMinimum": 0,
                                                  "maximum": 9007199254740991
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "target"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "type": "object"
                                        },
                                        "qualification": {
                                          "type": "object",
                                          "properties": {
                                            "sources": {
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "event": {
                                                    "type": "string",
                                                    "minLength": 1
                                                  },
                                                  "conditions": {
                                                    "$ref": "#/components/schemas/__schema3"
                                                  },
                                                  "value": {
                                                    "anyOf": [
                                                      {
                                                        "type": "number"
                                                      },
                                                      {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    ]
                                                  },
                                                  "step": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "occurrence": {
                                                    "default": "lifetime",
                                                    "type": "string",
                                                    "enum": [
                                                      "lifetime",
                                                      "period"
                                                    ]
                                                  }
                                                },
                                                "required": [
                                                  "event"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "audience": {
                                              "type": "array",
                                              "items": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                              }
                                            },
                                            "starts_at": {
                                              "type": "string",
                                              "format": "date-time",
                                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                            },
                                            "ends_at": {
                                              "type": "string",
                                              "format": "date-time",
                                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                            },
                                            "campaign": {
                                              "type": "string",
                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                            }
                                          },
                                          "required": [
                                            "sources"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "calendar": {
                                          "type": "object",
                                          "properties": {
                                            "schema": {
                                              "type": "string",
                                              "const": "orishare.calendar/v1"
                                            },
                                            "period": {
                                              "anyOf": [
                                                {
                                                  "type": "string",
                                                  "enum": [
                                                    "none",
                                                    "day",
                                                    "week",
                                                    "month",
                                                    "year"
                                                  ]
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "const": "season"
                                                    },
                                                    "starts_at": {
                                                      "type": "string",
                                                      "format": "date-time",
                                                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                    },
                                                    "ends_at": {
                                                      "type": "string",
                                                      "format": "date-time",
                                                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "starts_at",
                                                    "ends_at"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ]
                                            },
                                            "run_per_period": {
                                              "type": "boolean"
                                            },
                                            "timezone_source": {
                                              "type": "string",
                                              "enum": [
                                                "environment",
                                                "customer",
                                                "fixed"
                                              ]
                                            },
                                            "timezone": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "day_start_offset_minutes": {
                                              "default": 0,
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 1439
                                            },
                                            "ambiguous_local_time": {
                                              "type": "string",
                                              "const": "earlier"
                                            },
                                            "nonexistent_local_time": {
                                              "type": "string",
                                              "const": "next_valid"
                                            },
                                            "event_time": {
                                              "type": "object",
                                              "properties": {
                                                "merchant": {
                                                  "type": "string",
                                                  "const": "occurred_at"
                                                },
                                                "client": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string",
                                                      "const": "received_at"
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "offline_seconds": {
                                                          "type": "integer",
                                                          "minimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "offline_seconds"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "merchant",
                                                "client"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "grace_seconds": {
                                              "default": 0,
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 9007199254740991
                                            },
                                            "max_lateness_seconds": {
                                              "default": 0,
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 9007199254740991
                                            },
                                            "settlement_delay_seconds": {
                                              "default": 0,
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 9007199254740991
                                            },
                                            "after_finalization": {
                                              "type": "string",
                                              "const": "correction_only"
                                            }
                                          },
                                          "required": [
                                            "schema",
                                            "period",
                                            "run_per_period",
                                            "timezone_source",
                                            "ambiguous_local_time",
                                            "nonexistent_local_time",
                                            "event_time",
                                            "after_finalization"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "trust": {
                                          "type": "object",
                                          "properties": {
                                            "minimum_trust": {
                                              "type": "string",
                                              "enum": [
                                                "anonymous_claim",
                                                "customer_claim",
                                                "merchant_asserted",
                                                "verified_evidence",
                                                "legacy_unknown"
                                              ]
                                            },
                                            "allowed_sources": {
                                              "minItems": 1,
                                              "type": "array",
                                              "items": {
                                                "type": "string",
                                                "enum": [
                                                  "publishable_event",
                                                  "secret_key_event",
                                                  "verified_connector",
                                                  "operator_command",
                                                  "customer_command",
                                                  "import",
                                                  "program_transition",
                                                  "schedule"
                                                ]
                                              }
                                            },
                                            "on_insufficient": {
                                              "type": "string",
                                              "enum": [
                                                "ignore",
                                                "progress_without_reward"
                                              ]
                                            },
                                            "liability_caps": {
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "trust": {
                                                    "type": "string",
                                                    "enum": [
                                                      "anonymous_claim",
                                                      "customer_claim",
                                                      "merchant_asserted",
                                                      "verified_evidence",
                                                      "legacy_unknown"
                                                    ]
                                                  },
                                                  "currency": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "scope": {
                                                    "type": "string",
                                                    "enum": [
                                                      "customer",
                                                      "environment"
                                                    ]
                                                  },
                                                  "window": {
                                                    "type": "string",
                                                    "enum": [
                                                      "day",
                                                      "month",
                                                      "lifetime"
                                                    ]
                                                  },
                                                  "maximum_minor": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 9007199254740991
                                                  }
                                                },
                                                "required": [
                                                  "trust",
                                                  "currency",
                                                  "scope",
                                                  "window",
                                                  "maximum_minor"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "recognition_caps": {
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "trust": {
                                                    "type": "string",
                                                    "enum": [
                                                      "anonymous_claim",
                                                      "customer_claim",
                                                      "merchant_asserted",
                                                      "verified_evidence",
                                                      "legacy_unknown"
                                                    ]
                                                  },
                                                  "per": {
                                                    "type": "string",
                                                    "enum": [
                                                      "period",
                                                      "day"
                                                    ]
                                                  },
                                                  "contributions": {
                                                    "type": "integer",
                                                    "exclusiveMinimum": 0,
                                                    "maximum": 9007199254740991
                                                  },
                                                  "value": {
                                                    "type": "integer",
                                                    "exclusiveMinimum": 0,
                                                    "maximum": 9007199254740991
                                                  }
                                                },
                                                "required": [
                                                  "trust",
                                                  "per"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "allow_legacy_unknown": {
                                              "type": "boolean",
                                              "const": false
                                            }
                                          },
                                          "required": [
                                            "minimum_trust",
                                            "allowed_sources",
                                            "on_insufficient",
                                            "liability_caps",
                                            "recognition_caps",
                                            "allow_legacy_unknown"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "correction": {
                                          "type": "object",
                                          "properties": {
                                            "qualification": {
                                              "default": "reverse",
                                              "type": "string",
                                              "enum": [
                                                "reverse",
                                                "keep"
                                              ]
                                            },
                                            "spendable": {
                                              "type": "string",
                                              "const": "reverse"
                                            },
                                            "xp": {
                                              "default": "reverse",
                                              "type": "string",
                                              "enum": [
                                                "reverse",
                                                "keep"
                                              ]
                                            },
                                            "recognition": {
                                              "default": "keep",
                                              "type": "string",
                                              "enum": [
                                                "keep",
                                                "revoke_on_fraud"
                                              ]
                                            },
                                            "after_finalization": {
                                              "default": "correcting_revision",
                                              "type": "string",
                                              "const": "correcting_revision"
                                            },
                                            "allowance_on_refund": {
                                              "default": "consumed",
                                              "type": "string",
                                              "enum": [
                                                "consumed",
                                                "release_on_verified_void"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "spendable"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "reward": {
                                          "type": "object",
                                          "properties": {
                                            "on": {
                                              "type": "object",
                                              "propertyNames": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]*(?::[a-z0-9_]+)?$"
                                              },
                                              "additionalProperties": {
                                                "type": "array",
                                                "items": {
                                                  "anyOf": [
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "points.award"
                                                        },
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount": {
                                                          "anyOf": [
                                                            {
                                                              "type": "number"
                                                            },
                                                            {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          ]
                                                        },
                                                        "reason": {
                                                          "type": "string",
                                                          "maxLength": 200
                                                        },
                                                        "confirm_after": {
                                                          "type": "string",
                                                          "pattern": "^\\d+[smhdw]$"
                                                        },
                                                        "expires_after": {
                                                          "type": "string",
                                                          "pattern": "^\\d+[smhdw]$"
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "currency",
                                                        "amount",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "points.deduct"
                                                        },
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount": {
                                                          "anyOf": [
                                                            {
                                                              "type": "number"
                                                            },
                                                            {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          ]
                                                        },
                                                        "reason": {
                                                          "type": "string",
                                                          "maxLength": 200
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "currency",
                                                        "amount",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "points.reverse"
                                                        },
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "match": {
                                                          "type": "object",
                                                          "properties": {
                                                            "event": {
                                                              "type": "string",
                                                              "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                            },
                                                            "on": {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          },
                                                          "required": [
                                                            "event",
                                                            "on"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        "fraction": {
                                                          "anyOf": [
                                                            {
                                                              "type": "number"
                                                            },
                                                            {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          ]
                                                        },
                                                        "amount": {
                                                          "anyOf": [
                                                            {
                                                              "type": "number"
                                                            },
                                                            {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          ]
                                                        },
                                                        "reason": {
                                                          "type": "string",
                                                          "maxLength": 200
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "currency",
                                                        "match",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "reward.issue"
                                                        },
                                                        "reward": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "reward",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "tier.evaluate"
                                                        },
                                                        "program": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "program",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "attribute.set"
                                                        },
                                                        "attribute": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "value": {
                                                          "type": [
                                                            "string",
                                                            "number",
                                                            "boolean",
                                                            "null"
                                                          ]
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "attribute",
                                                        "value",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "webhook.emit"
                                                        },
                                                        "event": {
                                                          "type": "string",
                                                          "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                        },
                                                        "payload": {
                                                          "type": "object",
                                                          "propertyNames": {
                                                            "type": "string"
                                                          },
                                                          "additionalProperties": {
                                                            "anyOf": [
                                                              {
                                                                "type": [
                                                                  "string",
                                                                  "number",
                                                                  "boolean"
                                                                ]
                                                              },
                                                              {
                                                                "type": "null"
                                                              },
                                                              {
                                                                "type": "array",
                                                                "items": {
                                                                  "type": [
                                                                    "string",
                                                                    "number",
                                                                    "boolean"
                                                                  ]
                                                                }
                                                              }
                                                            ]
                                                          }
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "event",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "badge.grant"
                                                        },
                                                        "badge": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "occurrence": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "badge",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "streak.contribute"
                                                        },
                                                        "streak": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "value": {
                                                          "anyOf": [
                                                            {
                                                              "type": "number"
                                                            },
                                                            {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          ]
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "streak",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "streak.freeze_grant"
                                                        },
                                                        "streak": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "quantity": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "streak",
                                                        "quantity",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "quest.contribute"
                                                        },
                                                        "quest": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "step": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "value": {
                                                          "anyOf": [
                                                            {
                                                              "type": "number"
                                                            },
                                                            {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          ]
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "quest",
                                                        "step",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "quest.enroll"
                                                        },
                                                        "quest": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "quest",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "leaderboard.contribute"
                                                        },
                                                        "leaderboard": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "value": {
                                                          "anyOf": [
                                                            {
                                                              "type": "number"
                                                            },
                                                            {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          ]
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "leaderboard",
                                                        "value",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "program.reverse_contribution"
                                                        },
                                                        "program": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "source_fact": {
                                                          "anyOf": [
                                                            {
                                                              "type": "object",
                                                              "properties": {
                                                                "fact_id": {
                                                                  "type": "string",
                                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                                }
                                                              },
                                                              "required": [
                                                                "fact_id"
                                                              ],
                                                              "additionalProperties": false
                                                            },
                                                            {
                                                              "type": "object",
                                                              "properties": {
                                                                "object_type": {
                                                                  "type": "string",
                                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                                },
                                                                "key": {
                                                                  "minItems": 1,
                                                                  "type": "array",
                                                                  "items": {
                                                                    "type": "string",
                                                                    "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_-]*(?:\\.[A-Za-z_][A-Za-z0-9_-]*)*$"
                                                                  }
                                                                }
                                                              },
                                                              "required": [
                                                                "object_type",
                                                                "key"
                                                              ],
                                                              "additionalProperties": false
                                                            }
                                                          ]
                                                        },
                                                        "fraction": {
                                                          "type": "string",
                                                          "pattern": "^(?:0(?:\\.\\d+)?|1(?:\\.0+)?)$"
                                                        },
                                                        "amount": {
                                                          "type": "number",
                                                          "exclusiveMinimum": 0
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "program",
                                                        "source_fact",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  ]
                                                }
                                              }
                                            }
                                          },
                                          "required": [
                                            "on"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "display": {
                                          "type": "object",
                                          "properties": {
                                            "title": {
                                              "type": "string"
                                            },
                                            "description": {
                                              "type": "string"
                                            },
                                            "image_url": {
                                              "type": "string",
                                              "format": "uri"
                                            },
                                            "icon": {
                                              "type": "string"
                                            },
                                            "color": {
                                              "type": "string"
                                            },
                                            "sort_order": {
                                              "default": 0,
                                              "type": "integer",
                                              "minimum": -9007199254740991,
                                              "maximum": 9007199254740991
                                            },
                                            "hidden": {
                                              "default": false,
                                              "type": "boolean"
                                            },
                                            "locales": {
                                              "default": {},
                                              "type": "object",
                                              "propertyNames": {
                                                "type": "string",
                                                "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
                                              },
                                              "additionalProperties": {
                                                "type": "object",
                                                "properties": {
                                                  "title": {
                                                    "type": "string"
                                                  },
                                                  "description": {
                                                    "type": "string"
                                                  }
                                                },
                                                "additionalProperties": false
                                              }
                                            }
                                          },
                                          "additionalProperties": false
                                        },
                                        "enrollment": {
                                          "type": "object",
                                          "properties": {
                                            "mode": {
                                              "default": "automatic",
                                              "type": "string",
                                              "enum": [
                                                "automatic",
                                                "explicit"
                                              ]
                                            }
                                          },
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "schema",
                                        "kind",
                                        "semantics",
                                        "definition",
                                        "qualification",
                                        "calendar",
                                        "trust",
                                        "correction",
                                        "reward",
                                        "display",
                                        "enrollment"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "schema": {
                                          "type": "string",
                                          "const": "orishare.program/v2"
                                        },
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "tier",
                                            "quest",
                                            "campaign",
                                            "reward",
                                            "streak",
                                            "badge",
                                            "leaderboard",
                                            "referral"
                                          ]
                                        },
                                        "semantics": {
                                          "type": "string",
                                          "const": "native_v2"
                                        },
                                        "definition": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "const": "streak"
                                                },
                                                "qualification": {
                                                  "type": "object",
                                                  "properties": {
                                                    "aggregation": {
                                                      "type": "string",
                                                      "enum": [
                                                        "count",
                                                        "sum"
                                                      ]
                                                    },
                                                    "minimum": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                    }
                                                  },
                                                  "required": [
                                                    "aggregation",
                                                    "minimum"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "freezes": {
                                                  "type": "object",
                                                  "properties": {
                                                    "ceiling": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 1000
                                                    },
                                                    "auto_use": {
                                                      "default": true,
                                                      "type": "boolean"
                                                    },
                                                    "purchase": {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "string",
                                                          "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "ceiling"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "milestones": {
                                                  "maxItems": 64,
                                                  "type": "array",
                                                  "items": {
                                                    "type": "object",
                                                    "properties": {
                                                      "key": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      },
                                                      "threshold": {
                                                        "type": "integer",
                                                        "minimum": 1,
                                                        "maximum": 9007199254740991
                                                      },
                                                      "occurrence": {
                                                        "type": "string",
                                                        "enum": [
                                                          "lifetime",
                                                          "episode"
                                                        ]
                                                      }
                                                    },
                                                    "required": [
                                                      "key",
                                                      "threshold",
                                                      "occurrence"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "repair": {
                                                  "type": "object",
                                                  "properties": {
                                                    "price": {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "string",
                                                          "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "window_periods": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 30
                                                    },
                                                    "maximum_per_days": {
                                                      "type": "object",
                                                      "properties": {
                                                        "count": {
                                                          "type": "integer",
                                                          "minimum": 1,
                                                          "maximum": 1000
                                                        },
                                                        "days": {
                                                          "type": "integer",
                                                          "minimum": 1,
                                                          "maximum": 366
                                                        }
                                                      },
                                                      "required": [
                                                        "count",
                                                        "days"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "price",
                                                    "window_periods"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "protected_weekdays": {
                                                  "minItems": 1,
                                                  "maxItems": 6,
                                                  "type": "array",
                                                  "items": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 6
                                                  }
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "qualification",
                                                "freezes",
                                                "milestones"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "const": "badge"
                                                },
                                                "qualification": {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "aggregation": {
                                                          "type": "string",
                                                          "const": "count"
                                                        }
                                                      },
                                                      "required": [
                                                        "aggregation"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "aggregation": {
                                                          "type": "string",
                                                          "const": "sum"
                                                        }
                                                      },
                                                      "required": [
                                                        "aggregation"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "aggregation": {
                                                          "type": "string",
                                                          "const": "distinct"
                                                        },
                                                        "distinct_key": {
                                                          "type": "string",
                                                          "maxLength": 255,
                                                          "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                                        }
                                                      },
                                                      "required": [
                                                        "aggregation",
                                                        "distinct_key"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  ],
                                                  "type": "object"
                                                },
                                                "ranks": {
                                                  "minItems": 1,
                                                  "maxItems": 64,
                                                  "type": "array",
                                                  "items": {
                                                    "type": "object",
                                                    "properties": {
                                                      "key": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      },
                                                      "threshold": {
                                                        "type": "string",
                                                        "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                      },
                                                      "display": {
                                                        "type": "object",
                                                        "properties": {
                                                          "title": {
                                                            "type": "string",
                                                            "maxLength": 255
                                                          },
                                                          "description": {
                                                            "type": "string",
                                                            "maxLength": 4096
                                                          }
                                                        },
                                                        "additionalProperties": false
                                                      }
                                                    },
                                                    "required": [
                                                      "key",
                                                      "threshold"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "visibility": {
                                                  "type": "string",
                                                  "enum": [
                                                    "visible",
                                                    "hidden_until_earned"
                                                  ]
                                                },
                                                "collection": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "repeatable": {
                                                  "type": "boolean"
                                                },
                                                "occurrence": {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "lifetime"
                                                        }
                                                      },
                                                      "required": [
                                                        "type"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "period"
                                                        }
                                                      },
                                                      "required": [
                                                        "type"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "season"
                                                        }
                                                      },
                                                      "required": [
                                                        "type"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "verified_fact"
                                                        }
                                                      },
                                                      "required": [
                                                        "type"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  ],
                                                  "type": "object"
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "qualification",
                                                "ranks",
                                                "visibility",
                                                "repeatable",
                                                "occurrence"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "const": "quest"
                                                },
                                                "steps": {
                                                  "minItems": 1,
                                                  "maxItems": 32,
                                                  "type": "array",
                                                  "items": {
                                                    "type": "object",
                                                    "properties": {
                                                      "key": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      },
                                                      "aggregation": {
                                                        "type": "string",
                                                        "enum": [
                                                          "count",
                                                          "sum",
                                                          "distinct"
                                                        ]
                                                      },
                                                      "target": {
                                                        "type": "string",
                                                        "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                      },
                                                      "distinct_key": {
                                                        "type": "string",
                                                        "maxLength": 255,
                                                        "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                                      },
                                                      "display": {
                                                        "type": "object",
                                                        "properties": {
                                                          "title": {
                                                            "type": "string",
                                                            "maxLength": 255
                                                          },
                                                          "description": {
                                                            "type": "string",
                                                            "maxLength": 4096
                                                          }
                                                        },
                                                        "additionalProperties": false
                                                      },
                                                      "available_from": {
                                                        "type": "string",
                                                        "format": "date-time",
                                                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                      },
                                                      "deadline": {
                                                        "type": "string",
                                                        "format": "date-time",
                                                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                      }
                                                    },
                                                    "required": [
                                                      "key",
                                                      "aggregation",
                                                      "target",
                                                      "display"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "prerequisites": {
                                                  "maxItems": 64,
                                                  "type": "array",
                                                  "items": {
                                                    "type": "object",
                                                    "properties": {
                                                      "step": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      },
                                                      "requires": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      }
                                                    },
                                                    "required": [
                                                      "step",
                                                      "requires"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "collection": {
                                                  "type": "string",
                                                  "enum": [
                                                    "auto_collect",
                                                    "claim"
                                                  ]
                                                },
                                                "repeatable": {
                                                  "type": "boolean"
                                                },
                                                "claim_deadline": {
                                                  "type": "string",
                                                  "format": "date-time",
                                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                },
                                                "chain": {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "const": "program"
                                                    },
                                                    "key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "version": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 9007199254740991
                                                    },
                                                    "digest": {
                                                      "type": "string",
                                                      "pattern": "^[a-f0-9]{64}$"
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "key",
                                                    "version",
                                                    "digest"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "rotation": {
                                                  "type": "object",
                                                  "properties": {
                                                    "candidates": {
                                                      "minItems": 1,
                                                      "maxItems": 100,
                                                      "type": "array",
                                                      "items": {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "program"
                                                          },
                                                          "key": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                          },
                                                          "version": {
                                                            "type": "integer",
                                                            "minimum": 1,
                                                            "maximum": 9007199254740991
                                                          },
                                                          "digest": {
                                                            "type": "string",
                                                            "pattern": "^[a-f0-9]{64}$"
                                                          }
                                                        },
                                                        "required": [
                                                          "kind",
                                                          "key",
                                                          "version",
                                                          "digest"
                                                        ],
                                                        "additionalProperties": false
                                                      }
                                                    },
                                                    "select": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 100
                                                    }
                                                  },
                                                  "required": [
                                                    "candidates",
                                                    "select"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "steps",
                                                "prerequisites",
                                                "collection",
                                                "repeatable"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "const": "tier"
                                                },
                                                "currency": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "basis": {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "lifetime_earned"
                                                        }
                                                      },
                                                      "required": [
                                                        "type"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "balance"
                                                        }
                                                      },
                                                      "required": [
                                                        "type"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "earned_rolling_days"
                                                        },
                                                        "days": {
                                                          "type": "integer",
                                                          "minimum": 1,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "days"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  ],
                                                  "type": "object"
                                                },
                                                "downgrade_check": {
                                                  "type": "string",
                                                  "enum": [
                                                    "daily",
                                                    "monthly",
                                                    "never"
                                                  ]
                                                },
                                                "levels": {
                                                  "minItems": 1,
                                                  "maxItems": 1000,
                                                  "type": "array",
                                                  "items": {
                                                    "type": "object",
                                                    "properties": {
                                                      "key": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      },
                                                      "threshold": {
                                                        "type": "string",
                                                        "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                      },
                                                      "display": {
                                                        "type": "object",
                                                        "properties": {
                                                          "title": {
                                                            "type": "string",
                                                            "maxLength": 255
                                                          },
                                                          "description": {
                                                            "type": "string",
                                                            "maxLength": 4096
                                                          }
                                                        },
                                                        "additionalProperties": false
                                                      }
                                                    },
                                                    "required": [
                                                      "key",
                                                      "threshold",
                                                      "display"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "occurrence": {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "lifetime"
                                                        }
                                                      },
                                                      "required": [
                                                        "type"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "season"
                                                        }
                                                      },
                                                      "required": [
                                                        "type"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "prestige"
                                                        },
                                                        "maximum_runs": {
                                                          "type": "integer",
                                                          "minimum": 1,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "maximum_runs"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  ],
                                                  "type": "object"
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "currency",
                                                "basis",
                                                "downgrade_check",
                                                "levels",
                                                "occurrence"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "const": "leaderboard"
                                                },
                                                "aggregation": {
                                                  "type": "string",
                                                  "enum": [
                                                    "sum",
                                                    "max",
                                                    "latest_verified"
                                                  ]
                                                },
                                                "input": {
                                                  "type": "object",
                                                  "properties": {
                                                    "minimum": {
                                                      "type": "string",
                                                      "pattern": "^(0|-?[1-9][0-9]{0,18})$"
                                                    },
                                                    "maximum": {
                                                      "type": "string",
                                                      "pattern": "^(0|-?[1-9][0-9]{0,18})$"
                                                    }
                                                  },
                                                  "required": [
                                                    "minimum",
                                                    "maximum"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "order": {
                                                  "type": "string",
                                                  "enum": [
                                                    "ascending",
                                                    "descending"
                                                  ]
                                                },
                                                "scope": {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "global"
                                                        }
                                                      },
                                                      "required": [
                                                        "type"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "segment"
                                                        },
                                                        "segment": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "segment"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "group_key"
                                                        },
                                                        "key": {
                                                          "type": "string",
                                                          "maxLength": 255,
                                                          "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "key"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  ],
                                                  "type": "object"
                                                },
                                                "rank": {
                                                  "type": "string",
                                                  "const": "ordinal"
                                                },
                                                "privacy": {
                                                  "type": "object",
                                                  "properties": {
                                                    "display": {
                                                      "type": "string",
                                                      "const": "pseudonymous"
                                                    },
                                                    "opt_out": {
                                                      "type": "boolean",
                                                      "const": true
                                                    },
                                                    "anonymous_entries": {
                                                      "type": "boolean",
                                                      "const": false
                                                    }
                                                  },
                                                  "required": [
                                                    "display",
                                                    "opt_out",
                                                    "anonymous_entries"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "prizes": {
                                                  "maxItems": 100,
                                                  "type": "array",
                                                  "items": {
                                                    "type": "object",
                                                    "properties": {
                                                      "key": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      },
                                                      "from": {
                                                        "type": "integer",
                                                        "minimum": 1,
                                                        "maximum": 1000
                                                      },
                                                      "through": {
                                                        "type": "integer",
                                                        "minimum": 1,
                                                        "maximum": 1000
                                                      },
                                                      "awards": {
                                                        "minItems": 1,
                                                        "maxItems": 16,
                                                        "type": "array",
                                                        "items": {
                                                          "oneOf": [
                                                            {
                                                              "type": "object",
                                                              "properties": {
                                                                "currency": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                },
                                                                "amount_minor": {
                                                                  "type": "string",
                                                                  "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                                },
                                                                "type": {
                                                                  "type": "string",
                                                                  "const": "currency"
                                                                }
                                                              },
                                                              "required": [
                                                                "currency",
                                                                "amount_minor",
                                                                "type"
                                                              ],
                                                              "additionalProperties": false
                                                            },
                                                            {
                                                              "type": "object",
                                                              "properties": {
                                                                "type": {
                                                                  "type": "string",
                                                                  "const": "reward"
                                                                },
                                                                "reward": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                                },
                                                                "quantity": {
                                                                  "type": "number",
                                                                  "const": 1
                                                                }
                                                              },
                                                              "required": [
                                                                "type",
                                                                "reward",
                                                                "quantity"
                                                              ],
                                                              "additionalProperties": false
                                                            },
                                                            {
                                                              "type": "object",
                                                              "properties": {
                                                                "type": {
                                                                  "type": "string",
                                                                  "const": "item"
                                                                },
                                                                "item": {
                                                                  "type": "string",
                                                                  "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                                },
                                                                "quantity": {
                                                                  "type": "integer",
                                                                  "minimum": 1,
                                                                  "maximum": 1000
                                                                }
                                                              },
                                                              "required": [
                                                                "type",
                                                                "item",
                                                                "quantity"
                                                              ],
                                                              "additionalProperties": false
                                                            }
                                                          ],
                                                          "type": "object"
                                                        }
                                                      }
                                                    },
                                                    "required": [
                                                      "key",
                                                      "from",
                                                      "through",
                                                      "awards"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "score_source": {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "contributions"
                                                        }
                                                      },
                                                      "required": [
                                                        "type"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "currency_earned"
                                                        },
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "currency"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "currency_balance"
                                                        },
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "currency"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  ],
                                                  "type": "object"
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "aggregation",
                                                "input",
                                                "order",
                                                "scope",
                                                "rank",
                                                "privacy",
                                                "prizes"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "const": "referral"
                                                },
                                                "attribution_window_seconds": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 9007199254740991
                                                },
                                                "account_eligibility": {
                                                  "type": "string",
                                                  "enum": [
                                                    "new",
                                                    "existing",
                                                    "any"
                                                  ]
                                                },
                                                "new_account_window_seconds": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 9007199254740991
                                                },
                                                "allow_anonymous_claim": {
                                                  "type": "boolean"
                                                },
                                                "qualifying_event": {
                                                  "type": "string",
                                                  "maxLength": 255,
                                                  "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                },
                                                "minimum": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "cooling_off_seconds": {
                                                  "type": "integer",
                                                  "minimum": 0,
                                                  "maximum": 9007199254740991
                                                },
                                                "rewards": {
                                                  "type": "object",
                                                  "properties": {
                                                    "referrer": {
                                                      "minItems": 1,
                                                      "maxItems": 16,
                                                      "type": "array",
                                                      "items": {
                                                        "oneOf": [
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "currency": {
                                                                "type": "string",
                                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                              },
                                                              "amount_minor": {
                                                                "type": "string",
                                                                "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                              },
                                                              "type": {
                                                                "type": "string",
                                                                "const": "currency"
                                                              }
                                                            },
                                                            "required": [
                                                              "currency",
                                                              "amount_minor",
                                                              "type"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "reward"
                                                              },
                                                              "reward": {
                                                                "type": "string",
                                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                              },
                                                              "quantity": {
                                                                "type": "number",
                                                                "const": 1
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "reward",
                                                              "quantity"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "item"
                                                              },
                                                              "item": {
                                                                "type": "string",
                                                                "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                              },
                                                              "quantity": {
                                                                "type": "integer",
                                                                "minimum": 1,
                                                                "maximum": 1000
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "item",
                                                              "quantity"
                                                            ],
                                                            "additionalProperties": false
                                                          }
                                                        ],
                                                        "type": "object"
                                                      }
                                                    },
                                                    "referred": {
                                                      "minItems": 1,
                                                      "maxItems": 16,
                                                      "type": "array",
                                                      "items": {
                                                        "oneOf": [
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "currency": {
                                                                "type": "string",
                                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                              },
                                                              "amount_minor": {
                                                                "type": "string",
                                                                "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                              },
                                                              "type": {
                                                                "type": "string",
                                                                "const": "currency"
                                                              }
                                                            },
                                                            "required": [
                                                              "currency",
                                                              "amount_minor",
                                                              "type"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "reward"
                                                              },
                                                              "reward": {
                                                                "type": "string",
                                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                              },
                                                              "quantity": {
                                                                "type": "number",
                                                                "const": 1
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "reward",
                                                              "quantity"
                                                            ],
                                                            "additionalProperties": false
                                                          },
                                                          {
                                                            "type": "object",
                                                            "properties": {
                                                              "type": {
                                                                "type": "string",
                                                                "const": "item"
                                                              },
                                                              "item": {
                                                                "type": "string",
                                                                "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                              },
                                                              "quantity": {
                                                                "type": "integer",
                                                                "minimum": 1,
                                                                "maximum": 1000
                                                              }
                                                            },
                                                            "required": [
                                                              "type",
                                                              "item",
                                                              "quantity"
                                                            ],
                                                            "additionalProperties": false
                                                          }
                                                        ],
                                                        "type": "object"
                                                      }
                                                    }
                                                  },
                                                  "required": [
                                                    "referrer",
                                                    "referred"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "caps": {
                                                  "type": "object",
                                                  "properties": {
                                                    "per_referrer": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 9007199254740991
                                                    },
                                                    "per_environment": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "per_referrer",
                                                    "per_environment"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "refund": {
                                                  "type": "string",
                                                  "const": "proportional_then_invalidate"
                                                },
                                                "approval": {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "mode": {
                                                          "type": "string",
                                                          "const": "review"
                                                        }
                                                      },
                                                      "required": [
                                                        "mode"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "mode": {
                                                          "type": "string",
                                                          "const": "automatic"
                                                        },
                                                        "period_seconds": {
                                                          "type": "integer",
                                                          "minimum": 1,
                                                          "maximum": 2678400
                                                        },
                                                        "max_per_referrer_per_period": {
                                                          "type": "integer",
                                                          "minimum": 1,
                                                          "maximum": 9007199254740991
                                                        },
                                                        "max_per_period": {
                                                          "type": "integer",
                                                          "minimum": 1,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "mode",
                                                        "period_seconds",
                                                        "max_per_referrer_per_period",
                                                        "max_per_period"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  ],
                                                  "type": "object"
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "attribution_window_seconds",
                                                "account_eligibility",
                                                "allow_anonymous_claim",
                                                "qualifying_event",
                                                "minimum",
                                                "cooling_off_seconds",
                                                "rewards",
                                                "caps",
                                                "refund"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "const": "campaign"
                                                },
                                                "priority": {
                                                  "type": "integer",
                                                  "minimum": -2147483648,
                                                  "maximum": 2147483647
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "priority"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "const": "reward"
                                                },
                                                "reward": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "reward"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "type": "object"
                                        },
                                        "qualification": {
                                          "type": "object",
                                          "properties": {
                                            "sources": {
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "event": {
                                                    "type": "string",
                                                    "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                  },
                                                  "conditions": {
                                                    "$ref": "#/components/schemas/__schema3"
                                                  },
                                                  "value": {
                                                    "anyOf": [
                                                      {
                                                        "type": "number"
                                                      },
                                                      {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    ]
                                                  },
                                                  "step": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "occurrence": {
                                                    "default": "lifetime",
                                                    "type": "string",
                                                    "enum": [
                                                      "lifetime",
                                                      "period"
                                                    ]
                                                  }
                                                },
                                                "required": [
                                                  "event"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "audience": {
                                              "type": "array",
                                              "items": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                              }
                                            },
                                            "starts_at": {
                                              "type": "string",
                                              "format": "date-time",
                                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                            },
                                            "ends_at": {
                                              "type": "string",
                                              "format": "date-time",
                                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                            },
                                            "campaign": {
                                              "type": "string",
                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                            }
                                          },
                                          "required": [
                                            "sources"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "calendar": {
                                          "type": "object",
                                          "properties": {
                                            "schema": {
                                              "type": "string",
                                              "const": "orishare.calendar/v1"
                                            },
                                            "period": {
                                              "anyOf": [
                                                {
                                                  "type": "string",
                                                  "enum": [
                                                    "none",
                                                    "day",
                                                    "week",
                                                    "month",
                                                    "year"
                                                  ]
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "const": "season"
                                                    },
                                                    "starts_at": {
                                                      "type": "string",
                                                      "format": "date-time",
                                                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                    },
                                                    "ends_at": {
                                                      "type": "string",
                                                      "format": "date-time",
                                                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "starts_at",
                                                    "ends_at"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ]
                                            },
                                            "run_per_period": {
                                              "type": "boolean"
                                            },
                                            "timezone_source": {
                                              "type": "string",
                                              "enum": [
                                                "environment",
                                                "customer",
                                                "fixed"
                                              ]
                                            },
                                            "timezone": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "day_start_offset_minutes": {
                                              "default": 0,
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 1439
                                            },
                                            "ambiguous_local_time": {
                                              "type": "string",
                                              "const": "earlier"
                                            },
                                            "nonexistent_local_time": {
                                              "type": "string",
                                              "const": "next_valid"
                                            },
                                            "event_time": {
                                              "type": "object",
                                              "properties": {
                                                "merchant": {
                                                  "type": "string",
                                                  "const": "occurred_at"
                                                },
                                                "client": {
                                                  "anyOf": [
                                                    {
                                                      "type": "string",
                                                      "const": "received_at"
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "offline_seconds": {
                                                          "type": "integer",
                                                          "minimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "offline_seconds"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "merchant",
                                                "client"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "grace_seconds": {
                                              "default": 0,
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 9007199254740991
                                            },
                                            "max_lateness_seconds": {
                                              "default": 0,
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 9007199254740991
                                            },
                                            "settlement_delay_seconds": {
                                              "default": 0,
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 9007199254740991
                                            },
                                            "after_finalization": {
                                              "type": "string",
                                              "const": "correction_only"
                                            }
                                          },
                                          "required": [
                                            "schema",
                                            "period",
                                            "run_per_period",
                                            "timezone_source",
                                            "ambiguous_local_time",
                                            "nonexistent_local_time",
                                            "event_time",
                                            "after_finalization"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "trust": {
                                          "type": "object",
                                          "properties": {
                                            "minimum_trust": {
                                              "type": "string",
                                              "enum": [
                                                "anonymous_claim",
                                                "customer_claim",
                                                "merchant_asserted",
                                                "verified_evidence",
                                                "legacy_unknown"
                                              ]
                                            },
                                            "allowed_sources": {
                                              "minItems": 1,
                                              "type": "array",
                                              "items": {
                                                "type": "string",
                                                "enum": [
                                                  "publishable_event",
                                                  "secret_key_event",
                                                  "verified_connector",
                                                  "operator_command",
                                                  "customer_command",
                                                  "import",
                                                  "program_transition",
                                                  "schedule"
                                                ]
                                              }
                                            },
                                            "on_insufficient": {
                                              "type": "string",
                                              "enum": [
                                                "ignore",
                                                "progress_without_reward"
                                              ]
                                            },
                                            "liability_caps": {
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "trust": {
                                                    "type": "string",
                                                    "enum": [
                                                      "anonymous_claim",
                                                      "customer_claim",
                                                      "merchant_asserted",
                                                      "verified_evidence",
                                                      "legacy_unknown"
                                                    ]
                                                  },
                                                  "currency": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "scope": {
                                                    "type": "string",
                                                    "enum": [
                                                      "customer",
                                                      "environment"
                                                    ]
                                                  },
                                                  "window": {
                                                    "type": "string",
                                                    "enum": [
                                                      "day",
                                                      "month",
                                                      "lifetime"
                                                    ]
                                                  },
                                                  "maximum_minor": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 9007199254740991
                                                  }
                                                },
                                                "required": [
                                                  "trust",
                                                  "currency",
                                                  "scope",
                                                  "window",
                                                  "maximum_minor"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "recognition_caps": {
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "trust": {
                                                    "type": "string",
                                                    "enum": [
                                                      "anonymous_claim",
                                                      "customer_claim",
                                                      "merchant_asserted",
                                                      "verified_evidence",
                                                      "legacy_unknown"
                                                    ]
                                                  },
                                                  "per": {
                                                    "type": "string",
                                                    "enum": [
                                                      "period",
                                                      "day"
                                                    ]
                                                  },
                                                  "contributions": {
                                                    "type": "integer",
                                                    "exclusiveMinimum": 0,
                                                    "maximum": 9007199254740991
                                                  },
                                                  "value": {
                                                    "type": "integer",
                                                    "exclusiveMinimum": 0,
                                                    "maximum": 9007199254740991
                                                  }
                                                },
                                                "required": [
                                                  "trust",
                                                  "per"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "allow_legacy_unknown": {
                                              "type": "boolean",
                                              "const": false
                                            }
                                          },
                                          "required": [
                                            "minimum_trust",
                                            "allowed_sources",
                                            "on_insufficient",
                                            "liability_caps",
                                            "recognition_caps",
                                            "allow_legacy_unknown"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "correction": {
                                          "type": "object",
                                          "properties": {
                                            "qualification": {
                                              "default": "reverse",
                                              "type": "string",
                                              "enum": [
                                                "reverse",
                                                "keep"
                                              ]
                                            },
                                            "spendable": {
                                              "type": "string",
                                              "const": "reverse"
                                            },
                                            "xp": {
                                              "default": "reverse",
                                              "type": "string",
                                              "enum": [
                                                "reverse",
                                                "keep"
                                              ]
                                            },
                                            "recognition": {
                                              "default": "keep",
                                              "type": "string",
                                              "enum": [
                                                "keep",
                                                "revoke_on_fraud"
                                              ]
                                            },
                                            "after_finalization": {
                                              "default": "correcting_revision",
                                              "type": "string",
                                              "const": "correcting_revision"
                                            },
                                            "allowance_on_refund": {
                                              "default": "consumed",
                                              "type": "string",
                                              "enum": [
                                                "consumed",
                                                "release_on_verified_void"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "spendable"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "reward": {
                                          "type": "object",
                                          "properties": {
                                            "on": {
                                              "type": "object",
                                              "propertyNames": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]*(?::[a-z0-9_]+)?$"
                                              },
                                              "additionalProperties": {
                                                "type": "array",
                                                "items": {
                                                  "anyOf": [
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "points.award"
                                                        },
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount": {
                                                          "anyOf": [
                                                            {
                                                              "type": "number"
                                                            },
                                                            {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          ]
                                                        },
                                                        "reason": {
                                                          "type": "string",
                                                          "maxLength": 200
                                                        },
                                                        "confirm_after": {
                                                          "type": "string",
                                                          "pattern": "^\\d+[smhdw]$"
                                                        },
                                                        "expires_after": {
                                                          "type": "string",
                                                          "pattern": "^\\d+[smhdw]$"
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "currency",
                                                        "amount",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "points.deduct"
                                                        },
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount": {
                                                          "anyOf": [
                                                            {
                                                              "type": "number"
                                                            },
                                                            {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          ]
                                                        },
                                                        "reason": {
                                                          "type": "string",
                                                          "maxLength": 200
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "currency",
                                                        "amount",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "points.reverse"
                                                        },
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "match": {
                                                          "type": "object",
                                                          "properties": {
                                                            "event": {
                                                              "type": "string",
                                                              "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                            },
                                                            "on": {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          },
                                                          "required": [
                                                            "event",
                                                            "on"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        "fraction": {
                                                          "anyOf": [
                                                            {
                                                              "type": "number"
                                                            },
                                                            {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          ]
                                                        },
                                                        "amount": {
                                                          "anyOf": [
                                                            {
                                                              "type": "number"
                                                            },
                                                            {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          ]
                                                        },
                                                        "reason": {
                                                          "type": "string",
                                                          "maxLength": 200
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "currency",
                                                        "match",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "reward.issue"
                                                        },
                                                        "reward": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "reward",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "tier.evaluate"
                                                        },
                                                        "program": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "program",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "attribute.set"
                                                        },
                                                        "attribute": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "value": {
                                                          "type": [
                                                            "string",
                                                            "number",
                                                            "boolean",
                                                            "null"
                                                          ]
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "attribute",
                                                        "value",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "webhook.emit"
                                                        },
                                                        "event": {
                                                          "type": "string",
                                                          "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                        },
                                                        "payload": {
                                                          "type": "object",
                                                          "propertyNames": {
                                                            "type": "string"
                                                          },
                                                          "additionalProperties": {
                                                            "anyOf": [
                                                              {
                                                                "type": [
                                                                  "string",
                                                                  "number",
                                                                  "boolean"
                                                                ]
                                                              },
                                                              {
                                                                "type": "null"
                                                              },
                                                              {
                                                                "type": "array",
                                                                "items": {
                                                                  "type": [
                                                                    "string",
                                                                    "number",
                                                                    "boolean"
                                                                  ]
                                                                }
                                                              }
                                                            ]
                                                          }
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "event",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "badge.contribute"
                                                        },
                                                        "badge": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "value": {
                                                          "anyOf": [
                                                            {
                                                              "type": "number"
                                                            },
                                                            {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          ]
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "badge",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "badge.grant"
                                                        },
                                                        "badge": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "rank": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "occurrence": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "badge",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "streak.contribute"
                                                        },
                                                        "streak": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "value": {
                                                          "anyOf": [
                                                            {
                                                              "type": "number"
                                                            },
                                                            {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          ]
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "streak",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "streak.freeze_grant"
                                                        },
                                                        "streak": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "quantity": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "streak",
                                                        "quantity",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "quest.contribute"
                                                        },
                                                        "quest": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "step": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "value": {
                                                          "anyOf": [
                                                            {
                                                              "type": "number"
                                                            },
                                                            {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          ]
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "quest",
                                                        "step",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "quest.enroll"
                                                        },
                                                        "quest": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "quest",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "leaderboard.contribute"
                                                        },
                                                        "leaderboard": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "value": {
                                                          "anyOf": [
                                                            {
                                                              "type": "number"
                                                            },
                                                            {
                                                              "type": "string",
                                                              "minLength": 1
                                                            }
                                                          ]
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "leaderboard",
                                                        "value",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "program.reverse_contribution"
                                                        },
                                                        "program": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "source_fact": {
                                                          "anyOf": [
                                                            {
                                                              "type": "object",
                                                              "properties": {
                                                                "fact_id": {
                                                                  "type": "string",
                                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                                }
                                                              },
                                                              "required": [
                                                                "fact_id"
                                                              ],
                                                              "additionalProperties": false
                                                            },
                                                            {
                                                              "type": "object",
                                                              "properties": {
                                                                "object_type": {
                                                                  "type": "string",
                                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                                },
                                                                "key": {
                                                                  "minItems": 1,
                                                                  "type": "array",
                                                                  "items": {
                                                                    "type": "string",
                                                                    "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_-]*(?:\\.[A-Za-z_][A-Za-z0-9_-]*)*$"
                                                                  }
                                                                }
                                                              },
                                                              "required": [
                                                                "object_type",
                                                                "key"
                                                              ],
                                                              "additionalProperties": false
                                                            }
                                                          ]
                                                        },
                                                        "fraction": {
                                                          "type": "string",
                                                          "pattern": "^(?:0(?:\\.\\d+)?|1(?:\\.0+)?)$"
                                                        },
                                                        "amount": {
                                                          "type": "number",
                                                          "exclusiveMinimum": 0
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "program",
                                                        "source_fact",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "coupon.issue"
                                                        },
                                                        "offer": {
                                                          "type": "object",
                                                          "properties": {
                                                            "key": {
                                                              "type": "string",
                                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                            },
                                                            "version": {
                                                              "type": "integer",
                                                              "minimum": 1,
                                                              "maximum": 9007199254740991
                                                            },
                                                            "digest": {
                                                              "type": "string",
                                                              "pattern": "^[a-f0-9]{64}$"
                                                            }
                                                          },
                                                          "required": [
                                                            "key",
                                                            "version",
                                                            "digest"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "offer",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "discount.quote"
                                                        },
                                                        "offer": {
                                                          "type": "object",
                                                          "properties": {
                                                            "key": {
                                                              "type": "string",
                                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                            },
                                                            "version": {
                                                              "type": "integer",
                                                              "minimum": 1,
                                                              "maximum": 9007199254740991
                                                            },
                                                            "digest": {
                                                              "type": "string",
                                                              "pattern": "^[a-f0-9]{64}$"
                                                            }
                                                          },
                                                          "required": [
                                                            "key",
                                                            "version",
                                                            "digest"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "offer",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "item.grant"
                                                        },
                                                        "item": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                        },
                                                        "quantity": {
                                                          "default": 1,
                                                          "type": "integer",
                                                          "minimum": 1,
                                                          "maximum": 1000
                                                        },
                                                        "effect_key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "liability": {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "integer",
                                                              "exclusiveMinimum": 0,
                                                              "maximum": 9007199254740991
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "item",
                                                        "effect_key"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  ]
                                                }
                                              }
                                            }
                                          },
                                          "required": [
                                            "on"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "display": {
                                          "type": "object",
                                          "properties": {
                                            "title": {
                                              "type": "string"
                                            },
                                            "description": {
                                              "type": "string"
                                            },
                                            "image_url": {
                                              "type": "string",
                                              "format": "uri"
                                            },
                                            "icon": {
                                              "type": "string"
                                            },
                                            "color": {
                                              "type": "string"
                                            },
                                            "sort_order": {
                                              "default": 0,
                                              "type": "integer",
                                              "minimum": -9007199254740991,
                                              "maximum": 9007199254740991
                                            },
                                            "hidden": {
                                              "default": false,
                                              "type": "boolean"
                                            },
                                            "locales": {
                                              "default": {},
                                              "type": "object",
                                              "propertyNames": {
                                                "type": "string",
                                                "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
                                              },
                                              "additionalProperties": {
                                                "type": "object",
                                                "properties": {
                                                  "title": {
                                                    "type": "string"
                                                  },
                                                  "description": {
                                                    "type": "string"
                                                  }
                                                },
                                                "additionalProperties": false
                                              }
                                            }
                                          },
                                          "additionalProperties": false
                                        },
                                        "enrollment": {
                                          "type": "object",
                                          "properties": {
                                            "mode": {
                                              "default": "automatic",
                                              "type": "string",
                                              "enum": [
                                                "automatic",
                                                "explicit"
                                              ]
                                            }
                                          },
                                          "additionalProperties": false
                                        },
                                        "season": {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "season"
                                            },
                                            "key": {
                                              "type": "string",
                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                            },
                                            "version": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 9007199254740991
                                            },
                                            "digest": {
                                              "type": "string",
                                              "pattern": "^[a-f0-9]{64}$"
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "key",
                                            "version",
                                            "digest"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "dependencies": {
                                          "default": [],
                                          "maxItems": 64,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "enum": [
                                                  "program",
                                                  "currency",
                                                  "season",
                                                  "reward",
                                                  "counter",
                                                  "segment",
                                                  "campaign",
                                                  "offer",
                                                  "asset"
                                                ]
                                              },
                                              "key": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                              },
                                              "version": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 9007199254740991
                                              },
                                              "digest": {
                                                "type": "string",
                                                "pattern": "^[a-f0-9]{64}$"
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "key",
                                              "version",
                                              "digest"
                                            ],
                                            "additionalProperties": false
                                          }
                                        }
                                      },
                                      "required": [
                                        "schema",
                                        "kind",
                                        "semantics",
                                        "definition",
                                        "qualification",
                                        "calendar",
                                        "trust",
                                        "correction",
                                        "reward",
                                        "display",
                                        "enrollment"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                },
                                "bindings": {
                                  "default": [],
                                  "maxItems": 256,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "path": {
                                        "minItems": 1,
                                        "maxItems": 32,
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 9007199254740991
                                            }
                                          ]
                                        }
                                      },
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "program",
                                          "currency",
                                          "rule",
                                          "tier_level"
                                        ]
                                      },
                                      "key": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 255
                                      }
                                    },
                                    "required": [
                                      "path",
                                      "kind",
                                      "key"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "dependencies": {
                                  "maxItems": 64,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "program",
                                          "currency",
                                          "reward",
                                          "season",
                                          "event_definition",
                                          "counter_definition",
                                          "segment",
                                          "campaign"
                                        ]
                                      },
                                      "key": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 255
                                      },
                                      "usage": {
                                        "type": "string",
                                        "enum": [
                                          "qualification",
                                          "reward",
                                          "presentation",
                                          "transition"
                                        ]
                                      },
                                      "version": {
                                        "type": "integer",
                                        "exclusiveMinimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "digest": {
                                        "type": "string",
                                        "pattern": "^[a-f0-9]{64}$"
                                      },
                                      "currency_terms": {
                                        "type": "object",
                                        "properties": {
                                          "version": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "maximum": 9007199254740991
                                          },
                                          "code": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "name": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 255
                                          },
                                          "precision": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 6
                                          },
                                          "expiration_policy": {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "enum": [
                                                  "never",
                                                  "days"
                                                ]
                                              },
                                              "days": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "type"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "negative_balance": {
                                            "type": "string",
                                            "enum": [
                                              "allow",
                                              "forbid"
                                            ]
                                          },
                                          "capabilities": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "spendable": {
                                                    "type": "boolean"
                                                  },
                                                  "transferable": {
                                                    "type": "boolean"
                                                  },
                                                  "qualification": {
                                                    "type": "string",
                                                    "enum": [
                                                      "none",
                                                      "earned",
                                                      "xp"
                                                    ]
                                                  },
                                                  "expiry_policy": {
                                                    "anyOf": [
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "type": {
                                                            "type": "string",
                                                            "const": "none"
                                                          }
                                                        },
                                                        "required": [
                                                          "type"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "type": {
                                                            "type": "string",
                                                            "const": "after"
                                                          },
                                                          "seconds": {
                                                            "type": "integer",
                                                            "exclusiveMinimum": 0,
                                                            "maximum": 9007199254740991
                                                          }
                                                        },
                                                        "required": [
                                                          "type",
                                                          "seconds"
                                                        ],
                                                        "additionalProperties": false
                                                      }
                                                    ]
                                                  }
                                                },
                                                "required": [
                                                  "spendable",
                                                  "transferable",
                                                  "qualification",
                                                  "expiry_policy"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          }
                                        },
                                        "required": [
                                          "version",
                                          "code",
                                          "name",
                                          "precision",
                                          "expiration_policy",
                                          "negative_balance",
                                          "capabilities"
                                        ],
                                        "additionalProperties": false
                                      },
                                      "reward_terms": {
                                        "type": "object",
                                        "properties": {
                                          "version": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "maximum": 9007199254740991
                                          },
                                          "name": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 255
                                          },
                                          "cost": {
                                            "type": "string",
                                            "pattern": "^(0|[1-9][0-9]*)$"
                                          },
                                          "currency_id": {
                                            "type": [
                                              "string",
                                              "null"
                                            ]
                                          },
                                          "availability": {
                                            "anyOf": [
                                              {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 9007199254740991
                                              },
                                              {
                                                "type": "null"
                                              }
                                            ]
                                          },
                                          "expiry_after": {
                                            "type": [
                                              "string",
                                              "null"
                                            ]
                                          },
                                          "status": {
                                            "type": "string",
                                            "enum": [
                                              "active",
                                              "archived"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "version",
                                          "name",
                                          "cost",
                                          "currency_id",
                                          "availability",
                                          "expiry_after",
                                          "status"
                                        ],
                                        "additionalProperties": false
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "key",
                                      "usage"
                                    ],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": [
                                "version",
                                "digest",
                                "dependencies"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "type",
                            "key",
                            "version"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "program.activate"
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            }
                          },
                          "required": [
                            "type",
                            "key"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "program.archive"
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            }
                          },
                          "required": [
                            "type",
                            "key"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "season.publish_version"
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "version": {
                              "type": "object",
                              "properties": {
                                "version": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "digest": {
                                  "type": "string",
                                  "pattern": "^[a-f0-9]{64}$"
                                },
                                "definition": {
                                  "type": "object",
                                  "properties": {
                                    "schema": {
                                      "type": "string",
                                      "const": "orishare.season/v1"
                                    },
                                    "starts_at": {
                                      "type": "string",
                                      "format": "date-time",
                                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                    },
                                    "ends_at": {
                                      "type": "string",
                                      "format": "date-time",
                                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                    },
                                    "display": {
                                      "type": "object",
                                      "properties": {
                                        "title": {
                                          "type": "string"
                                        },
                                        "description": {
                                          "type": "string"
                                        },
                                        "image_url": {
                                          "type": "string",
                                          "format": "uri"
                                        },
                                        "icon": {
                                          "type": "string"
                                        },
                                        "color": {
                                          "type": "string"
                                        },
                                        "sort_order": {
                                          "default": 0,
                                          "type": "integer",
                                          "minimum": -9007199254740991,
                                          "maximum": 9007199254740991
                                        },
                                        "hidden": {
                                          "default": false,
                                          "type": "boolean"
                                        },
                                        "locales": {
                                          "default": {},
                                          "type": "object",
                                          "propertyNames": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
                                          },
                                          "additionalProperties": {
                                            "type": "object",
                                            "properties": {
                                              "title": {
                                                "type": "string"
                                              },
                                              "description": {
                                                "type": "string"
                                              }
                                            },
                                            "additionalProperties": false
                                          }
                                        }
                                      },
                                      "additionalProperties": false
                                    },
                                    "eligibility": {
                                      "type": "object",
                                      "properties": {
                                        "audience": {
                                          "maxItems": 64,
                                          "type": "array",
                                          "items": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          }
                                        }
                                      },
                                      "required": [
                                        "audience"
                                      ],
                                      "additionalProperties": false
                                    },
                                    "admission": {
                                      "type": "object",
                                      "properties": {
                                        "grace_seconds": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 9007199254740991
                                        },
                                        "max_lateness_seconds": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 9007199254740991
                                        }
                                      },
                                      "required": [
                                        "grace_seconds",
                                        "max_lateness_seconds"
                                      ],
                                      "additionalProperties": false
                                    },
                                    "settlement": {
                                      "type": "object",
                                      "properties": {
                                        "delay_seconds": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 9007199254740991
                                        }
                                      },
                                      "required": [
                                        "delay_seconds"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "required": [
                                    "schema",
                                    "starts_at",
                                    "ends_at",
                                    "display",
                                    "eligibility",
                                    "admission",
                                    "settlement"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "version",
                                "digest",
                                "definition"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "type",
                            "key",
                            "version"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "rule.publish"
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "type",
                            "key",
                            "version"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "rule.archive"
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            }
                          },
                          "required": [
                            "type",
                            "key"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "catalogue.revise"
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "disabled"
                              ]
                            }
                          },
                          "required": [
                            "type",
                            "key"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "offer.publish"
                            },
                            "offer": {
                              "type": "object",
                              "properties": {
                                "catalogue": {
                                  "type": "string",
                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                },
                                "key": {
                                  "type": "string",
                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                },
                                "version": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                "digest": {
                                  "type": "string",
                                  "pattern": "^[a-f0-9]{64}$"
                                },
                                "terms": {
                                  "type": "object",
                                  "properties": {
                                    "display": {
                                      "type": "object",
                                      "properties": {
                                        "title": {
                                          "type": "string",
                                          "maxLength": 255
                                        },
                                        "description": {
                                          "type": "string",
                                          "maxLength": 4096
                                        }
                                      },
                                      "additionalProperties": false
                                    },
                                    "currency_id": {
                                      "type": "string",
                                      "pattern": "^[\\x21-\\x7e]{1,255}$"
                                    },
                                    "cost_minor": {
                                      "type": "string",
                                      "pattern": "^(0|[1-9][0-9]{0,18})$"
                                    },
                                    "quantity": {
                                      "type": "number",
                                      "const": 1
                                    },
                                    "eligibility": {
                                      "type": "object",
                                      "properties": {
                                        "audience": {
                                          "maxItems": 64,
                                          "type": "array",
                                          "items": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          }
                                        },
                                        "minimum_assurance": {
                                          "type": "string",
                                          "enum": [
                                            "anonymous",
                                            "authenticated_customer"
                                          ]
                                        },
                                        "minimum_tier": {
                                          "type": "object",
                                          "properties": {
                                            "tier_program": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 255
                                            },
                                            "min_level": {
                                              "type": "string",
                                              "minLength": 1,
                                              "maxLength": 60
                                            }
                                          },
                                          "required": [
                                            "tier_program",
                                            "min_level"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "audience",
                                        "minimum_assurance"
                                      ],
                                      "additionalProperties": false
                                    },
                                    "reward": {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "version": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 9007199254740991
                                        },
                                        "digest": {
                                          "type": "string",
                                          "pattern": "^[a-f0-9]{64}$"
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "version",
                                        "digest"
                                      ],
                                      "additionalProperties": false
                                    },
                                    "season": {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "version": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 9007199254740991
                                        },
                                        "digest": {
                                          "type": "string",
                                          "pattern": "^[a-f0-9]{64}$"
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "version",
                                        "digest"
                                      ],
                                      "additionalProperties": false
                                    },
                                    "stock": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "unlimited"
                                            }
                                          },
                                          "required": [
                                            "type"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "inventory"
                                            },
                                            "inventory_key": {
                                              "type": "string",
                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                            }
                                          },
                                          "required": [
                                            "type",
                                            "inventory_key"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "code_pool"
                                            },
                                            "pool_key": {
                                              "type": "string",
                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                            }
                                          },
                                          "required": [
                                            "type",
                                            "pool_key"
                                          ],
                                          "additionalProperties": false
                                        }
                                      ],
                                      "type": "object"
                                    },
                                    "delivery": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "manual"
                                            }
                                          },
                                          "required": [
                                            "type"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "code"
                                            },
                                            "pool_key": {
                                              "type": "string",
                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                            }
                                          },
                                          "required": [
                                            "type",
                                            "pool_key"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "webhook"
                                            },
                                            "provider_key": {
                                              "type": "string",
                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                            },
                                            "idempotent": {
                                              "type": "boolean"
                                            },
                                            "reconcilable": {
                                              "type": "boolean"
                                            }
                                          },
                                          "required": [
                                            "type",
                                            "provider_key",
                                            "idempotent",
                                            "reconcilable"
                                          ],
                                          "additionalProperties": false
                                        }
                                      ],
                                      "type": "object"
                                    },
                                    "quote_ttl_seconds": {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 86400
                                    },
                                    "entitlement_ttl_seconds": {
                                      "anyOf": [
                                        {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 315360000
                                        },
                                        {
                                          "type": "null"
                                        }
                                      ]
                                    },
                                    "cancellation": {
                                      "type": "string",
                                      "enum": [
                                        "before_commitment",
                                        "proven_reversal"
                                      ]
                                    },
                                    "discount": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "fixed"
                                            },
                                            "currency": {
                                              "type": "string",
                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                            },
                                            "amount_minor": {
                                              "type": "string",
                                              "pattern": "^(0|[1-9][0-9]{0,18})$"
                                            },
                                            "maximum_minor": {
                                              "type": "string",
                                              "pattern": "^(0|[1-9][0-9]{0,18})$"
                                            }
                                          },
                                          "required": [
                                            "type",
                                            "currency",
                                            "amount_minor",
                                            "maximum_minor"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "const": "basis_points"
                                            },
                                            "currency": {
                                              "type": "string",
                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                            },
                                            "basis_points": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 10000
                                            },
                                            "maximum_minor": {
                                              "type": "string",
                                              "pattern": "^(0|[1-9][0-9]{0,18})$"
                                            }
                                          },
                                          "required": [
                                            "type",
                                            "currency",
                                            "basis_points",
                                            "maximum_minor"
                                          ],
                                          "additionalProperties": false
                                        }
                                      ],
                                      "type": "object"
                                    }
                                  },
                                  "required": [
                                    "display",
                                    "currency_id",
                                    "cost_minor",
                                    "quantity",
                                    "eligibility",
                                    "stock",
                                    "delivery",
                                    "quote_ttl_seconds",
                                    "entitlement_ttl_seconds",
                                    "cancellation"
                                  ],
                                  "additionalProperties": false
                                },
                                "bindings": {
                                  "default": [],
                                  "maxItems": 256,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "path": {
                                        "minItems": 1,
                                        "maxItems": 32,
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 9007199254740991
                                            }
                                          ]
                                        }
                                      },
                                      "kind": {
                                        "type": "string",
                                        "enum": [
                                          "program",
                                          "currency",
                                          "rule",
                                          "tier_level"
                                        ]
                                      },
                                      "key": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 255
                                      }
                                    },
                                    "required": [
                                      "path",
                                      "kind",
                                      "key"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "listed": {
                                  "type": "boolean"
                                },
                                "revoked": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "catalogue",
                                "key",
                                "version",
                                "digest",
                                "terms",
                                "listed",
                                "revoked"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "type",
                            "offer"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "offer.revoke"
                            },
                            "catalogue": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "type",
                            "catalogue",
                            "key",
                            "version"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "program.create"
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "streak",
                                "badge",
                                "quest",
                                "tier",
                                "leaderboard",
                                "referral"
                              ]
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            }
                          },
                          "required": [
                            "type",
                            "kind",
                            "key",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "program.rename"
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            }
                          },
                          "required": [
                            "type",
                            "key",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "program.publish_definition"
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "definition": {
                              "type": "object",
                              "properties": {
                                "schema": {
                                  "type": "string",
                                  "const": "orishare.program/v2"
                                },
                                "kind": {
                                  "type": "string",
                                  "enum": [
                                    "tier",
                                    "quest",
                                    "campaign",
                                    "reward",
                                    "streak",
                                    "badge",
                                    "leaderboard",
                                    "referral"
                                  ]
                                },
                                "semantics": {
                                  "type": "string",
                                  "const": "native_v2"
                                },
                                "definition": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "streak"
                                        },
                                        "qualification": {
                                          "type": "object",
                                          "properties": {
                                            "aggregation": {
                                              "type": "string",
                                              "enum": [
                                                "count",
                                                "sum"
                                              ]
                                            },
                                            "minimum": {
                                              "type": "string",
                                              "pattern": "^(0|[1-9][0-9]{0,18})$"
                                            }
                                          },
                                          "required": [
                                            "aggregation",
                                            "minimum"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "freezes": {
                                          "type": "object",
                                          "properties": {
                                            "ceiling": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 1000
                                            },
                                            "auto_use": {
                                              "default": true,
                                              "type": "boolean"
                                            },
                                            "purchase": {
                                              "type": "object",
                                              "properties": {
                                                "currency": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "amount_minor": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                }
                                              },
                                              "required": [
                                                "currency",
                                                "amount_minor"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "ceiling"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "milestones": {
                                          "maxItems": 64,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "key": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                              },
                                              "threshold": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 9007199254740991
                                              },
                                              "occurrence": {
                                                "type": "string",
                                                "enum": [
                                                  "lifetime",
                                                  "episode"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "key",
                                              "threshold",
                                              "occurrence"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "repair": {
                                          "type": "object",
                                          "properties": {
                                            "price": {
                                              "type": "object",
                                              "properties": {
                                                "currency": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "amount_minor": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                }
                                              },
                                              "required": [
                                                "currency",
                                                "amount_minor"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "window_periods": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 30
                                            },
                                            "maximum_per_days": {
                                              "type": "object",
                                              "properties": {
                                                "count": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 1000
                                                },
                                                "days": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 366
                                                }
                                              },
                                              "required": [
                                                "count",
                                                "days"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "price",
                                            "window_periods"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "protected_weekdays": {
                                          "minItems": 1,
                                          "maxItems": 6,
                                          "type": "array",
                                          "items": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 6
                                          }
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "qualification",
                                        "freezes",
                                        "milestones"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "badge"
                                        },
                                        "qualification": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "aggregation": {
                                                  "type": "string",
                                                  "const": "count"
                                                }
                                              },
                                              "required": [
                                                "aggregation"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "aggregation": {
                                                  "type": "string",
                                                  "const": "sum"
                                                }
                                              },
                                              "required": [
                                                "aggregation"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "aggregation": {
                                                  "type": "string",
                                                  "const": "distinct"
                                                },
                                                "distinct_key": {
                                                  "type": "string",
                                                  "maxLength": 255,
                                                  "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                                }
                                              },
                                              "required": [
                                                "aggregation",
                                                "distinct_key"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "type": "object"
                                        },
                                        "ranks": {
                                          "minItems": 1,
                                          "maxItems": 64,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "key": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                              },
                                              "threshold": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9][0-9]{0,18})$"
                                              },
                                              "display": {
                                                "type": "object",
                                                "properties": {
                                                  "title": {
                                                    "type": "string",
                                                    "maxLength": 255
                                                  },
                                                  "description": {
                                                    "type": "string",
                                                    "maxLength": 4096
                                                  }
                                                },
                                                "additionalProperties": false
                                              }
                                            },
                                            "required": [
                                              "key",
                                              "threshold"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "visibility": {
                                          "type": "string",
                                          "enum": [
                                            "visible",
                                            "hidden_until_earned"
                                          ]
                                        },
                                        "collection": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "repeatable": {
                                          "type": "boolean"
                                        },
                                        "occurrence": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "lifetime"
                                                }
                                              },
                                              "required": [
                                                "type"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "period"
                                                }
                                              },
                                              "required": [
                                                "type"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "season"
                                                }
                                              },
                                              "required": [
                                                "type"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "verified_fact"
                                                }
                                              },
                                              "required": [
                                                "type"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "type": "object"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "qualification",
                                        "ranks",
                                        "visibility",
                                        "repeatable",
                                        "occurrence"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "quest"
                                        },
                                        "steps": {
                                          "minItems": 1,
                                          "maxItems": 32,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "key": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                              },
                                              "aggregation": {
                                                "type": "string",
                                                "enum": [
                                                  "count",
                                                  "sum",
                                                  "distinct"
                                                ]
                                              },
                                              "target": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9][0-9]{0,18})$"
                                              },
                                              "distinct_key": {
                                                "type": "string",
                                                "maxLength": 255,
                                                "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                              },
                                              "display": {
                                                "type": "object",
                                                "properties": {
                                                  "title": {
                                                    "type": "string",
                                                    "maxLength": 255
                                                  },
                                                  "description": {
                                                    "type": "string",
                                                    "maxLength": 4096
                                                  }
                                                },
                                                "additionalProperties": false
                                              },
                                              "available_from": {
                                                "type": "string",
                                                "format": "date-time",
                                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                              },
                                              "deadline": {
                                                "type": "string",
                                                "format": "date-time",
                                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                              }
                                            },
                                            "required": [
                                              "key",
                                              "aggregation",
                                              "target",
                                              "display"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "prerequisites": {
                                          "maxItems": 64,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "step": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                              },
                                              "requires": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                              }
                                            },
                                            "required": [
                                              "step",
                                              "requires"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "collection": {
                                          "type": "string",
                                          "enum": [
                                            "auto_collect",
                                            "claim"
                                          ]
                                        },
                                        "repeatable": {
                                          "type": "boolean"
                                        },
                                        "claim_deadline": {
                                          "type": "string",
                                          "format": "date-time",
                                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                        },
                                        "chain": {
                                          "anyOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "const": "program"
                                                },
                                                "key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "version": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 9007199254740991
                                                },
                                                "digest": {
                                                  "type": "string",
                                                  "pattern": "^[a-f0-9]{64}$"
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "key",
                                                "version",
                                                "digest"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "kind": {
                                                  "type": "string",
                                                  "const": "program"
                                                },
                                                "use": {
                                                  "type": "string",
                                                  "const": "head"
                                                }
                                              },
                                              "required": [
                                                "key",
                                                "kind",
                                                "use"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ]
                                        },
                                        "rotation": {
                                          "type": "object",
                                          "properties": {
                                            "candidates": {
                                              "minItems": 1,
                                              "maxItems": 100,
                                              "type": "array",
                                              "items": {
                                                "anyOf": [
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "kind": {
                                                        "type": "string",
                                                        "const": "program"
                                                      },
                                                      "key": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      },
                                                      "version": {
                                                        "type": "integer",
                                                        "minimum": 1,
                                                        "maximum": 9007199254740991
                                                      },
                                                      "digest": {
                                                        "type": "string",
                                                        "pattern": "^[a-f0-9]{64}$"
                                                      }
                                                    },
                                                    "required": [
                                                      "kind",
                                                      "key",
                                                      "version",
                                                      "digest"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "key": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      },
                                                      "kind": {
                                                        "type": "string",
                                                        "const": "program"
                                                      },
                                                      "use": {
                                                        "type": "string",
                                                        "const": "head"
                                                      }
                                                    },
                                                    "required": [
                                                      "key",
                                                      "kind",
                                                      "use"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                ]
                                              }
                                            },
                                            "select": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 100
                                            }
                                          },
                                          "required": [
                                            "candidates",
                                            "select"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "steps",
                                        "prerequisites",
                                        "collection",
                                        "repeatable"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "tier"
                                        },
                                        "currency": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "basis": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "lifetime_earned"
                                                }
                                              },
                                              "required": [
                                                "type"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "balance"
                                                }
                                              },
                                              "required": [
                                                "type"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "earned_rolling_days"
                                                },
                                                "days": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 9007199254740991
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "days"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "type": "object"
                                        },
                                        "downgrade_check": {
                                          "type": "string",
                                          "enum": [
                                            "daily",
                                            "monthly",
                                            "never"
                                          ]
                                        },
                                        "levels": {
                                          "minItems": 1,
                                          "maxItems": 1000,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "key": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                              },
                                              "threshold": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9][0-9]{0,18})$"
                                              },
                                              "display": {
                                                "type": "object",
                                                "properties": {
                                                  "title": {
                                                    "type": "string",
                                                    "maxLength": 255
                                                  },
                                                  "description": {
                                                    "type": "string",
                                                    "maxLength": 4096
                                                  }
                                                },
                                                "additionalProperties": false
                                              }
                                            },
                                            "required": [
                                              "key",
                                              "threshold",
                                              "display"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "occurrence": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "lifetime"
                                                }
                                              },
                                              "required": [
                                                "type"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "season"
                                                }
                                              },
                                              "required": [
                                                "type"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "prestige"
                                                },
                                                "maximum_runs": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 9007199254740991
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "maximum_runs"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "type": "object"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "currency",
                                        "basis",
                                        "downgrade_check",
                                        "levels",
                                        "occurrence"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "leaderboard"
                                        },
                                        "aggregation": {
                                          "type": "string",
                                          "enum": [
                                            "sum",
                                            "max",
                                            "latest_verified"
                                          ]
                                        },
                                        "input": {
                                          "type": "object",
                                          "properties": {
                                            "minimum": {
                                              "type": "string",
                                              "pattern": "^(0|-?[1-9][0-9]{0,18})$"
                                            },
                                            "maximum": {
                                              "type": "string",
                                              "pattern": "^(0|-?[1-9][0-9]{0,18})$"
                                            }
                                          },
                                          "required": [
                                            "minimum",
                                            "maximum"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "order": {
                                          "type": "string",
                                          "enum": [
                                            "ascending",
                                            "descending"
                                          ]
                                        },
                                        "scope": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "global"
                                                }
                                              },
                                              "required": [
                                                "type"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "segment"
                                                },
                                                "segment": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "segment"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "group_key"
                                                },
                                                "key": {
                                                  "type": "string",
                                                  "maxLength": 255,
                                                  "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "key"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "type": "object"
                                        },
                                        "rank": {
                                          "type": "string",
                                          "const": "ordinal"
                                        },
                                        "privacy": {
                                          "type": "object",
                                          "properties": {
                                            "display": {
                                              "type": "string",
                                              "const": "pseudonymous"
                                            },
                                            "opt_out": {
                                              "type": "boolean",
                                              "const": true
                                            },
                                            "anonymous_entries": {
                                              "type": "boolean",
                                              "const": false
                                            }
                                          },
                                          "required": [
                                            "display",
                                            "opt_out",
                                            "anonymous_entries"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "prizes": {
                                          "maxItems": 100,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "key": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                              },
                                              "from": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 1000
                                              },
                                              "through": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 1000
                                              },
                                              "awards": {
                                                "minItems": 1,
                                                "maxItems": 16,
                                                "type": "array",
                                                "items": {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "string",
                                                          "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                        },
                                                        "type": {
                                                          "type": "string",
                                                          "const": "currency"
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor",
                                                        "type"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "reward"
                                                        },
                                                        "reward": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "quantity": {
                                                          "type": "number",
                                                          "const": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "reward",
                                                        "quantity"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "item"
                                                        },
                                                        "item": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                        },
                                                        "quantity": {
                                                          "type": "integer",
                                                          "minimum": 1,
                                                          "maximum": 1000
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "item",
                                                        "quantity"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  ],
                                                  "type": "object"
                                                }
                                              }
                                            },
                                            "required": [
                                              "key",
                                              "from",
                                              "through",
                                              "awards"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "score_source": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "contributions"
                                                }
                                              },
                                              "required": [
                                                "type"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "currency_earned"
                                                },
                                                "currency": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "currency"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "currency_balance"
                                                },
                                                "currency": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "currency"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "type": "object"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "aggregation",
                                        "input",
                                        "order",
                                        "scope",
                                        "rank",
                                        "privacy",
                                        "prizes"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "referral"
                                        },
                                        "attribution_window_seconds": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 9007199254740991
                                        },
                                        "account_eligibility": {
                                          "type": "string",
                                          "enum": [
                                            "new",
                                            "existing",
                                            "any"
                                          ]
                                        },
                                        "new_account_window_seconds": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 9007199254740991
                                        },
                                        "allow_anonymous_claim": {
                                          "type": "boolean"
                                        },
                                        "qualifying_event": {
                                          "type": "string",
                                          "maxLength": 255,
                                          "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                        },
                                        "minimum": {
                                          "type": "object",
                                          "properties": {
                                            "currency": {
                                              "type": "string",
                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                            },
                                            "amount_minor": {
                                              "type": "string",
                                              "pattern": "^(0|[1-9][0-9]{0,18})$"
                                            }
                                          },
                                          "required": [
                                            "currency",
                                            "amount_minor"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "cooling_off_seconds": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 9007199254740991
                                        },
                                        "rewards": {
                                          "type": "object",
                                          "properties": {
                                            "referrer": {
                                              "minItems": 1,
                                              "maxItems": 16,
                                              "type": "array",
                                              "items": {
                                                "oneOf": [
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "string",
                                                        "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                      },
                                                      "type": {
                                                        "type": "string",
                                                        "const": "currency"
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor",
                                                      "type"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "type": {
                                                        "type": "string",
                                                        "const": "reward"
                                                      },
                                                      "reward": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      },
                                                      "quantity": {
                                                        "type": "number",
                                                        "const": 1
                                                      }
                                                    },
                                                    "required": [
                                                      "type",
                                                      "reward",
                                                      "quantity"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "type": {
                                                        "type": "string",
                                                        "const": "item"
                                                      },
                                                      "item": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                      },
                                                      "quantity": {
                                                        "type": "integer",
                                                        "minimum": 1,
                                                        "maximum": 1000
                                                      }
                                                    },
                                                    "required": [
                                                      "type",
                                                      "item",
                                                      "quantity"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                ],
                                                "type": "object"
                                              }
                                            },
                                            "referred": {
                                              "minItems": 1,
                                              "maxItems": 16,
                                              "type": "array",
                                              "items": {
                                                "oneOf": [
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "string",
                                                        "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                      },
                                                      "type": {
                                                        "type": "string",
                                                        "const": "currency"
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor",
                                                      "type"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "type": {
                                                        "type": "string",
                                                        "const": "reward"
                                                      },
                                                      "reward": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      },
                                                      "quantity": {
                                                        "type": "number",
                                                        "const": 1
                                                      }
                                                    },
                                                    "required": [
                                                      "type",
                                                      "reward",
                                                      "quantity"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  {
                                                    "type": "object",
                                                    "properties": {
                                                      "type": {
                                                        "type": "string",
                                                        "const": "item"
                                                      },
                                                      "item": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                      },
                                                      "quantity": {
                                                        "type": "integer",
                                                        "minimum": 1,
                                                        "maximum": 1000
                                                      }
                                                    },
                                                    "required": [
                                                      "type",
                                                      "item",
                                                      "quantity"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                ],
                                                "type": "object"
                                              }
                                            }
                                          },
                                          "required": [
                                            "referrer",
                                            "referred"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "caps": {
                                          "type": "object",
                                          "properties": {
                                            "per_referrer": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 9007199254740991
                                            },
                                            "per_environment": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 9007199254740991
                                            }
                                          },
                                          "required": [
                                            "per_referrer",
                                            "per_environment"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "refund": {
                                          "type": "string",
                                          "const": "proportional_then_invalidate"
                                        },
                                        "approval": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "mode": {
                                                  "type": "string",
                                                  "const": "review"
                                                }
                                              },
                                              "required": [
                                                "mode"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "mode": {
                                                  "type": "string",
                                                  "const": "automatic"
                                                },
                                                "period_seconds": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 2678400
                                                },
                                                "max_per_referrer_per_period": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 9007199254740991
                                                },
                                                "max_per_period": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 9007199254740991
                                                }
                                              },
                                              "required": [
                                                "mode",
                                                "period_seconds",
                                                "max_per_referrer_per_period",
                                                "max_per_period"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "type": "object"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "attribution_window_seconds",
                                        "account_eligibility",
                                        "allow_anonymous_claim",
                                        "qualifying_event",
                                        "minimum",
                                        "cooling_off_seconds",
                                        "rewards",
                                        "caps",
                                        "refund"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "campaign"
                                        },
                                        "priority": {
                                          "type": "integer",
                                          "minimum": -2147483648,
                                          "maximum": 2147483647
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "priority"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "reward"
                                        },
                                        "reward": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "reward"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ],
                                  "type": "object"
                                },
                                "qualification": {
                                  "type": "object",
                                  "properties": {
                                    "sources": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "event": {
                                            "type": "string",
                                            "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                          },
                                          "conditions": {
                                            "$ref": "#/components/schemas/__schema3"
                                          },
                                          "value": {
                                            "anyOf": [
                                              {
                                                "type": "number"
                                              },
                                              {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            ]
                                          },
                                          "step": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "occurrence": {
                                            "default": "lifetime",
                                            "type": "string",
                                            "enum": [
                                              "lifetime",
                                              "period"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "event"
                                        ],
                                        "additionalProperties": false
                                      }
                                    },
                                    "audience": {
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                      }
                                    },
                                    "starts_at": {
                                      "type": "string",
                                      "format": "date-time",
                                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                    },
                                    "ends_at": {
                                      "type": "string",
                                      "format": "date-time",
                                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                    },
                                    "campaign": {
                                      "type": "string",
                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                    }
                                  },
                                  "required": [
                                    "sources"
                                  ],
                                  "additionalProperties": false
                                },
                                "calendar": {
                                  "type": "object",
                                  "properties": {
                                    "schema": {
                                      "type": "string",
                                      "const": "orishare.calendar/v1"
                                    },
                                    "period": {
                                      "anyOf": [
                                        {
                                          "type": "string",
                                          "enum": [
                                            "none",
                                            "day",
                                            "week",
                                            "month",
                                            "year"
                                          ]
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "season"
                                            },
                                            "starts_at": {
                                              "type": "string",
                                              "format": "date-time",
                                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                            },
                                            "ends_at": {
                                              "type": "string",
                                              "format": "date-time",
                                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "starts_at",
                                            "ends_at"
                                          ],
                                          "additionalProperties": false
                                        }
                                      ]
                                    },
                                    "run_per_period": {
                                      "type": "boolean"
                                    },
                                    "timezone_source": {
                                      "type": "string",
                                      "enum": [
                                        "environment",
                                        "customer",
                                        "fixed"
                                      ]
                                    },
                                    "timezone": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "day_start_offset_minutes": {
                                      "default": 0,
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 1439
                                    },
                                    "ambiguous_local_time": {
                                      "type": "string",
                                      "const": "earlier"
                                    },
                                    "nonexistent_local_time": {
                                      "type": "string",
                                      "const": "next_valid"
                                    },
                                    "event_time": {
                                      "type": "object",
                                      "properties": {
                                        "merchant": {
                                          "type": "string",
                                          "const": "occurred_at"
                                        },
                                        "client": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "const": "received_at"
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "offline_seconds": {
                                                  "type": "integer",
                                                  "minimum": 0,
                                                  "maximum": 9007199254740991
                                                }
                                              },
                                              "required": [
                                                "offline_seconds"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ]
                                        }
                                      },
                                      "required": [
                                        "merchant",
                                        "client"
                                      ],
                                      "additionalProperties": false
                                    },
                                    "grace_seconds": {
                                      "default": 0,
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "max_lateness_seconds": {
                                      "default": 0,
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "settlement_delay_seconds": {
                                      "default": 0,
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "after_finalization": {
                                      "type": "string",
                                      "const": "correction_only"
                                    }
                                  },
                                  "required": [
                                    "schema",
                                    "period",
                                    "run_per_period",
                                    "timezone_source",
                                    "ambiguous_local_time",
                                    "nonexistent_local_time",
                                    "event_time",
                                    "after_finalization"
                                  ],
                                  "additionalProperties": false
                                },
                                "trust": {
                                  "type": "object",
                                  "properties": {
                                    "minimum_trust": {
                                      "type": "string",
                                      "enum": [
                                        "anonymous_claim",
                                        "customer_claim",
                                        "merchant_asserted",
                                        "verified_evidence",
                                        "legacy_unknown"
                                      ]
                                    },
                                    "allowed_sources": {
                                      "minItems": 1,
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "enum": [
                                          "publishable_event",
                                          "secret_key_event",
                                          "verified_connector",
                                          "operator_command",
                                          "customer_command",
                                          "import",
                                          "program_transition",
                                          "schedule"
                                        ]
                                      }
                                    },
                                    "on_insufficient": {
                                      "type": "string",
                                      "enum": [
                                        "ignore",
                                        "progress_without_reward"
                                      ]
                                    },
                                    "liability_caps": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "trust": {
                                            "type": "string",
                                            "enum": [
                                              "anonymous_claim",
                                              "customer_claim",
                                              "merchant_asserted",
                                              "verified_evidence",
                                              "legacy_unknown"
                                            ]
                                          },
                                          "currency": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9_-]+$"
                                          },
                                          "scope": {
                                            "type": "string",
                                            "enum": [
                                              "customer",
                                              "environment"
                                            ]
                                          },
                                          "window": {
                                            "type": "string",
                                            "enum": [
                                              "day",
                                              "month",
                                              "lifetime"
                                            ]
                                          },
                                          "maximum_minor": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": [
                                          "trust",
                                          "currency",
                                          "scope",
                                          "window",
                                          "maximum_minor"
                                        ],
                                        "additionalProperties": false
                                      }
                                    },
                                    "recognition_caps": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "trust": {
                                            "type": "string",
                                            "enum": [
                                              "anonymous_claim",
                                              "customer_claim",
                                              "merchant_asserted",
                                              "verified_evidence",
                                              "legacy_unknown"
                                            ]
                                          },
                                          "per": {
                                            "type": "string",
                                            "enum": [
                                              "period",
                                              "day"
                                            ]
                                          },
                                          "contributions": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "maximum": 9007199254740991
                                          },
                                          "value": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": [
                                          "trust",
                                          "per"
                                        ],
                                        "additionalProperties": false
                                      }
                                    },
                                    "allow_legacy_unknown": {
                                      "type": "boolean",
                                      "const": false
                                    }
                                  },
                                  "required": [
                                    "minimum_trust",
                                    "allowed_sources",
                                    "on_insufficient",
                                    "liability_caps",
                                    "recognition_caps",
                                    "allow_legacy_unknown"
                                  ],
                                  "additionalProperties": false
                                },
                                "correction": {
                                  "type": "object",
                                  "properties": {
                                    "qualification": {
                                      "default": "reverse",
                                      "type": "string",
                                      "enum": [
                                        "reverse",
                                        "keep"
                                      ]
                                    },
                                    "spendable": {
                                      "type": "string",
                                      "const": "reverse"
                                    },
                                    "xp": {
                                      "default": "reverse",
                                      "type": "string",
                                      "enum": [
                                        "reverse",
                                        "keep"
                                      ]
                                    },
                                    "recognition": {
                                      "default": "keep",
                                      "type": "string",
                                      "enum": [
                                        "keep",
                                        "revoke_on_fraud"
                                      ]
                                    },
                                    "after_finalization": {
                                      "default": "correcting_revision",
                                      "type": "string",
                                      "const": "correcting_revision"
                                    },
                                    "allowance_on_refund": {
                                      "default": "consumed",
                                      "type": "string",
                                      "enum": [
                                        "consumed",
                                        "release_on_verified_void"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "spendable"
                                  ],
                                  "additionalProperties": false
                                },
                                "reward": {
                                  "type": "object",
                                  "properties": {
                                    "on": {
                                      "type": "object",
                                      "propertyNames": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]*(?::[a-z0-9_]+)?$"
                                      },
                                      "additionalProperties": {
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "points.award"
                                                },
                                                "currency": {
                                                  "type": "string",
                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                },
                                                "amount": {
                                                  "anyOf": [
                                                    {
                                                      "type": "number"
                                                    },
                                                    {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  ]
                                                },
                                                "reason": {
                                                  "type": "string",
                                                  "maxLength": 200
                                                },
                                                "confirm_after": {
                                                  "type": "string",
                                                  "pattern": "^\\d+[smhdw]$"
                                                },
                                                "expires_after": {
                                                  "type": "string",
                                                  "pattern": "^\\d+[smhdw]$"
                                                },
                                                "effect_key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "liability": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "integer",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "currency",
                                                "amount",
                                                "effect_key"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "points.deduct"
                                                },
                                                "currency": {
                                                  "type": "string",
                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                },
                                                "amount": {
                                                  "anyOf": [
                                                    {
                                                      "type": "number"
                                                    },
                                                    {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  ]
                                                },
                                                "reason": {
                                                  "type": "string",
                                                  "maxLength": 200
                                                },
                                                "effect_key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "liability": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "integer",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "currency",
                                                "amount",
                                                "effect_key"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "points.reverse"
                                                },
                                                "currency": {
                                                  "type": "string",
                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                },
                                                "match": {
                                                  "type": "object",
                                                  "properties": {
                                                    "event": {
                                                      "type": "string",
                                                      "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                    },
                                                    "on": {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  },
                                                  "required": [
                                                    "event",
                                                    "on"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "fraction": {
                                                  "anyOf": [
                                                    {
                                                      "type": "number"
                                                    },
                                                    {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  ]
                                                },
                                                "amount": {
                                                  "anyOf": [
                                                    {
                                                      "type": "number"
                                                    },
                                                    {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  ]
                                                },
                                                "reason": {
                                                  "type": "string",
                                                  "maxLength": 200
                                                },
                                                "effect_key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "liability": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "integer",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "currency",
                                                "match",
                                                "effect_key"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "reward.issue"
                                                },
                                                "reward": {
                                                  "type": "string",
                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                },
                                                "effect_key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "liability": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "integer",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "reward",
                                                "effect_key"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "tier.evaluate"
                                                },
                                                "program": {
                                                  "type": "string",
                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                },
                                                "effect_key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "liability": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "integer",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "program",
                                                "effect_key"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "attribute.set"
                                                },
                                                "attribute": {
                                                  "type": "string",
                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                },
                                                "value": {
                                                  "type": [
                                                    "string",
                                                    "number",
                                                    "boolean",
                                                    "null"
                                                  ]
                                                },
                                                "effect_key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "liability": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "integer",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "attribute",
                                                "value",
                                                "effect_key"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "webhook.emit"
                                                },
                                                "event": {
                                                  "type": "string",
                                                  "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                },
                                                "payload": {
                                                  "type": "object",
                                                  "propertyNames": {
                                                    "type": "string"
                                                  },
                                                  "additionalProperties": {
                                                    "anyOf": [
                                                      {
                                                        "type": [
                                                          "string",
                                                          "number",
                                                          "boolean"
                                                        ]
                                                      },
                                                      {
                                                        "type": "null"
                                                      },
                                                      {
                                                        "type": "array",
                                                        "items": {
                                                          "type": [
                                                            "string",
                                                            "number",
                                                            "boolean"
                                                          ]
                                                        }
                                                      }
                                                    ]
                                                  }
                                                },
                                                "effect_key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "liability": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "integer",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "event",
                                                "effect_key"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "badge.contribute"
                                                },
                                                "badge": {
                                                  "type": "string",
                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                },
                                                "value": {
                                                  "anyOf": [
                                                    {
                                                      "type": "number"
                                                    },
                                                    {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  ]
                                                },
                                                "effect_key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "liability": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "integer",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "badge",
                                                "effect_key"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "badge.grant"
                                                },
                                                "badge": {
                                                  "type": "string",
                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                },
                                                "rank": {
                                                  "type": "string",
                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                },
                                                "occurrence": {
                                                  "type": "string",
                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                },
                                                "effect_key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "liability": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "integer",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "badge",
                                                "effect_key"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "streak.contribute"
                                                },
                                                "streak": {
                                                  "type": "string",
                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                },
                                                "value": {
                                                  "anyOf": [
                                                    {
                                                      "type": "number"
                                                    },
                                                    {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  ]
                                                },
                                                "effect_key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "liability": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "integer",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "streak",
                                                "effect_key"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "streak.freeze_grant"
                                                },
                                                "streak": {
                                                  "type": "string",
                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                },
                                                "quantity": {
                                                  "type": "integer",
                                                  "exclusiveMinimum": 0,
                                                  "maximum": 9007199254740991
                                                },
                                                "effect_key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "liability": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "integer",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "streak",
                                                "quantity",
                                                "effect_key"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "quest.contribute"
                                                },
                                                "quest": {
                                                  "type": "string",
                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                },
                                                "step": {
                                                  "type": "string",
                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                },
                                                "value": {
                                                  "anyOf": [
                                                    {
                                                      "type": "number"
                                                    },
                                                    {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  ]
                                                },
                                                "effect_key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "liability": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "integer",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "quest",
                                                "step",
                                                "effect_key"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "quest.enroll"
                                                },
                                                "quest": {
                                                  "type": "string",
                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                },
                                                "effect_key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "liability": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "integer",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "quest",
                                                "effect_key"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "leaderboard.contribute"
                                                },
                                                "leaderboard": {
                                                  "type": "string",
                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                },
                                                "value": {
                                                  "anyOf": [
                                                    {
                                                      "type": "number"
                                                    },
                                                    {
                                                      "type": "string",
                                                      "minLength": 1
                                                    }
                                                  ]
                                                },
                                                "effect_key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "liability": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "integer",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "leaderboard",
                                                "value",
                                                "effect_key"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "program.reverse_contribution"
                                                },
                                                "program": {
                                                  "type": "string",
                                                  "pattern": "^[A-Za-z0-9_-]+$"
                                                },
                                                "source_fact": {
                                                  "anyOf": [
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "fact_id": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        }
                                                      },
                                                      "required": [
                                                        "fact_id"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "object_type": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "key": {
                                                          "minItems": 1,
                                                          "type": "array",
                                                          "items": {
                                                            "type": "string",
                                                            "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_-]*(?:\\.[A-Za-z_][A-Za-z0-9_-]*)*$"
                                                          }
                                                        }
                                                      },
                                                      "required": [
                                                        "object_type",
                                                        "key"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  ]
                                                },
                                                "fraction": {
                                                  "type": "string",
                                                  "pattern": "^(?:0(?:\\.\\d+)?|1(?:\\.0+)?)$"
                                                },
                                                "amount": {
                                                  "type": "number",
                                                  "exclusiveMinimum": 0
                                                },
                                                "effect_key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "liability": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "integer",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "program",
                                                "source_fact",
                                                "effect_key"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "coupon.issue"
                                                },
                                                "offer": {
                                                  "type": "object",
                                                  "properties": {
                                                    "key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "version": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 9007199254740991
                                                    },
                                                    "digest": {
                                                      "type": "string",
                                                      "pattern": "^[a-f0-9]{64}$"
                                                    }
                                                  },
                                                  "required": [
                                                    "key",
                                                    "version",
                                                    "digest"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "effect_key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "liability": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "integer",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "offer",
                                                "effect_key"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "discount.quote"
                                                },
                                                "offer": {
                                                  "type": "object",
                                                  "properties": {
                                                    "key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "version": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 9007199254740991
                                                    },
                                                    "digest": {
                                                      "type": "string",
                                                      "pattern": "^[a-f0-9]{64}$"
                                                    }
                                                  },
                                                  "required": [
                                                    "key",
                                                    "version",
                                                    "digest"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "effect_key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "liability": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "integer",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "offer",
                                                "effect_key"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "item.grant"
                                                },
                                                "item": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                },
                                                "quantity": {
                                                  "default": 1,
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 1000
                                                },
                                                "effect_key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "liability": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "integer",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "item",
                                                "effect_key"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ]
                                        }
                                      }
                                    }
                                  },
                                  "required": [
                                    "on"
                                  ],
                                  "additionalProperties": false
                                },
                                "display": {
                                  "type": "object",
                                  "properties": {
                                    "title": {
                                      "type": "string"
                                    },
                                    "description": {
                                      "type": "string"
                                    },
                                    "image_url": {
                                      "type": "string",
                                      "format": "uri"
                                    },
                                    "icon": {
                                      "type": "string"
                                    },
                                    "color": {
                                      "type": "string"
                                    },
                                    "sort_order": {
                                      "default": 0,
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    "hidden": {
                                      "default": false,
                                      "type": "boolean"
                                    },
                                    "locales": {
                                      "default": {},
                                      "type": "object",
                                      "propertyNames": {
                                        "type": "string",
                                        "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
                                      },
                                      "additionalProperties": {
                                        "type": "object",
                                        "properties": {
                                          "title": {
                                            "type": "string"
                                          },
                                          "description": {
                                            "type": "string"
                                          }
                                        },
                                        "additionalProperties": false
                                      }
                                    }
                                  },
                                  "additionalProperties": false
                                },
                                "enrollment": {
                                  "type": "object",
                                  "properties": {
                                    "mode": {
                                      "default": "automatic",
                                      "type": "string",
                                      "enum": [
                                        "automatic",
                                        "explicit"
                                      ]
                                    }
                                  },
                                  "additionalProperties": false
                                },
                                "season": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "const": "season"
                                        },
                                        "key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "version": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 9007199254740991
                                        },
                                        "digest": {
                                          "type": "string",
                                          "pattern": "^[a-f0-9]{64}$"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "key",
                                        "version",
                                        "digest"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "kind": {
                                          "type": "string",
                                          "const": "season"
                                        },
                                        "use": {
                                          "type": "string",
                                          "const": "head"
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "kind",
                                        "use"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                },
                                "dependencies": {
                                  "default": [],
                                  "maxItems": 64,
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "program",
                                              "currency",
                                              "season",
                                              "reward",
                                              "counter",
                                              "segment",
                                              "campaign",
                                              "offer",
                                              "asset"
                                            ]
                                          },
                                          "key": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "version": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 9007199254740991
                                          },
                                          "digest": {
                                            "type": "string",
                                            "pattern": "^[a-f0-9]{64}$"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "key",
                                          "version",
                                          "digest"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "key": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "kind": {
                                            "type": "string",
                                            "enum": [
                                              "program",
                                              "season"
                                            ]
                                          },
                                          "use": {
                                            "type": "string",
                                            "const": "head"
                                          }
                                        },
                                        "required": [
                                          "key",
                                          "kind",
                                          "use"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                }
                              },
                              "required": [
                                "schema",
                                "kind",
                                "semantics",
                                "definition",
                                "qualification",
                                "calendar",
                                "trust",
                                "correction",
                                "reward",
                                "display",
                                "enrollment"
                              ],
                              "additionalProperties": false
                            },
                            "level_curve": {
                              "type": "object",
                              "properties": {
                                "curve": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "explicit"
                                        },
                                        "thresholds": {
                                          "minItems": 1,
                                          "maxItems": 1000,
                                          "type": "array",
                                          "items": {
                                            "type": "string",
                                            "pattern": "^(0|[1-9][0-9]{0,18})$"
                                          }
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "thresholds"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "linear"
                                        },
                                        "levels": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 1000
                                        },
                                        "step": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]{0,18})$"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "levels",
                                        "step"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "quadratic"
                                        },
                                        "levels": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 1000
                                        },
                                        "first_step": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]{0,18})$"
                                        },
                                        "step_increase": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]{0,18})$"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "levels",
                                        "first_step",
                                        "step_increase"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "exponential"
                                        },
                                        "levels": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 1000
                                        },
                                        "first_step": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]{0,18})$"
                                        },
                                        "growth": {
                                          "type": "string",
                                          "pattern": "^[1-9][0-9]{0,2}(\\.[0-9]{1,4})?$"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "levels",
                                        "first_step",
                                        "growth"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "table"
                                        },
                                        "steps": {
                                          "minItems": 1,
                                          "maxItems": 999,
                                          "type": "array",
                                          "items": {
                                            "type": "string",
                                            "pattern": "^(0|[1-9][0-9]{0,18})$"
                                          }
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "steps"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ],
                                  "type": "object"
                                },
                                "title": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                }
                              },
                              "required": [
                                "curve"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "type",
                            "key",
                            "definition"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "program.save_draft"
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "definition": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "schema": {
                                      "type": "string",
                                      "const": "orishare.program/v2"
                                    },
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "tier",
                                        "quest",
                                        "campaign",
                                        "reward",
                                        "streak",
                                        "badge",
                                        "leaderboard",
                                        "referral"
                                      ]
                                    },
                                    "semantics": {
                                      "type": "string",
                                      "const": "native_v2"
                                    },
                                    "definition": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "streak"
                                            },
                                            "qualification": {
                                              "type": "object",
                                              "properties": {
                                                "aggregation": {
                                                  "type": "string",
                                                  "enum": [
                                                    "count",
                                                    "sum"
                                                  ]
                                                },
                                                "minimum": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                }
                                              },
                                              "required": [
                                                "aggregation",
                                                "minimum"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "freezes": {
                                              "type": "object",
                                              "properties": {
                                                "ceiling": {
                                                  "type": "integer",
                                                  "minimum": 0,
                                                  "maximum": 1000
                                                },
                                                "auto_use": {
                                                  "default": true,
                                                  "type": "boolean"
                                                },
                                                "purchase": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "ceiling"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "milestones": {
                                              "maxItems": 64,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "threshold": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 9007199254740991
                                                  },
                                                  "occurrence": {
                                                    "type": "string",
                                                    "enum": [
                                                      "lifetime",
                                                      "episode"
                                                    ]
                                                  }
                                                },
                                                "required": [
                                                  "key",
                                                  "threshold",
                                                  "occurrence"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "repair": {
                                              "type": "object",
                                              "properties": {
                                                "price": {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "amount_minor": {
                                                      "type": "string",
                                                      "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount_minor"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                "window_periods": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 30
                                                },
                                                "maximum_per_days": {
                                                  "type": "object",
                                                  "properties": {
                                                    "count": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 1000
                                                    },
                                                    "days": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 366
                                                    }
                                                  },
                                                  "required": [
                                                    "count",
                                                    "days"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "price",
                                                "window_periods"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "protected_weekdays": {
                                              "minItems": 1,
                                              "maxItems": 6,
                                              "type": "array",
                                              "items": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 6
                                              }
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "qualification",
                                            "freezes",
                                            "milestones"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "badge"
                                            },
                                            "qualification": {
                                              "oneOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "aggregation": {
                                                      "type": "string",
                                                      "const": "count"
                                                    }
                                                  },
                                                  "required": [
                                                    "aggregation"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "aggregation": {
                                                      "type": "string",
                                                      "const": "sum"
                                                    }
                                                  },
                                                  "required": [
                                                    "aggregation"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "aggregation": {
                                                      "type": "string",
                                                      "const": "distinct"
                                                    },
                                                    "distinct_key": {
                                                      "type": "string",
                                                      "maxLength": 255,
                                                      "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                                    }
                                                  },
                                                  "required": [
                                                    "aggregation",
                                                    "distinct_key"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ],
                                              "type": "object"
                                            },
                                            "ranks": {
                                              "minItems": 1,
                                              "maxItems": 64,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "threshold": {
                                                    "type": "string",
                                                    "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                  },
                                                  "display": {
                                                    "type": "object",
                                                    "properties": {
                                                      "title": {
                                                        "type": "string",
                                                        "maxLength": 255
                                                      },
                                                      "description": {
                                                        "type": "string",
                                                        "maxLength": 4096
                                                      }
                                                    },
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "key",
                                                  "threshold"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "visibility": {
                                              "type": "string",
                                              "enum": [
                                                "visible",
                                                "hidden_until_earned"
                                              ]
                                            },
                                            "collection": {
                                              "type": "string",
                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                            },
                                            "repeatable": {
                                              "type": "boolean"
                                            },
                                            "occurrence": {
                                              "oneOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "lifetime"
                                                    }
                                                  },
                                                  "required": [
                                                    "type"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "period"
                                                    }
                                                  },
                                                  "required": [
                                                    "type"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "season"
                                                    }
                                                  },
                                                  "required": [
                                                    "type"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "verified_fact"
                                                    }
                                                  },
                                                  "required": [
                                                    "type"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ],
                                              "type": "object"
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "qualification",
                                            "ranks",
                                            "visibility",
                                            "repeatable",
                                            "occurrence"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "quest"
                                            },
                                            "steps": {
                                              "minItems": 1,
                                              "maxItems": 32,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "aggregation": {
                                                    "type": "string",
                                                    "enum": [
                                                      "count",
                                                      "sum",
                                                      "distinct"
                                                    ]
                                                  },
                                                  "target": {
                                                    "type": "string",
                                                    "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                  },
                                                  "distinct_key": {
                                                    "type": "string",
                                                    "maxLength": 255,
                                                    "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                                  },
                                                  "display": {
                                                    "type": "object",
                                                    "properties": {
                                                      "title": {
                                                        "type": "string",
                                                        "maxLength": 255
                                                      },
                                                      "description": {
                                                        "type": "string",
                                                        "maxLength": 4096
                                                      }
                                                    },
                                                    "additionalProperties": false
                                                  },
                                                  "available_from": {
                                                    "type": "string",
                                                    "format": "date-time",
                                                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                  },
                                                  "deadline": {
                                                    "type": "string",
                                                    "format": "date-time",
                                                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                  }
                                                },
                                                "required": [
                                                  "key",
                                                  "aggregation",
                                                  "target",
                                                  "display"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "prerequisites": {
                                              "maxItems": 64,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "step": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "requires": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  }
                                                },
                                                "required": [
                                                  "step",
                                                  "requires"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "collection": {
                                              "type": "string",
                                              "enum": [
                                                "auto_collect",
                                                "claim"
                                              ]
                                            },
                                            "repeatable": {
                                              "type": "boolean"
                                            },
                                            "claim_deadline": {
                                              "type": "string",
                                              "format": "date-time",
                                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                            },
                                            "chain": {
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "const": "program"
                                                    },
                                                    "key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "version": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 9007199254740991
                                                    },
                                                    "digest": {
                                                      "type": "string",
                                                      "pattern": "^[a-f0-9]{64}$"
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "key",
                                                    "version",
                                                    "digest"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "kind": {
                                                      "type": "string",
                                                      "const": "program"
                                                    },
                                                    "use": {
                                                      "type": "string",
                                                      "const": "head"
                                                    }
                                                  },
                                                  "required": [
                                                    "key",
                                                    "kind",
                                                    "use"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ]
                                            },
                                            "rotation": {
                                              "type": "object",
                                              "properties": {
                                                "candidates": {
                                                  "minItems": 1,
                                                  "maxItems": 100,
                                                  "type": "array",
                                                  "items": {
                                                    "anyOf": [
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "program"
                                                          },
                                                          "key": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                          },
                                                          "version": {
                                                            "type": "integer",
                                                            "minimum": 1,
                                                            "maximum": 9007199254740991
                                                          },
                                                          "digest": {
                                                            "type": "string",
                                                            "pattern": "^[a-f0-9]{64}$"
                                                          }
                                                        },
                                                        "required": [
                                                          "kind",
                                                          "key",
                                                          "version",
                                                          "digest"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "key": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                          },
                                                          "kind": {
                                                            "type": "string",
                                                            "const": "program"
                                                          },
                                                          "use": {
                                                            "type": "string",
                                                            "const": "head"
                                                          }
                                                        },
                                                        "required": [
                                                          "key",
                                                          "kind",
                                                          "use"
                                                        ],
                                                        "additionalProperties": false
                                                      }
                                                    ]
                                                  }
                                                },
                                                "select": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 100
                                                }
                                              },
                                              "required": [
                                                "candidates",
                                                "select"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "steps",
                                            "prerequisites",
                                            "collection",
                                            "repeatable"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "tier"
                                            },
                                            "currency": {
                                              "type": "string",
                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                            },
                                            "basis": {
                                              "oneOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "lifetime_earned"
                                                    }
                                                  },
                                                  "required": [
                                                    "type"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "balance"
                                                    }
                                                  },
                                                  "required": [
                                                    "type"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "earned_rolling_days"
                                                    },
                                                    "days": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "days"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ],
                                              "type": "object"
                                            },
                                            "downgrade_check": {
                                              "type": "string",
                                              "enum": [
                                                "daily",
                                                "monthly",
                                                "never"
                                              ]
                                            },
                                            "levels": {
                                              "minItems": 1,
                                              "maxItems": 1000,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "threshold": {
                                                    "type": "string",
                                                    "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                  },
                                                  "display": {
                                                    "type": "object",
                                                    "properties": {
                                                      "title": {
                                                        "type": "string",
                                                        "maxLength": 255
                                                      },
                                                      "description": {
                                                        "type": "string",
                                                        "maxLength": 4096
                                                      }
                                                    },
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "key",
                                                  "threshold",
                                                  "display"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "occurrence": {
                                              "oneOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "lifetime"
                                                    }
                                                  },
                                                  "required": [
                                                    "type"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "season"
                                                    }
                                                  },
                                                  "required": [
                                                    "type"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "prestige"
                                                    },
                                                    "maximum_runs": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "maximum_runs"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ],
                                              "type": "object"
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "currency",
                                            "basis",
                                            "downgrade_check",
                                            "levels",
                                            "occurrence"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "leaderboard"
                                            },
                                            "aggregation": {
                                              "type": "string",
                                              "enum": [
                                                "sum",
                                                "max",
                                                "latest_verified"
                                              ]
                                            },
                                            "input": {
                                              "type": "object",
                                              "properties": {
                                                "minimum": {
                                                  "type": "string",
                                                  "pattern": "^(0|-?[1-9][0-9]{0,18})$"
                                                },
                                                "maximum": {
                                                  "type": "string",
                                                  "pattern": "^(0|-?[1-9][0-9]{0,18})$"
                                                }
                                              },
                                              "required": [
                                                "minimum",
                                                "maximum"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "order": {
                                              "type": "string",
                                              "enum": [
                                                "ascending",
                                                "descending"
                                              ]
                                            },
                                            "scope": {
                                              "oneOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "global"
                                                    }
                                                  },
                                                  "required": [
                                                    "type"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "segment"
                                                    },
                                                    "segment": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "segment"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "group_key"
                                                    },
                                                    "key": {
                                                      "type": "string",
                                                      "maxLength": 255,
                                                      "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "key"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ],
                                              "type": "object"
                                            },
                                            "rank": {
                                              "type": "string",
                                              "const": "ordinal"
                                            },
                                            "privacy": {
                                              "type": "object",
                                              "properties": {
                                                "display": {
                                                  "type": "string",
                                                  "const": "pseudonymous"
                                                },
                                                "opt_out": {
                                                  "type": "boolean",
                                                  "const": true
                                                },
                                                "anonymous_entries": {
                                                  "type": "boolean",
                                                  "const": false
                                                }
                                              },
                                              "required": [
                                                "display",
                                                "opt_out",
                                                "anonymous_entries"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "prizes": {
                                              "maxItems": 100,
                                              "type": "array",
                                              "items": {
                                                "type": "object",
                                                "properties": {
                                                  "key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "from": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 1000
                                                  },
                                                  "through": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 1000
                                                  },
                                                  "awards": {
                                                    "minItems": 1,
                                                    "maxItems": 16,
                                                    "type": "array",
                                                    "items": {
                                                      "oneOf": [
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "currency": {
                                                              "type": "string",
                                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                            },
                                                            "amount_minor": {
                                                              "type": "string",
                                                              "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                            },
                                                            "type": {
                                                              "type": "string",
                                                              "const": "currency"
                                                            }
                                                          },
                                                          "required": [
                                                            "currency",
                                                            "amount_minor",
                                                            "type"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "reward"
                                                            },
                                                            "reward": {
                                                              "type": "string",
                                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                            },
                                                            "quantity": {
                                                              "type": "number",
                                                              "const": 1
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "reward",
                                                            "quantity"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "type": {
                                                              "type": "string",
                                                              "const": "item"
                                                            },
                                                            "item": {
                                                              "type": "string",
                                                              "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                            },
                                                            "quantity": {
                                                              "type": "integer",
                                                              "minimum": 1,
                                                              "maximum": 1000
                                                            }
                                                          },
                                                          "required": [
                                                            "type",
                                                            "item",
                                                            "quantity"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      ],
                                                      "type": "object"
                                                    }
                                                  }
                                                },
                                                "required": [
                                                  "key",
                                                  "from",
                                                  "through",
                                                  "awards"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "score_source": {
                                              "oneOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "contributions"
                                                    }
                                                  },
                                                  "required": [
                                                    "type"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "currency_earned"
                                                    },
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "currency"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "currency_balance"
                                                    },
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "currency"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ],
                                              "type": "object"
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "aggregation",
                                            "input",
                                            "order",
                                            "scope",
                                            "rank",
                                            "privacy",
                                            "prizes"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "referral"
                                            },
                                            "attribution_window_seconds": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 9007199254740991
                                            },
                                            "account_eligibility": {
                                              "type": "string",
                                              "enum": [
                                                "new",
                                                "existing",
                                                "any"
                                              ]
                                            },
                                            "new_account_window_seconds": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 9007199254740991
                                            },
                                            "allow_anonymous_claim": {
                                              "type": "boolean"
                                            },
                                            "qualifying_event": {
                                              "type": "string",
                                              "maxLength": 255,
                                              "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                            },
                                            "minimum": {
                                              "type": "object",
                                              "properties": {
                                                "currency": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "amount_minor": {
                                                  "type": "string",
                                                  "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                }
                                              },
                                              "required": [
                                                "currency",
                                                "amount_minor"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "cooling_off_seconds": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 9007199254740991
                                            },
                                            "rewards": {
                                              "type": "object",
                                              "properties": {
                                                "referrer": {
                                                  "minItems": 1,
                                                  "maxItems": 16,
                                                  "type": "array",
                                                  "items": {
                                                    "oneOf": [
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "currency": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                          },
                                                          "amount_minor": {
                                                            "type": "string",
                                                            "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                          },
                                                          "type": {
                                                            "type": "string",
                                                            "const": "currency"
                                                          }
                                                        },
                                                        "required": [
                                                          "currency",
                                                          "amount_minor",
                                                          "type"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "type": {
                                                            "type": "string",
                                                            "const": "reward"
                                                          },
                                                          "reward": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                          },
                                                          "quantity": {
                                                            "type": "number",
                                                            "const": 1
                                                          }
                                                        },
                                                        "required": [
                                                          "type",
                                                          "reward",
                                                          "quantity"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "type": {
                                                            "type": "string",
                                                            "const": "item"
                                                          },
                                                          "item": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                          },
                                                          "quantity": {
                                                            "type": "integer",
                                                            "minimum": 1,
                                                            "maximum": 1000
                                                          }
                                                        },
                                                        "required": [
                                                          "type",
                                                          "item",
                                                          "quantity"
                                                        ],
                                                        "additionalProperties": false
                                                      }
                                                    ],
                                                    "type": "object"
                                                  }
                                                },
                                                "referred": {
                                                  "minItems": 1,
                                                  "maxItems": 16,
                                                  "type": "array",
                                                  "items": {
                                                    "oneOf": [
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "currency": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                          },
                                                          "amount_minor": {
                                                            "type": "string",
                                                            "pattern": "^(0|[1-9][0-9]{0,18})$"
                                                          },
                                                          "type": {
                                                            "type": "string",
                                                            "const": "currency"
                                                          }
                                                        },
                                                        "required": [
                                                          "currency",
                                                          "amount_minor",
                                                          "type"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "type": {
                                                            "type": "string",
                                                            "const": "reward"
                                                          },
                                                          "reward": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                          },
                                                          "quantity": {
                                                            "type": "number",
                                                            "const": 1
                                                          }
                                                        },
                                                        "required": [
                                                          "type",
                                                          "reward",
                                                          "quantity"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "type": {
                                                            "type": "string",
                                                            "const": "item"
                                                          },
                                                          "item": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                          },
                                                          "quantity": {
                                                            "type": "integer",
                                                            "minimum": 1,
                                                            "maximum": 1000
                                                          }
                                                        },
                                                        "required": [
                                                          "type",
                                                          "item",
                                                          "quantity"
                                                        ],
                                                        "additionalProperties": false
                                                      }
                                                    ],
                                                    "type": "object"
                                                  }
                                                }
                                              },
                                              "required": [
                                                "referrer",
                                                "referred"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "caps": {
                                              "type": "object",
                                              "properties": {
                                                "per_referrer": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 9007199254740991
                                                },
                                                "per_environment": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 9007199254740991
                                                }
                                              },
                                              "required": [
                                                "per_referrer",
                                                "per_environment"
                                              ],
                                              "additionalProperties": false
                                            },
                                            "refund": {
                                              "type": "string",
                                              "const": "proportional_then_invalidate"
                                            },
                                            "approval": {
                                              "oneOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "mode": {
                                                      "type": "string",
                                                      "const": "review"
                                                    }
                                                  },
                                                  "required": [
                                                    "mode"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "mode": {
                                                      "type": "string",
                                                      "const": "automatic"
                                                    },
                                                    "period_seconds": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 2678400
                                                    },
                                                    "max_per_referrer_per_period": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 9007199254740991
                                                    },
                                                    "max_per_period": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "mode",
                                                    "period_seconds",
                                                    "max_per_referrer_per_period",
                                                    "max_per_period"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ],
                                              "type": "object"
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "attribution_window_seconds",
                                            "account_eligibility",
                                            "allow_anonymous_claim",
                                            "qualifying_event",
                                            "minimum",
                                            "cooling_off_seconds",
                                            "rewards",
                                            "caps",
                                            "refund"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "campaign"
                                            },
                                            "priority": {
                                              "type": "integer",
                                              "minimum": -2147483648,
                                              "maximum": 2147483647
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "priority"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "reward"
                                            },
                                            "reward": {
                                              "type": "string",
                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "reward"
                                          ],
                                          "additionalProperties": false
                                        }
                                      ],
                                      "type": "object"
                                    },
                                    "qualification": {
                                      "type": "object",
                                      "properties": {
                                        "sources": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "event": {
                                                "type": "string",
                                                "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                              },
                                              "conditions": {
                                                "$ref": "#/components/schemas/__schema3"
                                              },
                                              "value": {
                                                "anyOf": [
                                                  {
                                                    "type": "number"
                                                  },
                                                  {
                                                    "type": "string",
                                                    "minLength": 1
                                                  }
                                                ]
                                              },
                                              "step": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                              },
                                              "occurrence": {
                                                "default": "lifetime",
                                                "type": "string",
                                                "enum": [
                                                  "lifetime",
                                                  "period"
                                                ]
                                              }
                                            },
                                            "required": [
                                              "event"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "audience": {
                                          "type": "array",
                                          "items": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          }
                                        },
                                        "starts_at": {
                                          "type": "string",
                                          "format": "date-time",
                                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                        },
                                        "ends_at": {
                                          "type": "string",
                                          "format": "date-time",
                                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                        },
                                        "campaign": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        }
                                      },
                                      "required": [
                                        "sources"
                                      ],
                                      "additionalProperties": false
                                    },
                                    "calendar": {
                                      "type": "object",
                                      "properties": {
                                        "schema": {
                                          "type": "string",
                                          "const": "orishare.calendar/v1"
                                        },
                                        "period": {
                                          "anyOf": [
                                            {
                                              "type": "string",
                                              "enum": [
                                                "none",
                                                "day",
                                                "week",
                                                "month",
                                                "year"
                                              ]
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "kind": {
                                                  "type": "string",
                                                  "const": "season"
                                                },
                                                "starts_at": {
                                                  "type": "string",
                                                  "format": "date-time",
                                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                },
                                                "ends_at": {
                                                  "type": "string",
                                                  "format": "date-time",
                                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                }
                                              },
                                              "required": [
                                                "kind",
                                                "starts_at",
                                                "ends_at"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ]
                                        },
                                        "run_per_period": {
                                          "type": "boolean"
                                        },
                                        "timezone_source": {
                                          "type": "string",
                                          "enum": [
                                            "environment",
                                            "customer",
                                            "fixed"
                                          ]
                                        },
                                        "timezone": {
                                          "type": "string",
                                          "minLength": 1
                                        },
                                        "day_start_offset_minutes": {
                                          "default": 0,
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 1439
                                        },
                                        "ambiguous_local_time": {
                                          "type": "string",
                                          "const": "earlier"
                                        },
                                        "nonexistent_local_time": {
                                          "type": "string",
                                          "const": "next_valid"
                                        },
                                        "event_time": {
                                          "type": "object",
                                          "properties": {
                                            "merchant": {
                                              "type": "string",
                                              "const": "occurred_at"
                                            },
                                            "client": {
                                              "anyOf": [
                                                {
                                                  "type": "string",
                                                  "const": "received_at"
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "offline_seconds": {
                                                      "type": "integer",
                                                      "minimum": 0,
                                                      "maximum": 9007199254740991
                                                    }
                                                  },
                                                  "required": [
                                                    "offline_seconds"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ]
                                            }
                                          },
                                          "required": [
                                            "merchant",
                                            "client"
                                          ],
                                          "additionalProperties": false
                                        },
                                        "grace_seconds": {
                                          "default": 0,
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 9007199254740991
                                        },
                                        "max_lateness_seconds": {
                                          "default": 0,
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 9007199254740991
                                        },
                                        "settlement_delay_seconds": {
                                          "default": 0,
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 9007199254740991
                                        },
                                        "after_finalization": {
                                          "type": "string",
                                          "const": "correction_only"
                                        }
                                      },
                                      "required": [
                                        "schema",
                                        "period",
                                        "run_per_period",
                                        "timezone_source",
                                        "ambiguous_local_time",
                                        "nonexistent_local_time",
                                        "event_time",
                                        "after_finalization"
                                      ],
                                      "additionalProperties": false
                                    },
                                    "trust": {
                                      "type": "object",
                                      "properties": {
                                        "minimum_trust": {
                                          "type": "string",
                                          "enum": [
                                            "anonymous_claim",
                                            "customer_claim",
                                            "merchant_asserted",
                                            "verified_evidence",
                                            "legacy_unknown"
                                          ]
                                        },
                                        "allowed_sources": {
                                          "minItems": 1,
                                          "type": "array",
                                          "items": {
                                            "type": "string",
                                            "enum": [
                                              "publishable_event",
                                              "secret_key_event",
                                              "verified_connector",
                                              "operator_command",
                                              "customer_command",
                                              "import",
                                              "program_transition",
                                              "schedule"
                                            ]
                                          }
                                        },
                                        "on_insufficient": {
                                          "type": "string",
                                          "enum": [
                                            "ignore",
                                            "progress_without_reward"
                                          ]
                                        },
                                        "liability_caps": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "trust": {
                                                "type": "string",
                                                "enum": [
                                                  "anonymous_claim",
                                                  "customer_claim",
                                                  "merchant_asserted",
                                                  "verified_evidence",
                                                  "legacy_unknown"
                                                ]
                                              },
                                              "currency": {
                                                "type": "string",
                                                "pattern": "^[A-Za-z0-9_-]+$"
                                              },
                                              "scope": {
                                                "type": "string",
                                                "enum": [
                                                  "customer",
                                                  "environment"
                                                ]
                                              },
                                              "window": {
                                                "type": "string",
                                                "enum": [
                                                  "day",
                                                  "month",
                                                  "lifetime"
                                                ]
                                              },
                                              "maximum_minor": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "trust",
                                              "currency",
                                              "scope",
                                              "window",
                                              "maximum_minor"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "recognition_caps": {
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "trust": {
                                                "type": "string",
                                                "enum": [
                                                  "anonymous_claim",
                                                  "customer_claim",
                                                  "merchant_asserted",
                                                  "verified_evidence",
                                                  "legacy_unknown"
                                                ]
                                              },
                                              "per": {
                                                "type": "string",
                                                "enum": [
                                                  "period",
                                                  "day"
                                                ]
                                              },
                                              "contributions": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              },
                                              "value": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "trust",
                                              "per"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "allow_legacy_unknown": {
                                          "type": "boolean",
                                          "const": false
                                        }
                                      },
                                      "required": [
                                        "minimum_trust",
                                        "allowed_sources",
                                        "on_insufficient",
                                        "liability_caps",
                                        "recognition_caps",
                                        "allow_legacy_unknown"
                                      ],
                                      "additionalProperties": false
                                    },
                                    "correction": {
                                      "type": "object",
                                      "properties": {
                                        "qualification": {
                                          "default": "reverse",
                                          "type": "string",
                                          "enum": [
                                            "reverse",
                                            "keep"
                                          ]
                                        },
                                        "spendable": {
                                          "type": "string",
                                          "const": "reverse"
                                        },
                                        "xp": {
                                          "default": "reverse",
                                          "type": "string",
                                          "enum": [
                                            "reverse",
                                            "keep"
                                          ]
                                        },
                                        "recognition": {
                                          "default": "keep",
                                          "type": "string",
                                          "enum": [
                                            "keep",
                                            "revoke_on_fraud"
                                          ]
                                        },
                                        "after_finalization": {
                                          "default": "correcting_revision",
                                          "type": "string",
                                          "const": "correcting_revision"
                                        },
                                        "allowance_on_refund": {
                                          "default": "consumed",
                                          "type": "string",
                                          "enum": [
                                            "consumed",
                                            "release_on_verified_void"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "spendable"
                                      ],
                                      "additionalProperties": false
                                    },
                                    "reward": {
                                      "type": "object",
                                      "properties": {
                                        "on": {
                                          "type": "object",
                                          "propertyNames": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]*(?::[a-z0-9_]+)?$"
                                          },
                                          "additionalProperties": {
                                            "type": "array",
                                            "items": {
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "points.award"
                                                    },
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "amount": {
                                                      "anyOf": [
                                                        {
                                                          "type": "number"
                                                        },
                                                        {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      ]
                                                    },
                                                    "reason": {
                                                      "type": "string",
                                                      "maxLength": 200
                                                    },
                                                    "confirm_after": {
                                                      "type": "string",
                                                      "pattern": "^\\d+[smhdw]$"
                                                    },
                                                    "expires_after": {
                                                      "type": "string",
                                                      "pattern": "^\\d+[smhdw]$"
                                                    },
                                                    "effect_key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "liability": {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "currency",
                                                    "amount",
                                                    "effect_key"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "points.deduct"
                                                    },
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "amount": {
                                                      "anyOf": [
                                                        {
                                                          "type": "number"
                                                        },
                                                        {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      ]
                                                    },
                                                    "reason": {
                                                      "type": "string",
                                                      "maxLength": 200
                                                    },
                                                    "effect_key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "liability": {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "currency",
                                                    "amount",
                                                    "effect_key"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "points.reverse"
                                                    },
                                                    "currency": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "match": {
                                                      "type": "object",
                                                      "properties": {
                                                        "event": {
                                                          "type": "string",
                                                          "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                        },
                                                        "on": {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "event",
                                                        "on"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "fraction": {
                                                      "anyOf": [
                                                        {
                                                          "type": "number"
                                                        },
                                                        {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      ]
                                                    },
                                                    "amount": {
                                                      "anyOf": [
                                                        {
                                                          "type": "number"
                                                        },
                                                        {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      ]
                                                    },
                                                    "reason": {
                                                      "type": "string",
                                                      "maxLength": 200
                                                    },
                                                    "effect_key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "liability": {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "currency",
                                                    "match",
                                                    "effect_key"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "reward.issue"
                                                    },
                                                    "reward": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "effect_key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "liability": {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "reward",
                                                    "effect_key"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "tier.evaluate"
                                                    },
                                                    "program": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "effect_key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "liability": {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "program",
                                                    "effect_key"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "attribute.set"
                                                    },
                                                    "attribute": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "value": {
                                                      "type": [
                                                        "string",
                                                        "number",
                                                        "boolean",
                                                        "null"
                                                      ]
                                                    },
                                                    "effect_key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "liability": {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "attribute",
                                                    "value",
                                                    "effect_key"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "webhook.emit"
                                                    },
                                                    "event": {
                                                      "type": "string",
                                                      "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                    },
                                                    "payload": {
                                                      "type": "object",
                                                      "propertyNames": {
                                                        "type": "string"
                                                      },
                                                      "additionalProperties": {
                                                        "anyOf": [
                                                          {
                                                            "type": [
                                                              "string",
                                                              "number",
                                                              "boolean"
                                                            ]
                                                          },
                                                          {
                                                            "type": "null"
                                                          },
                                                          {
                                                            "type": "array",
                                                            "items": {
                                                              "type": [
                                                                "string",
                                                                "number",
                                                                "boolean"
                                                              ]
                                                            }
                                                          }
                                                        ]
                                                      }
                                                    },
                                                    "effect_key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "liability": {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "event",
                                                    "effect_key"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "badge.contribute"
                                                    },
                                                    "badge": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "value": {
                                                      "anyOf": [
                                                        {
                                                          "type": "number"
                                                        },
                                                        {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      ]
                                                    },
                                                    "effect_key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "liability": {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "badge",
                                                    "effect_key"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "badge.grant"
                                                    },
                                                    "badge": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "rank": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "occurrence": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "effect_key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "liability": {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "badge",
                                                    "effect_key"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "streak.contribute"
                                                    },
                                                    "streak": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "value": {
                                                      "anyOf": [
                                                        {
                                                          "type": "number"
                                                        },
                                                        {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      ]
                                                    },
                                                    "effect_key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "liability": {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "streak",
                                                    "effect_key"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "streak.freeze_grant"
                                                    },
                                                    "streak": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "quantity": {
                                                      "type": "integer",
                                                      "exclusiveMinimum": 0,
                                                      "maximum": 9007199254740991
                                                    },
                                                    "effect_key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "liability": {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "streak",
                                                    "quantity",
                                                    "effect_key"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "quest.contribute"
                                                    },
                                                    "quest": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "step": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "value": {
                                                      "anyOf": [
                                                        {
                                                          "type": "number"
                                                        },
                                                        {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      ]
                                                    },
                                                    "effect_key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "liability": {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "quest",
                                                    "step",
                                                    "effect_key"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "quest.enroll"
                                                    },
                                                    "quest": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "effect_key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "liability": {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "quest",
                                                    "effect_key"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "leaderboard.contribute"
                                                    },
                                                    "leaderboard": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "value": {
                                                      "anyOf": [
                                                        {
                                                          "type": "number"
                                                        },
                                                        {
                                                          "type": "string",
                                                          "minLength": 1
                                                        }
                                                      ]
                                                    },
                                                    "effect_key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "liability": {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "leaderboard",
                                                    "value",
                                                    "effect_key"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "program.reverse_contribution"
                                                    },
                                                    "program": {
                                                      "type": "string",
                                                      "pattern": "^[A-Za-z0-9_-]+$"
                                                    },
                                                    "source_fact": {
                                                      "anyOf": [
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "fact_id": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            }
                                                          },
                                                          "required": [
                                                            "fact_id"
                                                          ],
                                                          "additionalProperties": false
                                                        },
                                                        {
                                                          "type": "object",
                                                          "properties": {
                                                            "object_type": {
                                                              "type": "string",
                                                              "pattern": "^[A-Za-z0-9_-]+$"
                                                            },
                                                            "key": {
                                                              "minItems": 1,
                                                              "type": "array",
                                                              "items": {
                                                                "type": "string",
                                                                "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_-]*(?:\\.[A-Za-z_][A-Za-z0-9_-]*)*$"
                                                              }
                                                            }
                                                          },
                                                          "required": [
                                                            "object_type",
                                                            "key"
                                                          ],
                                                          "additionalProperties": false
                                                        }
                                                      ]
                                                    },
                                                    "fraction": {
                                                      "type": "string",
                                                      "pattern": "^(?:0(?:\\.\\d+)?|1(?:\\.0+)?)$"
                                                    },
                                                    "amount": {
                                                      "type": "number",
                                                      "exclusiveMinimum": 0
                                                    },
                                                    "effect_key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "liability": {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "program",
                                                    "source_fact",
                                                    "effect_key"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "coupon.issue"
                                                    },
                                                    "offer": {
                                                      "type": "object",
                                                      "properties": {
                                                        "key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "version": {
                                                          "type": "integer",
                                                          "minimum": 1,
                                                          "maximum": 9007199254740991
                                                        },
                                                        "digest": {
                                                          "type": "string",
                                                          "pattern": "^[a-f0-9]{64}$"
                                                        }
                                                      },
                                                      "required": [
                                                        "key",
                                                        "version",
                                                        "digest"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "effect_key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "liability": {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "offer",
                                                    "effect_key"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "discount.quote"
                                                    },
                                                    "offer": {
                                                      "type": "object",
                                                      "properties": {
                                                        "key": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "version": {
                                                          "type": "integer",
                                                          "minimum": 1,
                                                          "maximum": 9007199254740991
                                                        },
                                                        "digest": {
                                                          "type": "string",
                                                          "pattern": "^[a-f0-9]{64}$"
                                                        }
                                                      },
                                                      "required": [
                                                        "key",
                                                        "version",
                                                        "digest"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    "effect_key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "liability": {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "offer",
                                                    "effect_key"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "item.grant"
                                                    },
                                                    "item": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                    },
                                                    "quantity": {
                                                      "default": 1,
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 1000
                                                    },
                                                    "effect_key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "liability": {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[A-Za-z0-9_-]+$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "integer",
                                                          "exclusiveMinimum": 0,
                                                          "maximum": 9007199254740991
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "item",
                                                    "effect_key"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ]
                                            }
                                          }
                                        }
                                      },
                                      "required": [
                                        "on"
                                      ],
                                      "additionalProperties": false
                                    },
                                    "display": {
                                      "type": "object",
                                      "properties": {
                                        "title": {
                                          "type": "string"
                                        },
                                        "description": {
                                          "type": "string"
                                        },
                                        "image_url": {
                                          "type": "string",
                                          "format": "uri"
                                        },
                                        "icon": {
                                          "type": "string"
                                        },
                                        "color": {
                                          "type": "string"
                                        },
                                        "sort_order": {
                                          "default": 0,
                                          "type": "integer",
                                          "minimum": -9007199254740991,
                                          "maximum": 9007199254740991
                                        },
                                        "hidden": {
                                          "default": false,
                                          "type": "boolean"
                                        },
                                        "locales": {
                                          "default": {},
                                          "type": "object",
                                          "propertyNames": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
                                          },
                                          "additionalProperties": {
                                            "type": "object",
                                            "properties": {
                                              "title": {
                                                "type": "string"
                                              },
                                              "description": {
                                                "type": "string"
                                              }
                                            },
                                            "additionalProperties": false
                                          }
                                        }
                                      },
                                      "additionalProperties": false
                                    },
                                    "enrollment": {
                                      "type": "object",
                                      "properties": {
                                        "mode": {
                                          "default": "automatic",
                                          "type": "string",
                                          "enum": [
                                            "automatic",
                                            "explicit"
                                          ]
                                        }
                                      },
                                      "additionalProperties": false
                                    },
                                    "season": {
                                      "anyOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "season"
                                            },
                                            "key": {
                                              "type": "string",
                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                            },
                                            "version": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 9007199254740991
                                            },
                                            "digest": {
                                              "type": "string",
                                              "pattern": "^[a-f0-9]{64}$"
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "key",
                                            "version",
                                            "digest"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "key": {
                                              "type": "string",
                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                            },
                                            "kind": {
                                              "type": "string",
                                              "const": "season"
                                            },
                                            "use": {
                                              "type": "string",
                                              "const": "head"
                                            }
                                          },
                                          "required": [
                                            "key",
                                            "kind",
                                            "use"
                                          ],
                                          "additionalProperties": false
                                        }
                                      ]
                                    },
                                    "dependencies": {
                                      "default": [],
                                      "maxItems": 64,
                                      "type": "array",
                                      "items": {
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "enum": [
                                                  "program",
                                                  "currency",
                                                  "season",
                                                  "reward",
                                                  "counter",
                                                  "segment",
                                                  "campaign",
                                                  "offer",
                                                  "asset"
                                                ]
                                              },
                                              "key": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                              },
                                              "version": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 9007199254740991
                                              },
                                              "digest": {
                                                "type": "string",
                                                "pattern": "^[a-f0-9]{64}$"
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "key",
                                              "version",
                                              "digest"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "key": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                              },
                                              "kind": {
                                                "type": "string",
                                                "enum": [
                                                  "program",
                                                  "season"
                                                ]
                                              },
                                              "use": {
                                                "type": "string",
                                                "const": "head"
                                              }
                                            },
                                            "required": [
                                              "key",
                                              "kind",
                                              "use"
                                            ],
                                            "additionalProperties": false
                                          }
                                        ]
                                      }
                                    }
                                  },
                                  "required": [
                                    "schema",
                                    "kind",
                                    "semantics",
                                    "definition",
                                    "qualification",
                                    "calendar",
                                    "trust",
                                    "correction",
                                    "reward",
                                    "display",
                                    "enrollment"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "level_curve": {
                              "type": "object",
                              "properties": {
                                "curve": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "explicit"
                                        },
                                        "thresholds": {
                                          "minItems": 1,
                                          "maxItems": 1000,
                                          "type": "array",
                                          "items": {
                                            "type": "string",
                                            "pattern": "^(0|[1-9][0-9]{0,18})$"
                                          }
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "thresholds"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "linear"
                                        },
                                        "levels": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 1000
                                        },
                                        "step": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]{0,18})$"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "levels",
                                        "step"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "quadratic"
                                        },
                                        "levels": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 1000
                                        },
                                        "first_step": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]{0,18})$"
                                        },
                                        "step_increase": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]{0,18})$"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "levels",
                                        "first_step",
                                        "step_increase"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "exponential"
                                        },
                                        "levels": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 1000
                                        },
                                        "first_step": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]{0,18})$"
                                        },
                                        "growth": {
                                          "type": "string",
                                          "pattern": "^[1-9][0-9]{0,2}(\\.[0-9]{1,4})?$"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "levels",
                                        "first_step",
                                        "growth"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "table"
                                        },
                                        "steps": {
                                          "minItems": 1,
                                          "maxItems": 999,
                                          "type": "array",
                                          "items": {
                                            "type": "string",
                                            "pattern": "^(0|[1-9][0-9]{0,18})$"
                                          }
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "steps"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ],
                                  "type": "object"
                                },
                                "title": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                }
                              },
                              "required": [
                                "curve"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "type",
                            "key",
                            "definition"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "program.pause"
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            }
                          },
                          "required": [
                            "type",
                            "key"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "season.create"
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            }
                          },
                          "required": [
                            "type",
                            "key",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "season.publish_definition"
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "definition": {
                              "type": "object",
                              "properties": {
                                "schema": {
                                  "type": "string",
                                  "const": "orishare.season/v1"
                                },
                                "starts_at": {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                },
                                "ends_at": {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                },
                                "display": {
                                  "type": "object",
                                  "properties": {
                                    "title": {
                                      "type": "string"
                                    },
                                    "description": {
                                      "type": "string"
                                    },
                                    "image_url": {
                                      "type": "string",
                                      "format": "uri"
                                    },
                                    "icon": {
                                      "type": "string"
                                    },
                                    "color": {
                                      "type": "string"
                                    },
                                    "sort_order": {
                                      "default": 0,
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    "hidden": {
                                      "default": false,
                                      "type": "boolean"
                                    },
                                    "locales": {
                                      "default": {},
                                      "type": "object",
                                      "propertyNames": {
                                        "type": "string",
                                        "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
                                      },
                                      "additionalProperties": {
                                        "type": "object",
                                        "properties": {
                                          "title": {
                                            "type": "string"
                                          },
                                          "description": {
                                            "type": "string"
                                          }
                                        },
                                        "additionalProperties": false
                                      }
                                    }
                                  },
                                  "additionalProperties": false
                                },
                                "eligibility": {
                                  "type": "object",
                                  "properties": {
                                    "audience": {
                                      "maxItems": 64,
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                      }
                                    }
                                  },
                                  "required": [
                                    "audience"
                                  ],
                                  "additionalProperties": false
                                },
                                "admission": {
                                  "type": "object",
                                  "properties": {
                                    "grace_seconds": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "max_lateness_seconds": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "grace_seconds",
                                    "max_lateness_seconds"
                                  ],
                                  "additionalProperties": false
                                },
                                "settlement": {
                                  "type": "object",
                                  "properties": {
                                    "delay_seconds": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "delay_seconds"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "required": [
                                "schema",
                                "starts_at",
                                "ends_at",
                                "display",
                                "eligibility",
                                "admission",
                                "settlement"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "type",
                            "key",
                            "definition"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "season.archive"
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            }
                          },
                          "required": [
                            "type",
                            "key"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "season.set_scheduling"
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "scheduling": {
                              "type": "string",
                              "enum": [
                                "active",
                                "stopped"
                              ]
                            }
                          },
                          "required": [
                            "type",
                            "key",
                            "scheduling"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "catalogue.create"
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            }
                          },
                          "required": [
                            "type",
                            "key",
                            "name"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "offer.publish_terms"
                            },
                            "catalogue": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "terms": {
                              "type": "object",
                              "properties": {
                                "display": {
                                  "type": "object",
                                  "properties": {
                                    "title": {
                                      "type": "string",
                                      "maxLength": 255
                                    },
                                    "description": {
                                      "type": "string",
                                      "maxLength": 4096
                                    }
                                  },
                                  "additionalProperties": false
                                },
                                "currency_id": {
                                  "type": "string",
                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                },
                                "cost_minor": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9][0-9]{0,18})$"
                                },
                                "quantity": {
                                  "type": "number",
                                  "const": 1
                                },
                                "eligibility": {
                                  "type": "object",
                                  "properties": {
                                    "audience": {
                                      "maxItems": 64,
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                      }
                                    },
                                    "minimum_assurance": {
                                      "type": "string",
                                      "enum": [
                                        "anonymous",
                                        "authenticated_customer"
                                      ]
                                    },
                                    "minimum_tier": {
                                      "type": "object",
                                      "properties": {
                                        "tier_program": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 255
                                        },
                                        "min_level": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 60
                                        }
                                      },
                                      "required": [
                                        "tier_program",
                                        "min_level"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "required": [
                                    "audience",
                                    "minimum_assurance"
                                  ],
                                  "additionalProperties": false
                                },
                                "reward": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "version": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 9007199254740991
                                        },
                                        "digest": {
                                          "type": "string",
                                          "pattern": "^[a-f0-9]{64}$"
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "version",
                                        "digest"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "use": {
                                          "type": "string",
                                          "const": "head"
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "use"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                },
                                "season": {
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "version": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 9007199254740991
                                        },
                                        "digest": {
                                          "type": "string",
                                          "pattern": "^[a-f0-9]{64}$"
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "version",
                                        "digest"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "use": {
                                          "type": "string",
                                          "const": "head"
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "use"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ]
                                },
                                "stock": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "unlimited"
                                        }
                                      },
                                      "required": [
                                        "type"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "inventory"
                                        },
                                        "inventory_key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "inventory_key"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "code_pool"
                                        },
                                        "pool_key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "pool_key"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ],
                                  "type": "object"
                                },
                                "delivery": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "manual"
                                        }
                                      },
                                      "required": [
                                        "type"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "code"
                                        },
                                        "pool_key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "pool_key"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "webhook"
                                        },
                                        "provider_key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "idempotent": {
                                          "type": "boolean"
                                        },
                                        "reconcilable": {
                                          "type": "boolean"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "provider_key",
                                        "idempotent",
                                        "reconcilable"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ],
                                  "type": "object"
                                },
                                "quote_ttl_seconds": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 86400
                                },
                                "entitlement_ttl_seconds": {
                                  "anyOf": [
                                    {
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 315360000
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "cancellation": {
                                  "type": "string",
                                  "enum": [
                                    "before_commitment",
                                    "proven_reversal"
                                  ]
                                },
                                "discount": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "fixed"
                                        },
                                        "currency": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "amount_minor": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]{0,18})$"
                                        },
                                        "maximum_minor": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]{0,18})$"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "currency",
                                        "amount_minor",
                                        "maximum_minor"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "basis_points"
                                        },
                                        "currency": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "basis_points": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 10000
                                        },
                                        "maximum_minor": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]{0,18})$"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "currency",
                                        "basis_points",
                                        "maximum_minor"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ],
                                  "type": "object"
                                }
                              },
                              "required": [
                                "display",
                                "currency_id",
                                "cost_minor",
                                "quantity",
                                "eligibility",
                                "stock",
                                "delivery",
                                "quote_ttl_seconds",
                                "entitlement_ttl_seconds",
                                "cancellation"
                              ],
                              "additionalProperties": false
                            },
                            "listed": {
                              "type": "boolean",
                              "const": true
                            }
                          },
                          "required": [
                            "type",
                            "catalogue",
                            "key",
                            "terms",
                            "listed"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "segment.create"
                            },
                            "name": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_]{0,59}$"
                            },
                            "kind": {
                              "type": "string",
                              "enum": [
                                "static",
                                "dynamic"
                              ]
                            },
                            "definition": {
                              "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                            }
                          },
                          "required": [
                            "type",
                            "name",
                            "kind"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "attribute_definition.upsert"
                            },
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_]{0,63}$"
                            },
                            "definition": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "string",
                                    "number",
                                    "boolean",
                                    "timestamp"
                                  ]
                                },
                                "description": {
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 500
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "pii": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "type"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "required": [
                            "type",
                            "key",
                            "definition"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "context.update"
                            },
                            "business_description": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 8000
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "vocabulary": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {
                                "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                              }
                            },
                            "glossary": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {
                                "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                              }
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "starts_at": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "ends_at": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "priority": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "stacking_group": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 60
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "exclusive": {
                              "type": "boolean"
                            },
                            "budget": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "amount": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "currency": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "window": {
                                      "type": "string",
                                      "enum": [
                                        "none",
                                        "day",
                                        "week",
                                        "month",
                                        "year"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "amount",
                                    "currency"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "audience": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "segments": {
                                      "minItems": 1,
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    }
                                  },
                                  "required": [
                                    "segments"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "draft",
                                "active",
                                "paused",
                                "ended"
                              ]
                            },
                            "type": {
                              "type": "string",
                              "const": "campaign.create"
                            }
                          },
                          "required": [
                            "name",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "campaign.delete"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "draft",
                                "active",
                                "paused",
                                "ended"
                              ]
                            },
                            "type": {
                              "type": "string",
                              "const": "campaign.set_status"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "status",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "starts_at": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "ends_at": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "priority": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "stacking_group": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "maxLength": 60
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "exclusive": {
                              "type": "boolean"
                            },
                            "budget": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "amount": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "currency": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "window": {
                                      "type": "string",
                                      "enum": [
                                        "none",
                                        "day",
                                        "week",
                                        "month",
                                        "year"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "amount",
                                    "currency"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "audience": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "segments": {
                                      "minItems": 1,
                                      "type": "array",
                                      "items": {
                                        "type": "string",
                                        "minLength": 1
                                      }
                                    }
                                  },
                                  "required": [
                                    "segments"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "type": {
                              "type": "string",
                              "const": "campaign.update"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "qualifying": {
                              "type": "object",
                              "properties": {
                                "event": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "conditions": {
                                  "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                                }
                              },
                              "required": [
                                "event"
                              ],
                              "additionalProperties": false
                            },
                            "target": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "period": {
                              "type": "string",
                              "enum": [
                                "none",
                                "day",
                                "week",
                                "month"
                              ]
                            },
                            "contribution_key": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "enrollment": {
                              "type": "string",
                              "enum": [
                                "automatic",
                                "explicit"
                              ]
                            },
                            "repeatable": {
                              "type": "boolean"
                            },
                            "completion_actions": {
                              "maxItems": 10,
                              "type": "array",
                              "items": {
                                "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                              }
                            },
                            "campaign_id": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "starts_at": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "ends_at": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "draft",
                                "active",
                                "paused",
                                "ended"
                              ]
                            },
                            "type": {
                              "type": "string",
                              "const": "challenge.create"
                            }
                          },
                          "required": [
                            "name",
                            "qualifying",
                            "target",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "challenge.delete"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "draft",
                                "active",
                                "paused",
                                "ended"
                              ]
                            },
                            "type": {
                              "type": "string",
                              "const": "challenge.set_status"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "status",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "qualifying": {
                              "type": "object",
                              "properties": {
                                "event": {
                                  "type": "string",
                                  "minLength": 1
                                },
                                "conditions": {
                                  "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                                }
                              },
                              "required": [
                                "event"
                              ],
                              "additionalProperties": false
                            },
                            "target": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "period": {
                              "type": "string",
                              "enum": [
                                "none",
                                "day",
                                "week",
                                "month"
                              ]
                            },
                            "contribution_key": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "enrollment": {
                              "type": "string",
                              "enum": [
                                "automatic",
                                "explicit"
                              ]
                            },
                            "repeatable": {
                              "type": "boolean"
                            },
                            "completion_actions": {
                              "maxItems": 10,
                              "type": "array",
                              "items": {
                                "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                              }
                            },
                            "campaign_id": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "starts_at": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "ends_at": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "type": {
                              "type": "string",
                              "const": "challenge.update"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_]{0,59}$"
                            },
                            "event": {
                              "type": "string",
                              "minLength": 1
                            },
                            "window": {
                              "type": "string",
                              "enum": [
                                "none",
                                "day",
                                "week",
                                "month",
                                "year"
                              ]
                            },
                            "filter": {
                              "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                            },
                            "type": {
                              "type": "string",
                              "const": "counter_definition.create"
                            }
                          },
                          "required": [
                            "name",
                            "event",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "type": {
                              "type": "string",
                              "const": "counter_definition.delete"
                            }
                          },
                          "required": [
                            "key",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_]{0,31}$"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "precision": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 6
                            },
                            "expiration_policy": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "never",
                                    "days"
                                  ]
                                },
                                "days": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "type"
                              ],
                              "additionalProperties": false
                            },
                            "negative_balance": {
                              "type": "string",
                              "enum": [
                                "forbid",
                                "allow"
                              ]
                            },
                            "capabilities": {
                              "type": "object",
                              "properties": {
                                "schema": {
                                  "type": "string",
                                  "const": "orishare.currency-capabilities/v1"
                                },
                                "spendable": {
                                  "type": "boolean"
                                },
                                "transferable": {
                                  "type": "boolean"
                                },
                                "qualification": {
                                  "type": "string",
                                  "enum": [
                                    "none",
                                    "earned",
                                    "xp"
                                  ]
                                },
                                "expiry": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "none"
                                        }
                                      },
                                      "required": [
                                        "type"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "after"
                                        },
                                        "seconds": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 3153600000
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "seconds"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ],
                                  "type": "object"
                                }
                              },
                              "required": [
                                "schema",
                                "spendable",
                                "transferable",
                                "qualification",
                                "expiry"
                              ],
                              "additionalProperties": false
                            },
                            "type": {
                              "type": "string",
                              "const": "currency.create"
                            }
                          },
                          "required": [
                            "code",
                            "name",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "currency.delete"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "expiration_policy": {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "enum": [
                                    "never",
                                    "days"
                                  ]
                                },
                                "days": {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "type"
                              ],
                              "additionalProperties": false
                            },
                            "negative_balance": {
                              "type": "string",
                              "enum": [
                                "forbid",
                                "allow"
                              ]
                            },
                            "type": {
                              "type": "string",
                              "const": "currency.update"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_battle_pass.archive"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_]{0,63}$"
                            },
                            "definition": {
                              "type": "object",
                              "properties": {
                                "season": {
                                  "type": "string",
                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                },
                                "xp_currency": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                },
                                "tiers": {
                                  "minItems": 1,
                                  "maxItems": 200,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "key": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                      },
                                      "threshold": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "free": {
                                        "default": [],
                                        "maxItems": 8,
                                        "type": "array",
                                        "items": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "currency"
                                                },
                                                "currency": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 64
                                                },
                                                "amount_minor": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 9007199254740991
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "currency",
                                                "amount_minor"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "item"
                                                },
                                                "item": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                },
                                                "quantity": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 1000000
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "item",
                                                "quantity"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "type": "object"
                                        }
                                      },
                                      "premium": {
                                        "default": [],
                                        "maxItems": 8,
                                        "type": "array",
                                        "items": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "currency"
                                                },
                                                "currency": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 64
                                                },
                                                "amount_minor": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 9007199254740991
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "currency",
                                                "amount_minor"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "item"
                                                },
                                                "item": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                },
                                                "quantity": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 1000000
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "item",
                                                "quantity"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "type": "object"
                                        }
                                      }
                                    },
                                    "required": [
                                      "key",
                                      "threshold"
                                    ],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": [
                                "season",
                                "xp_currency",
                                "tiers"
                              ],
                              "additionalProperties": false
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_battle_pass.create"
                            }
                          },
                          "required": [
                            "key",
                            "definition",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_battle_pass.pause"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_battle_pass.resume"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "definition": {
                              "type": "object",
                              "properties": {
                                "season": {
                                  "type": "string",
                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                },
                                "xp_currency": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                },
                                "tiers": {
                                  "minItems": 1,
                                  "maxItems": 200,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "key": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                      },
                                      "threshold": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "free": {
                                        "default": [],
                                        "maxItems": 8,
                                        "type": "array",
                                        "items": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "currency"
                                                },
                                                "currency": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 64
                                                },
                                                "amount_minor": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 9007199254740991
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "currency",
                                                "amount_minor"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "item"
                                                },
                                                "item": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                },
                                                "quantity": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 1000000
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "item",
                                                "quantity"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "type": "object"
                                        }
                                      },
                                      "premium": {
                                        "default": [],
                                        "maxItems": 8,
                                        "type": "array",
                                        "items": {
                                          "oneOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "currency"
                                                },
                                                "currency": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 64
                                                },
                                                "amount_minor": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 9007199254740991
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "currency",
                                                "amount_minor"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "item"
                                                },
                                                "item": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                },
                                                "quantity": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 1000000
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "item",
                                                "quantity"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ],
                                          "type": "object"
                                        }
                                      }
                                    },
                                    "required": [
                                      "key",
                                      "threshold"
                                    ],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": [
                                "season",
                                "xp_currency",
                                "tiers"
                              ],
                              "additionalProperties": false
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_battle_pass.update"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "definition",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_energy.archive"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_]{0,63}$"
                            },
                            "maximum": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 1000000
                            },
                            "refill": {
                              "type": "object",
                              "properties": {
                                "amount": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000000
                                },
                                "every_seconds": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 604800
                                }
                              },
                              "required": [
                                "amount",
                                "every_seconds"
                              ],
                              "additionalProperties": false
                            },
                            "overfill_maximum": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000000
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_energy.create"
                            }
                          },
                          "required": [
                            "key",
                            "maximum",
                            "refill",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_energy.pause"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_energy.resume"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "maximum": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 1000000
                            },
                            "refill": {
                              "type": "object",
                              "properties": {
                                "amount": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000000
                                },
                                "every_seconds": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 604800
                                }
                              },
                              "required": [
                                "amount",
                                "every_seconds"
                              ],
                              "additionalProperties": false
                            },
                            "overfill_maximum": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000000
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_energy.update"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_item.archive"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_]{0,63}$"
                            },
                            "item_type": {
                              "type": "string",
                              "enum": [
                                "durable",
                                "consumable"
                              ]
                            },
                            "max_quantity": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 1000000
                            },
                            "equip_slot": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^[a-z][a-z0-9_]{0,31}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "effect": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "none"
                                    }
                                  },
                                  "required": [
                                    "type"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "energy_refill"
                                    },
                                    "energy": {
                                      "type": "string",
                                      "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                    },
                                    "amount": {
                                      "anyOf": [
                                        {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 1000000
                                        },
                                        {
                                          "type": "string",
                                          "const": "full"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "energy",
                                    "amount"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "boost"
                                    },
                                    "currency": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 64
                                    },
                                    "multiplier": {
                                      "type": "string",
                                      "pattern": "^(?:10(?:\\.0{1,2})?|[1-9](?:\\.[0-9]{1,2})?)$"
                                    },
                                    "duration_seconds": {
                                      "type": "integer",
                                      "minimum": 60,
                                      "maximum": 604800
                                    },
                                    "stacking": {
                                      "type": "string",
                                      "enum": [
                                        "extend",
                                        "refresh",
                                        "stack"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "currency",
                                    "multiplier",
                                    "duration_seconds",
                                    "stacking"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "chest"
                                    },
                                    "loot_table": {
                                      "type": "string",
                                      "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "loot_table"
                                  ],
                                  "additionalProperties": false
                                }
                              ],
                              "type": "object"
                            },
                            "display": {
                              "type": "object",
                              "properties": {
                                "title": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "description": {
                                  "default": "",
                                  "type": "string",
                                  "maxLength": 500
                                },
                                "image_url": {
                                  "default": null,
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 2048,
                                      "format": "uri"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "rarity": {
                                  "default": null,
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "pattern": "^[a-z][a-z0-9_]{0,31}$"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "title"
                              ],
                              "additionalProperties": false
                            },
                            "metadata": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_item.create"
                            }
                          },
                          "required": [
                            "key",
                            "item_type",
                            "display",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "max_quantity": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 1000000
                            },
                            "equip_slot": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^[a-z][a-z0-9_]{0,31}$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "effect": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "none"
                                    }
                                  },
                                  "required": [
                                    "type"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "energy_refill"
                                    },
                                    "energy": {
                                      "type": "string",
                                      "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                    },
                                    "amount": {
                                      "anyOf": [
                                        {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 1000000
                                        },
                                        {
                                          "type": "string",
                                          "const": "full"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "energy",
                                    "amount"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "boost"
                                    },
                                    "currency": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 64
                                    },
                                    "multiplier": {
                                      "type": "string",
                                      "pattern": "^(?:10(?:\\.0{1,2})?|[1-9](?:\\.[0-9]{1,2})?)$"
                                    },
                                    "duration_seconds": {
                                      "type": "integer",
                                      "minimum": 60,
                                      "maximum": 604800
                                    },
                                    "stacking": {
                                      "type": "string",
                                      "enum": [
                                        "extend",
                                        "refresh",
                                        "stack"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "currency",
                                    "multiplier",
                                    "duration_seconds",
                                    "stacking"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "chest"
                                    },
                                    "loot_table": {
                                      "type": "string",
                                      "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "loot_table"
                                  ],
                                  "additionalProperties": false
                                }
                              ],
                              "type": "object"
                            },
                            "display": {
                              "type": "object",
                              "properties": {
                                "title": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "description": {
                                  "default": "",
                                  "type": "string",
                                  "maxLength": 500
                                },
                                "image_url": {
                                  "default": null,
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "maxLength": 2048,
                                      "format": "uri"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                },
                                "rarity": {
                                  "default": null,
                                  "anyOf": [
                                    {
                                      "type": "string",
                                      "pattern": "^[a-z][a-z0-9_]{0,31}$"
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "title"
                              ],
                              "additionalProperties": false
                            },
                            "metadata": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_item.update"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_loot_table.archive"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_]{0,63}$"
                            },
                            "definition": {
                              "type": "object",
                              "properties": {
                                "rolls": {
                                  "default": 1,
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 10
                                },
                                "entries": {
                                  "minItems": 1,
                                  "maxItems": 100,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "key": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                      },
                                      "weight": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 1000000
                                      },
                                      "award": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "currency"
                                              },
                                              "currency": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 64
                                              },
                                              "amount_minor": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "currency",
                                              "amount_minor"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "item"
                                              },
                                              "item": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                              },
                                              "quantity": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 1000000
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "item",
                                              "quantity"
                                            ],
                                            "additionalProperties": false
                                          }
                                        ],
                                        "type": "object"
                                      },
                                      "max_per_customer": {
                                        "default": null,
                                        "anyOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 1000000
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "budget": {
                                        "default": null,
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "maximum": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 1000000000
                                              }
                                            },
                                            "required": [
                                              "maximum"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "key",
                                      "weight",
                                      "award"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "guaranteed": {
                                  "default": [],
                                  "maxItems": 10,
                                  "type": "array",
                                  "items": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "currency"
                                          },
                                          "currency": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 64
                                          },
                                          "amount_minor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "currency",
                                          "amount_minor"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "item"
                                          },
                                          "item": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                          },
                                          "quantity": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 1000000
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "item",
                                          "quantity"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ],
                                    "type": "object"
                                  }
                                },
                                "pity": {
                                  "default": null,
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "entry_key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                        },
                                        "after_rolls": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 100000
                                        }
                                      },
                                      "required": [
                                        "entry_key",
                                        "after_rolls"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "entries"
                              ],
                              "additionalProperties": false
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_loot_table.create"
                            }
                          },
                          "required": [
                            "key",
                            "definition",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_loot_table.pause"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_loot_table.resume"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "definition": {
                              "type": "object",
                              "properties": {
                                "rolls": {
                                  "default": 1,
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 10
                                },
                                "entries": {
                                  "minItems": 1,
                                  "maxItems": 100,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "key": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                      },
                                      "weight": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 1000000
                                      },
                                      "award": {
                                        "oneOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "currency"
                                              },
                                              "currency": {
                                                "type": "string",
                                                "minLength": 1,
                                                "maxLength": 64
                                              },
                                              "amount_minor": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "currency",
                                              "amount_minor"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "type": {
                                                "type": "string",
                                                "const": "item"
                                              },
                                              "item": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                              },
                                              "quantity": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 1000000
                                              }
                                            },
                                            "required": [
                                              "type",
                                              "item",
                                              "quantity"
                                            ],
                                            "additionalProperties": false
                                          }
                                        ],
                                        "type": "object"
                                      },
                                      "max_per_customer": {
                                        "default": null,
                                        "anyOf": [
                                          {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 1000000
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      },
                                      "budget": {
                                        "default": null,
                                        "anyOf": [
                                          {
                                            "type": "object",
                                            "properties": {
                                              "maximum": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 1000000000
                                              }
                                            },
                                            "required": [
                                              "maximum"
                                            ],
                                            "additionalProperties": false
                                          },
                                          {
                                            "type": "null"
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "key",
                                      "weight",
                                      "award"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "guaranteed": {
                                  "default": [],
                                  "maxItems": 10,
                                  "type": "array",
                                  "items": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "currency"
                                          },
                                          "currency": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 64
                                          },
                                          "amount_minor": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "currency",
                                          "amount_minor"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "item"
                                          },
                                          "item": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                          },
                                          "quantity": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 1000000
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "item",
                                          "quantity"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ],
                                    "type": "object"
                                  }
                                },
                                "pity": {
                                  "default": null,
                                  "anyOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "entry_key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                        },
                                        "after_rolls": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 100000
                                        }
                                      },
                                      "required": [
                                        "entry_key",
                                        "after_rolls"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "null"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "entries"
                              ],
                              "additionalProperties": false
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_loot_table.update"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "definition",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_offer.archive"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_]{0,63}$"
                            },
                            "item": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_]{0,63}$"
                            },
                            "quantity": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 1000000
                            },
                            "price": {
                              "type": "object",
                              "properties": {
                                "currency": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                },
                                "amount_minor": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "currency",
                                "amount_minor"
                              ],
                              "additionalProperties": false
                            },
                            "per_customer_limit": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000000
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "available_from": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "available_until": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_offer.create"
                            }
                          },
                          "required": [
                            "key",
                            "item",
                            "price",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "quantity": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 1000000
                            },
                            "price": {
                              "type": "object",
                              "properties": {
                                "currency": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                },
                                "amount_minor": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "currency",
                                "amount_minor"
                              ],
                              "additionalProperties": false
                            },
                            "per_customer_limit": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000000
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "available_from": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "available_until": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "type": {
                              "type": "string",
                              "const": "economy_offer.update"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "description": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 2000
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "goal_event": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "goal_value_property": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "audience": {
                              "anyOf": [
                                {
                                  "$ref": "#/components/schemas/ExperimentAudience"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "variants": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "key": {
                                    "type": "string",
                                    "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$"
                                  },
                                  "name": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120
                                  },
                                  "weight_bps": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 9999
                                  },
                                  "targets": {
                                    "default": [],
                                    "maxItems": 50,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "rule",
                                            "campaign",
                                            "program",
                                            "friend_quest",
                                            "team_quest"
                                          ]
                                        },
                                        "key": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 255,
                                          "description": "The rule id for a rule, the campaign id for a campaign, the program key for a program, the definition key for a friend quest or team quest."
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "key"
                                      ]
                                    }
                                  }
                                },
                                "required": [
                                  "key",
                                  "name",
                                  "weight_bps"
                                ]
                              }
                            },
                            "template": {
                              "description": "A starting point (GET /experiment_templates): every template is a holdout on `targets`; streak_lift needs streak programs, purchase_conversion defaults goal_event order.completed and goal_value_property amount.",
                              "type": "string",
                              "enum": [
                                "holdout",
                                "streak_lift",
                                "d7_retention",
                                "purchase_conversion"
                              ]
                            },
                            "holdout_percent": {
                              "type": "number",
                              "exclusiveMinimum": 0,
                              "exclusiveMaximum": 100
                            },
                            "targets": {
                              "maxItems": 50,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "rule",
                                      "campaign",
                                      "program",
                                      "friend_quest",
                                      "team_quest"
                                    ]
                                  },
                                  "key": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 255,
                                    "description": "The rule id for a rule, the campaign id for a campaign, the program key for a program, the definition key for a friend quest or team quest."
                                  }
                                },
                                "required": [
                                  "type",
                                  "key"
                                ]
                              }
                            },
                            "type": {
                              "type": "string",
                              "const": "experiment.create"
                            }
                          },
                          "required": [
                            "key",
                            "name",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_state": {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            },
                            "type": {
                              "type": "string",
                              "const": "experiment.delete"
                            }
                          },
                          "required": [
                            "key",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "winner_variant": {
                              "type": "string",
                              "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$"
                            },
                            "expected_state": {
                              "type": "string",
                              "pattern": "^[0-9a-f]{64}$"
                            },
                            "type": {
                              "type": "string",
                              "const": "experiment.end"
                            }
                          },
                          "required": [
                            "key",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "type": {
                              "type": "string",
                              "const": "experiment.start"
                            }
                          },
                          "required": [
                            "key",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "friend_quest_definition.activate"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "friend_quest_definition.archive"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "config": {
                              "type": "object",
                              "properties": {
                                "schema": {
                                  "type": "string",
                                  "const": "friend_quest/v1"
                                },
                                "period": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "week",
                                        "day"
                                      ]
                                    },
                                    "start_weekday": {
                                      "default": 1,
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 7
                                    },
                                    "start_minute": {
                                      "default": 0,
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 1439
                                    },
                                    "timezone": {
                                      "default": "environment",
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 64
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                "target": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 9007199254740991
                                },
                                "metric": {
                                  "default": {
                                    "source": "direct"
                                  },
                                  "type": "object",
                                  "properties": {
                                    "source": {
                                      "type": "string",
                                      "const": "direct"
                                    }
                                  },
                                  "required": [
                                    "source"
                                  ],
                                  "additionalProperties": false
                                },
                                "reward": {
                                  "minItems": 1,
                                  "maxItems": 5,
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "currency": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 64
                                          },
                                          "amount": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 1000000000000
                                          }
                                        },
                                        "required": [
                                          "currency",
                                          "amount"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "item"
                                          },
                                          "item": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                          },
                                          "quantity": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 1000
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "item",
                                          "quantity"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "pairing": {
                                  "default": "manual",
                                  "type": "string",
                                  "const": "manual"
                                }
                              },
                              "required": [
                                "schema",
                                "period",
                                "target",
                                "reward"
                              ],
                              "additionalProperties": false
                            },
                            "type": {
                              "type": "string",
                              "const": "friend_quest_definition.create"
                            }
                          },
                          "required": [
                            "key",
                            "name",
                            "config",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "friend_quest_definition.pause"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "friend_quest_definition.resume"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "config": {
                              "type": "object",
                              "properties": {
                                "schema": {
                                  "type": "string",
                                  "const": "friend_quest/v1"
                                },
                                "period": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "week",
                                        "day"
                                      ]
                                    },
                                    "start_weekday": {
                                      "default": 1,
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 7
                                    },
                                    "start_minute": {
                                      "default": 0,
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 1439
                                    },
                                    "timezone": {
                                      "default": "environment",
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 64
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                "target": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 9007199254740991
                                },
                                "metric": {
                                  "default": {
                                    "source": "direct"
                                  },
                                  "type": "object",
                                  "properties": {
                                    "source": {
                                      "type": "string",
                                      "const": "direct"
                                    }
                                  },
                                  "required": [
                                    "source"
                                  ],
                                  "additionalProperties": false
                                },
                                "reward": {
                                  "minItems": 1,
                                  "maxItems": 5,
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "currency": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 64
                                          },
                                          "amount": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 1000000000000
                                          }
                                        },
                                        "required": [
                                          "currency",
                                          "amount"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "item"
                                          },
                                          "item": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                          },
                                          "quantity": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 1000
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "item",
                                          "quantity"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "pairing": {
                                  "default": "manual",
                                  "type": "string",
                                  "const": "manual"
                                }
                              },
                              "required": [
                                "schema",
                                "period",
                                "target",
                                "reward"
                              ],
                              "additionalProperties": false
                            },
                            "type": {
                              "type": "string",
                              "const": "friend_quest_definition.update"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "friend_streak_definition.activate"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "friend_streak_definition.archive"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "config": {
                              "type": "object",
                              "properties": {
                                "schema": {
                                  "type": "string",
                                  "const": "friend_streak/v1"
                                },
                                "timezone": {
                                  "default": "environment",
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                },
                                "milestones": {
                                  "default": [],
                                  "maxItems": 10,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "length": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 100000
                                      },
                                      "reward": {
                                        "minItems": 1,
                                        "maxItems": 5,
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "currency": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 64
                                                },
                                                "amount": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 1000000000000
                                                }
                                              },
                                              "required": [
                                                "currency",
                                                "amount"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "item"
                                                },
                                                "item": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                },
                                                "quantity": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 1000
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "item",
                                                "quantity"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "length",
                                      "reward"
                                    ],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": [
                                "schema"
                              ],
                              "additionalProperties": false
                            },
                            "type": {
                              "type": "string",
                              "const": "friend_streak_definition.create"
                            }
                          },
                          "required": [
                            "key",
                            "name",
                            "config",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "friend_streak_definition.pause"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "friend_streak_definition.resume"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "config": {
                              "type": "object",
                              "properties": {
                                "schema": {
                                  "type": "string",
                                  "const": "friend_streak/v1"
                                },
                                "timezone": {
                                  "default": "environment",
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                },
                                "milestones": {
                                  "default": [],
                                  "maxItems": 10,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "length": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 100000
                                      },
                                      "reward": {
                                        "minItems": 1,
                                        "maxItems": 5,
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "currency": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 64
                                                },
                                                "amount": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 1000000000000
                                                }
                                              },
                                              "required": [
                                                "currency",
                                                "amount"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "type": {
                                                  "type": "string",
                                                  "const": "item"
                                                },
                                                "item": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                },
                                                "quantity": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 1000
                                                }
                                              },
                                              "required": [
                                                "type",
                                                "item",
                                                "quantity"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ]
                                        }
                                      }
                                    },
                                    "required": [
                                      "length",
                                      "reward"
                                    ],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": [
                                "schema"
                              ],
                              "additionalProperties": false
                            },
                            "type": {
                              "type": "string",
                              "const": "friend_streak_definition.update"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "league.activate"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "league.archive"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "config": {
                              "type": "object",
                              "properties": {
                                "schema": {
                                  "type": "string",
                                  "const": "league/v1"
                                },
                                "tiers": {
                                  "minItems": 1,
                                  "maxItems": 20,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "key": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,39}$"
                                      },
                                      "name": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 80
                                      },
                                      "promote_count": {
                                        "default": 0,
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100
                                      },
                                      "demote_count": {
                                        "default": 0,
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100
                                      },
                                      "rewards": {
                                        "default": [],
                                        "maxItems": 20,
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "rank_from": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 100
                                                },
                                                "rank_to": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 100
                                                },
                                                "currency": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 64
                                                },
                                                "amount": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 1000000000000
                                                }
                                              },
                                              "required": [
                                                "rank_from",
                                                "rank_to",
                                                "currency",
                                                "amount"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "rank_from": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 100
                                                },
                                                "rank_to": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 100
                                                },
                                                "reward": {
                                                  "minItems": 1,
                                                  "maxItems": 5,
                                                  "type": "array",
                                                  "items": {
                                                    "anyOf": [
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "currency": {
                                                            "type": "string",
                                                            "minLength": 1,
                                                            "maxLength": 64
                                                          },
                                                          "amount": {
                                                            "type": "integer",
                                                            "minimum": 1,
                                                            "maximum": 1000000000000
                                                          }
                                                        },
                                                        "required": [
                                                          "currency",
                                                          "amount"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "type": {
                                                            "type": "string",
                                                            "const": "item"
                                                          },
                                                          "item": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                          },
                                                          "quantity": {
                                                            "type": "integer",
                                                            "minimum": 1,
                                                            "maximum": 1000
                                                          }
                                                        },
                                                        "required": [
                                                          "type",
                                                          "item",
                                                          "quantity"
                                                        ],
                                                        "additionalProperties": false
                                                      }
                                                    ]
                                                  }
                                                }
                                              },
                                              "required": [
                                                "rank_from",
                                                "rank_to",
                                                "reward"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ]
                                        }
                                      },
                                      "promotion_reward": {
                                        "anyOf": [
                                          {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "currency": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 64
                                                  },
                                                  "amount": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 1000000000000
                                                  }
                                                },
                                                "required": [
                                                  "currency",
                                                  "amount"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "item"
                                                  },
                                                  "item": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                  },
                                                  "quantity": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 1000
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "item",
                                                  "quantity"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ]
                                          },
                                          {
                                            "minItems": 1,
                                            "maxItems": 5,
                                            "type": "array",
                                            "items": {
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "minLength": 1,
                                                      "maxLength": 64
                                                    },
                                                    "amount": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 1000000000000
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "item"
                                                    },
                                                    "item": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                    },
                                                    "quantity": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 1000
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "item",
                                                    "quantity"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ]
                                            }
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "key",
                                      "name"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "cohort_size": {
                                  "type": "integer",
                                  "minimum": 5,
                                  "maximum": 100
                                },
                                "period": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "week",
                                        "day"
                                      ]
                                    },
                                    "start_weekday": {
                                      "default": 1,
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 7
                                    },
                                    "start_minute": {
                                      "default": 0,
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 1439
                                    },
                                    "timezone": {
                                      "default": "environment",
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 64
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                "score": {
                                  "default": {
                                    "source": "direct"
                                  },
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "source": {
                                          "type": "string",
                                          "const": "direct"
                                        }
                                      },
                                      "required": [
                                        "source"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "source": {
                                          "type": "string",
                                          "const": "leaderboard"
                                        },
                                        "program_id": {
                                          "type": "string",
                                          "pattern": "^prg_[0-9a-z]{1,60}$"
                                        }
                                      },
                                      "required": [
                                        "source",
                                        "program_id"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ],
                                  "type": "object"
                                },
                                "matching": {
                                  "default": "none",
                                  "type": "string",
                                  "enum": [
                                    "none",
                                    "timezone"
                                  ]
                                },
                                "settle_delay_minutes": {
                                  "default": 10,
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 1440
                                },
                                "min_score_to_promote": {
                                  "default": 1,
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "schema",
                                "tiers",
                                "cohort_size",
                                "period"
                              ],
                              "additionalProperties": false
                            },
                            "type": {
                              "type": "string",
                              "const": "league.create"
                            }
                          },
                          "required": [
                            "key",
                            "name",
                            "config",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "league.pause"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "league.resume"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "config": {
                              "type": "object",
                              "properties": {
                                "schema": {
                                  "type": "string",
                                  "const": "league/v1"
                                },
                                "tiers": {
                                  "minItems": 1,
                                  "maxItems": 20,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "key": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,39}$"
                                      },
                                      "name": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 80
                                      },
                                      "promote_count": {
                                        "default": 0,
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100
                                      },
                                      "demote_count": {
                                        "default": 0,
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 100
                                      },
                                      "rewards": {
                                        "default": [],
                                        "maxItems": 20,
                                        "type": "array",
                                        "items": {
                                          "anyOf": [
                                            {
                                              "type": "object",
                                              "properties": {
                                                "rank_from": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 100
                                                },
                                                "rank_to": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 100
                                                },
                                                "currency": {
                                                  "type": "string",
                                                  "minLength": 1,
                                                  "maxLength": 64
                                                },
                                                "amount": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 1000000000000
                                                }
                                              },
                                              "required": [
                                                "rank_from",
                                                "rank_to",
                                                "currency",
                                                "amount"
                                              ],
                                              "additionalProperties": false
                                            },
                                            {
                                              "type": "object",
                                              "properties": {
                                                "rank_from": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 100
                                                },
                                                "rank_to": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 100
                                                },
                                                "reward": {
                                                  "minItems": 1,
                                                  "maxItems": 5,
                                                  "type": "array",
                                                  "items": {
                                                    "anyOf": [
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "currency": {
                                                            "type": "string",
                                                            "minLength": 1,
                                                            "maxLength": 64
                                                          },
                                                          "amount": {
                                                            "type": "integer",
                                                            "minimum": 1,
                                                            "maximum": 1000000000000
                                                          }
                                                        },
                                                        "required": [
                                                          "currency",
                                                          "amount"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "type": {
                                                            "type": "string",
                                                            "const": "item"
                                                          },
                                                          "item": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                          },
                                                          "quantity": {
                                                            "type": "integer",
                                                            "minimum": 1,
                                                            "maximum": 1000
                                                          }
                                                        },
                                                        "required": [
                                                          "type",
                                                          "item",
                                                          "quantity"
                                                        ],
                                                        "additionalProperties": false
                                                      }
                                                    ]
                                                  }
                                                }
                                              },
                                              "required": [
                                                "rank_from",
                                                "rank_to",
                                                "reward"
                                              ],
                                              "additionalProperties": false
                                            }
                                          ]
                                        }
                                      },
                                      "promotion_reward": {
                                        "anyOf": [
                                          {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "currency": {
                                                    "type": "string",
                                                    "minLength": 1,
                                                    "maxLength": 64
                                                  },
                                                  "amount": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 1000000000000
                                                  }
                                                },
                                                "required": [
                                                  "currency",
                                                  "amount"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "item"
                                                  },
                                                  "item": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                  },
                                                  "quantity": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 1000
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "item",
                                                  "quantity"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ]
                                          },
                                          {
                                            "minItems": 1,
                                            "maxItems": 5,
                                            "type": "array",
                                            "items": {
                                              "anyOf": [
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "currency": {
                                                      "type": "string",
                                                      "minLength": 1,
                                                      "maxLength": 64
                                                    },
                                                    "amount": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 1000000000000
                                                    }
                                                  },
                                                  "required": [
                                                    "currency",
                                                    "amount"
                                                  ],
                                                  "additionalProperties": false
                                                },
                                                {
                                                  "type": "object",
                                                  "properties": {
                                                    "type": {
                                                      "type": "string",
                                                      "const": "item"
                                                    },
                                                    "item": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                    },
                                                    "quantity": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 1000
                                                    }
                                                  },
                                                  "required": [
                                                    "type",
                                                    "item",
                                                    "quantity"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              ]
                                            }
                                          }
                                        ]
                                      }
                                    },
                                    "required": [
                                      "key",
                                      "name"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "cohort_size": {
                                  "type": "integer",
                                  "minimum": 5,
                                  "maximum": 100
                                },
                                "period": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "week",
                                        "day"
                                      ]
                                    },
                                    "start_weekday": {
                                      "default": 1,
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 7
                                    },
                                    "start_minute": {
                                      "default": 0,
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 1439
                                    },
                                    "timezone": {
                                      "default": "environment",
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 64
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                "score": {
                                  "default": {
                                    "source": "direct"
                                  },
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "source": {
                                          "type": "string",
                                          "const": "direct"
                                        }
                                      },
                                      "required": [
                                        "source"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "source": {
                                          "type": "string",
                                          "const": "leaderboard"
                                        },
                                        "program_id": {
                                          "type": "string",
                                          "pattern": "^prg_[0-9a-z]{1,60}$"
                                        }
                                      },
                                      "required": [
                                        "source",
                                        "program_id"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ],
                                  "type": "object"
                                },
                                "matching": {
                                  "default": "none",
                                  "type": "string",
                                  "enum": [
                                    "none",
                                    "timezone"
                                  ]
                                },
                                "settle_delay_minutes": {
                                  "default": 10,
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 1440
                                },
                                "min_score_to_promote": {
                                  "default": 1,
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 9007199254740991
                                }
                              },
                              "required": [
                                "schema",
                                "tiers",
                                "cohort_size",
                                "period"
                              ],
                              "additionalProperties": false
                            },
                            "type": {
                              "type": "string",
                              "const": "league.update"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "match_profile.archive"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_]{0,63}$"
                            },
                            "event": {
                              "type": "string",
                              "maxLength": 120,
                              "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                            },
                            "metrics": {
                              "minItems": 1,
                              "maxItems": 16,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "key": {
                                    "type": "string",
                                    "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                  },
                                  "minimum": {
                                    "type": "number",
                                    "minimum": -1000000000000000,
                                    "maximum": 1000000000000000
                                  },
                                  "maximum": {
                                    "type": "number",
                                    "minimum": -1000000000000000,
                                    "maximum": 1000000000000000
                                  },
                                  "per_minute_maximum": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 1000000000000000
                                  }
                                },
                                "required": [
                                  "key",
                                  "minimum",
                                  "maximum"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "duration": {
                              "type": "object",
                              "properties": {
                                "minimum_seconds": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 86400
                                },
                                "maximum_seconds": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 86400
                                }
                              },
                              "required": [
                                "minimum_seconds",
                                "maximum_seconds"
                              ],
                              "additionalProperties": false
                            },
                            "players": {
                              "type": "object",
                              "properties": {
                                "minimum": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 100
                                },
                                "maximum": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 100
                                }
                              },
                              "required": [
                                "minimum",
                                "maximum"
                              ],
                              "additionalProperties": false
                            },
                            "rate_limits": {
                              "maxItems": 8,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "window_seconds": {
                                    "type": "integer",
                                    "minimum": 60,
                                    "maximum": 86400
                                  },
                                  "max_matches": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 10000
                                  }
                                },
                                "required": [
                                  "window_seconds",
                                  "max_matches"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "outliers": {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "enum": [
                                    "hold",
                                    "reject"
                                  ]
                                },
                                "hold_metrics": {
                                  "default": [],
                                  "maxItems": 16,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "key": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                      },
                                      "above": {
                                        "type": "number",
                                        "minimum": -1000000000000000,
                                        "maximum": 1000000000000000
                                      }
                                    },
                                    "required": [
                                      "key",
                                      "above"
                                    ],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": [
                                "action"
                              ],
                              "additionalProperties": false
                            },
                            "type": {
                              "type": "string",
                              "const": "match_profile.create"
                            }
                          },
                          "required": [
                            "key",
                            "metrics",
                            "duration",
                            "players",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "event": {
                              "type": "string",
                              "maxLength": 120,
                              "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                            },
                            "metrics": {
                              "minItems": 1,
                              "maxItems": 16,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "key": {
                                    "type": "string",
                                    "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                  },
                                  "minimum": {
                                    "type": "number",
                                    "minimum": -1000000000000000,
                                    "maximum": 1000000000000000
                                  },
                                  "maximum": {
                                    "type": "number",
                                    "minimum": -1000000000000000,
                                    "maximum": 1000000000000000
                                  },
                                  "per_minute_maximum": {
                                    "type": "number",
                                    "minimum": 0,
                                    "maximum": 1000000000000000
                                  }
                                },
                                "required": [
                                  "key",
                                  "minimum",
                                  "maximum"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "duration": {
                              "type": "object",
                              "properties": {
                                "minimum_seconds": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 86400
                                },
                                "maximum_seconds": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 86400
                                }
                              },
                              "required": [
                                "minimum_seconds",
                                "maximum_seconds"
                              ],
                              "additionalProperties": false
                            },
                            "players": {
                              "type": "object",
                              "properties": {
                                "minimum": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 100
                                },
                                "maximum": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 100
                                }
                              },
                              "required": [
                                "minimum",
                                "maximum"
                              ],
                              "additionalProperties": false
                            },
                            "rate_limits": {
                              "maxItems": 8,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "window_seconds": {
                                    "type": "integer",
                                    "minimum": 60,
                                    "maximum": 86400
                                  },
                                  "max_matches": {
                                    "type": "integer",
                                    "minimum": 1,
                                    "maximum": 10000
                                  }
                                },
                                "required": [
                                  "window_seconds",
                                  "max_matches"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "outliers": {
                              "type": "object",
                              "properties": {
                                "action": {
                                  "type": "string",
                                  "enum": [
                                    "hold",
                                    "reject"
                                  ]
                                },
                                "hold_metrics": {
                                  "default": [],
                                  "maxItems": 16,
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "key": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                      },
                                      "above": {
                                        "type": "number",
                                        "minimum": -1000000000000000,
                                        "maximum": 1000000000000000
                                      }
                                    },
                                    "required": [
                                      "key",
                                      "above"
                                    ],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": [
                                "action"
                              ],
                              "additionalProperties": false
                            },
                            "type": {
                              "type": "string",
                              "const": "match_profile.update"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_]{0,59}$"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "event_types": {
                              "minItems": 1,
                              "maxItems": 20,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,39}\\.[a-z][a-z0-9_]{0,59}$"
                              }
                            },
                            "class": {
                              "type": "string",
                              "enum": [
                                "marketing",
                                "transactional"
                              ]
                            },
                            "routes": {
                              "maxItems": 8,
                              "type": "array",
                              "items": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "channel": {
                                        "type": "string",
                                        "enum": [
                                          "email",
                                          "web_push",
                                          "mobile_push"
                                        ]
                                      },
                                      "path": {
                                        "type": "string",
                                        "const": "builtin"
                                      }
                                    },
                                    "required": [
                                      "channel",
                                      "path"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "channel": {
                                        "type": "string",
                                        "const": "connector"
                                      },
                                      "path": {
                                        "type": "string",
                                        "const": "connector"
                                      },
                                      "connector_id": {
                                        "type": "string",
                                        "pattern": "^ncn_[0-9a-f]{32}$"
                                      },
                                      "template": {
                                        "type": "string",
                                        "pattern": "^[A-Za-z0-9_-]{1,100}$"
                                      }
                                    },
                                    "required": [
                                      "channel",
                                      "path",
                                      "connector_id"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              }
                            },
                            "conditions": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "propertyNames": {
                                    "type": "string"
                                  },
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "max_per_day": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "max_per_week": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 5000
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "respect_quiet_hours": {
                              "type": "boolean"
                            },
                            "type": {
                              "type": "string",
                              "const": "notification_message_type.create"
                            }
                          },
                          "required": [
                            "key",
                            "routes",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "notification_message_type.pause"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "notification_message_type.resume"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "event_types": {
                              "minItems": 1,
                              "maxItems": 20,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,39}\\.[a-z][a-z0-9_]{0,59}$"
                              }
                            },
                            "class": {
                              "type": "string",
                              "enum": [
                                "marketing",
                                "transactional"
                              ]
                            },
                            "routes": {
                              "maxItems": 8,
                              "type": "array",
                              "items": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "channel": {
                                        "type": "string",
                                        "enum": [
                                          "email",
                                          "web_push",
                                          "mobile_push"
                                        ]
                                      },
                                      "path": {
                                        "type": "string",
                                        "const": "builtin"
                                      }
                                    },
                                    "required": [
                                      "channel",
                                      "path"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "channel": {
                                        "type": "string",
                                        "const": "connector"
                                      },
                                      "path": {
                                        "type": "string",
                                        "const": "connector"
                                      },
                                      "connector_id": {
                                        "type": "string",
                                        "pattern": "^ncn_[0-9a-f]{32}$"
                                      },
                                      "template": {
                                        "type": "string",
                                        "pattern": "^[A-Za-z0-9_-]{1,100}$"
                                      }
                                    },
                                    "required": [
                                      "channel",
                                      "path",
                                      "connector_id"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              }
                            },
                            "conditions": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "propertyNames": {
                                    "type": "string"
                                  },
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "max_per_day": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "max_per_week": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 5000
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "respect_quiet_hours": {
                              "type": "boolean"
                            },
                            "type": {
                              "type": "string",
                              "const": "notification_message_type.update"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "quiet_hours": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "start_minute": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 1439
                                    },
                                    "end_minute": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 1439
                                    }
                                  },
                                  "required": [
                                    "start_minute",
                                    "end_minute"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "max_per_day": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "max_per_week": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 5000
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "email_consent_mode": {
                              "type": "string",
                              "enum": [
                                "opt_in",
                                "opt_out"
                              ]
                            },
                            "default_locale": {
                              "type": "string",
                              "maxLength": 35,
                              "pattern": "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$"
                            },
                            "from_name": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "reply_to": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 3,
                                  "maxLength": 320
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "brand": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string",
                                "maxLength": 60
                              },
                              "additionalProperties": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "maxLength": 2000
                                  },
                                  {
                                    "type": "number"
                                  },
                                  {
                                    "type": "boolean"
                                  }
                                ]
                              }
                            },
                            "type": {
                              "type": "string",
                              "const": "notification_settings.update"
                            }
                          },
                          "required": [
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "channel": {
                              "type": "string",
                              "enum": [
                                "email",
                                "web_push",
                                "mobile_push"
                              ]
                            },
                            "locale": {
                              "type": "string",
                              "maxLength": 35,
                              "pattern": "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$"
                            },
                            "type": {
                              "type": "string",
                              "const": "notification_template.delete"
                            }
                          },
                          "required": [
                            "key",
                            "channel",
                            "locale",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "channel": {
                              "type": "string",
                              "enum": [
                                "email",
                                "web_push",
                                "mobile_push"
                              ]
                            },
                            "locale": {
                              "type": "string",
                              "maxLength": 35,
                              "pattern": "^[a-z]{2,3}(-[A-Za-z0-9]{2,8})*$"
                            },
                            "subject": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 300
                            },
                            "title": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "body": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 20000
                            },
                            "html": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200000
                            },
                            "url": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 2000
                            },
                            "type": {
                              "type": "string",
                              "const": "notification_template.put"
                            }
                          },
                          "required": [
                            "key",
                            "channel",
                            "locale",
                            "body",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
                            },
                            "expected_revision": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 9007199254740991
                            },
                            "version_id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            "type": {
                              "type": "string",
                              "const": "portal_configuration.activate_version"
                            }
                          },
                          "required": [
                            "key",
                            "expected_revision",
                            "version_id",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "draft": {
                              "anyOf": [
                                {
                                  "$ref": "#/components/schemas/PortalDocument"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "type": {
                              "type": "string",
                              "const": "portal_configuration.create"
                            }
                          },
                          "required": [
                            "key",
                            "name",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
                            },
                            "expected_revision": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "portal_configuration.disable"
                            }
                          },
                          "required": [
                            "key",
                            "expected_revision",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
                            },
                            "expected_revision": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "portal_configuration.enable"
                            }
                          },
                          "required": [
                            "key",
                            "expected_revision",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
                            },
                            "expected_revision": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "portal_configuration.publish"
                            }
                          },
                          "required": [
                            "key",
                            "expected_revision",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
                            },
                            "expected_revision": {
                              "type": "integer",
                              "minimum": 1,
                              "maximum": 9007199254740991
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "draft": {
                              "anyOf": [
                                {
                                  "$ref": "#/components/schemas/PortalDocument"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "type": {
                              "type": "string",
                              "const": "portal_configuration.save_draft"
                            }
                          },
                          "required": [
                            "key",
                            "expected_revision",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "cost": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "currency": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "availability": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "expiry_after": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^\\d+[smhdw]$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "type": {
                              "type": "string",
                              "const": "reward.create"
                            }
                          },
                          "required": [
                            "name",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "reward.delete"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "archived"
                              ]
                            },
                            "type": {
                              "type": "string",
                              "const": "reward.set_status"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "status",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "cost": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            },
                            "currency": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "minLength": 1
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "availability": {
                              "anyOf": [
                                {
                                  "type": "integer",
                                  "exclusiveMinimum": 0,
                                  "maximum": 9007199254740991
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "expiry_after": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "pattern": "^\\d+[smhdw]$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "type": {
                              "type": "string",
                              "const": "reward.update"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "definition": {
                              "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                            },
                            "campaign_id": {
                              "type": "string"
                            },
                            "priority": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "ai_generation_id": {
                              "type": "string"
                            },
                            "publish": {
                              "type": "boolean"
                            },
                            "type": {
                              "type": "string",
                              "const": "rule.create"
                            }
                          },
                          "required": [
                            "name",
                            "definition",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "rule.pause"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "rule.publish_draft"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "rule.resume"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "to_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "rule.rollback"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "to_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "definition": {
                              "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                            },
                            "campaign_id": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "priority": {
                              "type": "integer",
                              "minimum": -9007199254740991,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "rule.save_draft"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "segment.delete"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "name": {
                              "type": "string",
                              "pattern": "^[a-z][a-z0-9_]{0,59}$"
                            },
                            "type": {
                              "type": "string",
                              "const": "segment.rename"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "name",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "team_quest_definition.activate"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "team_quest_definition.archive"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "config": {
                              "type": "object",
                              "properties": {
                                "schema": {
                                  "type": "string",
                                  "const": "team_quest/v1"
                                },
                                "period": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "week",
                                        "day"
                                      ]
                                    },
                                    "start_weekday": {
                                      "default": 1,
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 7
                                    },
                                    "start_minute": {
                                      "default": 0,
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 1439
                                    },
                                    "timezone": {
                                      "default": "environment",
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 64
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                "target": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000000000000
                                },
                                "metric": {
                                  "default": {
                                    "source": "direct"
                                  },
                                  "type": "object",
                                  "properties": {
                                    "source": {
                                      "type": "string",
                                      "const": "direct"
                                    }
                                  },
                                  "required": [
                                    "source"
                                  ],
                                  "additionalProperties": false
                                },
                                "reward": {
                                  "default": [],
                                  "maxItems": 10,
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "currency": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 64
                                          },
                                          "amount": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 1000000000000
                                          }
                                        },
                                        "required": [
                                          "currency",
                                          "amount"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "item"
                                          },
                                          "item": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                          },
                                          "quantity": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 1000
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "item",
                                          "quantity"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "min_contribution": {
                                  "default": 0,
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 1000000000000
                                }
                              },
                              "required": [
                                "schema",
                                "period",
                                "target"
                              ],
                              "additionalProperties": false
                            },
                            "type": {
                              "type": "string",
                              "const": "team_quest_definition.create"
                            }
                          },
                          "required": [
                            "key",
                            "name",
                            "config",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "team_quest_definition.pause"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "team_quest_definition.resume"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "config": {
                              "type": "object",
                              "properties": {
                                "schema": {
                                  "type": "string",
                                  "const": "team_quest/v1"
                                },
                                "period": {
                                  "type": "object",
                                  "properties": {
                                    "kind": {
                                      "type": "string",
                                      "enum": [
                                        "week",
                                        "day"
                                      ]
                                    },
                                    "start_weekday": {
                                      "default": 1,
                                      "type": "integer",
                                      "minimum": 1,
                                      "maximum": 7
                                    },
                                    "start_minute": {
                                      "default": 0,
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 1439
                                    },
                                    "timezone": {
                                      "default": "environment",
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 64
                                    }
                                  },
                                  "required": [
                                    "kind"
                                  ],
                                  "additionalProperties": false
                                },
                                "target": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1000000000000
                                },
                                "metric": {
                                  "default": {
                                    "source": "direct"
                                  },
                                  "type": "object",
                                  "properties": {
                                    "source": {
                                      "type": "string",
                                      "const": "direct"
                                    }
                                  },
                                  "required": [
                                    "source"
                                  ],
                                  "additionalProperties": false
                                },
                                "reward": {
                                  "default": [],
                                  "maxItems": 10,
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "currency": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 64
                                          },
                                          "amount": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 1000000000000
                                          }
                                        },
                                        "required": [
                                          "currency",
                                          "amount"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "item"
                                          },
                                          "item": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                          },
                                          "quantity": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 1000
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "item",
                                          "quantity"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "min_contribution": {
                                  "default": 0,
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 1000000000000
                                }
                              },
                              "required": [
                                "schema",
                                "period",
                                "target"
                              ],
                              "additionalProperties": false
                            },
                            "type": {
                              "type": "string",
                              "const": "team_quest_definition.update"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "currency": {
                              "type": "string",
                              "minLength": 1
                            },
                            "basis": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "lifetime_earned"
                                    }
                                  },
                                  "required": [
                                    "type"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "earned_rolling_days"
                                    },
                                    "days": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "days"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "balance"
                                    }
                                  },
                                  "required": [
                                    "type"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "earned_calendar_year"
                                    }
                                  },
                                  "required": [
                                    "type"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "earned_anniversary_year"
                                    }
                                  },
                                  "required": [
                                    "type"
                                  ]
                                }
                              ],
                              "type": "object"
                            },
                            "levels": {
                              "minItems": 1,
                              "maxItems": 20,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "name": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 60
                                  },
                                  "threshold": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "benefits": {
                                    "maxItems": 20,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                        },
                                        "title": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "description": {
                                          "type": "string",
                                          "maxLength": 500
                                        },
                                        "icon": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 64
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "title"
                                      ]
                                    }
                                  }
                                },
                                "required": [
                                  "name",
                                  "threshold"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "downgrade_check": {
                              "type": "string",
                              "enum": [
                                "daily",
                                "monthly",
                                "never"
                              ]
                            },
                            "retention": {
                              "type": "object",
                              "properties": {
                                "mode": {
                                  "type": "string",
                                  "enum": [
                                    "none",
                                    "through_next_period"
                                  ]
                                },
                                "grace_days": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 366
                                }
                              },
                              "required": [
                                "mode"
                              ]
                            },
                            "is_default": {
                              "type": "boolean"
                            },
                            "type": {
                              "type": "string",
                              "const": "tier_program.create"
                            }
                          },
                          "required": [
                            "name",
                            "currency",
                            "basis",
                            "levels",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "type": {
                              "type": "string",
                              "const": "tier_program.delete"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "active",
                                "paused"
                              ]
                            },
                            "type": {
                              "type": "string",
                              "const": "tier_program.set_status"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "status",
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "expected_version": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "basis": {
                              "oneOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "lifetime_earned"
                                    }
                                  },
                                  "required": [
                                    "type"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "earned_rolling_days"
                                    },
                                    "days": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "days"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "balance"
                                    }
                                  },
                                  "required": [
                                    "type"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "earned_calendar_year"
                                    }
                                  },
                                  "required": [
                                    "type"
                                  ]
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "const": "earned_anniversary_year"
                                    }
                                  },
                                  "required": [
                                    "type"
                                  ]
                                }
                              ],
                              "type": "object"
                            },
                            "levels": {
                              "minItems": 1,
                              "maxItems": 20,
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "name": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 60
                                  },
                                  "threshold": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "benefits": {
                                    "maxItems": 20,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                        },
                                        "title": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "description": {
                                          "type": "string",
                                          "maxLength": 500
                                        },
                                        "icon": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 64
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "title"
                                      ]
                                    }
                                  }
                                },
                                "required": [
                                  "name",
                                  "threshold"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "downgrade_check": {
                              "type": "string",
                              "enum": [
                                "daily",
                                "monthly",
                                "never"
                              ]
                            },
                            "retention": {
                              "type": "object",
                              "properties": {
                                "mode": {
                                  "type": "string",
                                  "enum": [
                                    "none",
                                    "through_next_period"
                                  ]
                                },
                                "grace_days": {
                                  "type": "integer",
                                  "minimum": 0,
                                  "maximum": 366
                                }
                              },
                              "required": [
                                "mode"
                              ]
                            },
                            "is_default": {
                              "type": "boolean"
                            },
                            "reassign_to": {
                              "type": "string"
                            },
                            "reevaluate": {
                              "type": "boolean"
                            },
                            "type": {
                              "type": "string",
                              "const": "tier_program.update"
                            }
                          },
                          "required": [
                            "key",
                            "expected_version",
                            "type"
                          ],
                          "additionalProperties": false
                        }
                      ],
                      "type": "object"
                    }
                  },
                  "document": {},
                  "publish": {
                    "default": true,
                    "description": "True publishes, on commit, the rules the commands or document mark published or paused, and a rule a rule.create command creates (a production environment also needs rules:publish); false leaves them as drafts (publish a draft later with rule.publish_draft, whose key is the rule id). Other operation commands (portal_configuration.*, segment.delete and the other single operations) ignore it; a portal is published by the portal_configuration.publish command.",
                    "type": "boolean"
                  },
                  "provenance": {
                    "$ref": "#/components/schemas/ChangeSetProvenance"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangeSet"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "List change sets",
        "tags": [
          "change_sets"
        ],
        "operationId": "list_change_sets",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "concurrent_update",
            "invalid_cursor"
          ],
          "resource": "change_sets",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [
                  {
                    "id": "chs_00000000000000000000000000000001",
                    "environment_id": "env_example",
                    "status": "pending",
                    "channel": "dashboard",
                    "source": "manual",
                    "principal": {
                      "kind": "session",
                      "id": "user_example"
                    },
                    "commands": [
                      {
                        "type": "program.archive",
                        "key": "welcome"
                      }
                    ],
                    "plan": {
                      "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                      "commands_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                      "snapshot_at": "2026-09-27T00:00:00.000000Z",
                      "diff": {
                        "entries": [
                          {
                            "section": "programs",
                            "key": "[\"quest\",null,\"welcome\",null]",
                            "op": "update",
                            "fields": [
                              {
                                "path": "/status",
                                "before": "active",
                                "after": "archived"
                              }
                            ]
                          }
                        ],
                        "unchanged": 12
                      },
                      "expected_versions": [
                        {
                          "resource": "configuration",
                          "key": "env_example",
                          "version": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
                        }
                      ],
                      "effects": {
                        "customers_affected": null,
                        "liability": [],
                        "stock": [],
                        "codes": [],
                        "webhooks": {
                          "event_types": []
                        },
                        "notes": []
                      },
                      "irreversibility": [],
                      "flags": [],
                      "required_scopes": [
                        "config:write"
                      ],
                      "approved_bounds": {}
                    },
                    "publish": true,
                    "expires_at": "2026-09-28T00:00:00.000000Z",
                    "stale_reason": null,
                    "committed_at": null,
                    "commit_id": null,
                    "commit": null,
                    "undo_of": null,
                    "undone_by": null,
                    "created_at": "2026-09-27T00:00:00.000000Z",
                    "updated_at": "2026-09-27T00:00:00.000000Z",
                    "version": 1
                  }
                ],
                "next_cursor": null,
                "has_more": false
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads configuration of the selected environment through its environment-scoped resolution."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "config:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "config:read"
            ]
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "committed",
                "stale",
                "expired",
                "cancelled"
              ]
            }
          },
          {
            "in": "query",
            "name": "source",
            "schema": {
              "type": "string",
              "enum": [
                "manual",
                "playbook",
                "bulk",
                "upgrade",
                "assistant"
              ]
            }
          },
          {
            "in": "query",
            "name": "authority",
            "schema": {
              "description": "Only committed change sets whose commit had this authority: policy lists what was applied without a dashboard confirmation (the agent activity log).",
              "type": "string",
              "enum": [
                "confirmation",
                "policy"
              ]
            },
            "description": "Only committed change sets whose commit had this authority: policy lists what was applied without a dashboard confirmation (the agent activity log)."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/ChangeSet"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/change_sets/{id}": {
      "get": {
        "summary": "Read a change set with its stored plan",
        "tags": [
          "change_sets"
        ],
        "operationId": "get_change_set",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "concurrent_update"
          ],
          "resource": "change_sets",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "chs_00000000000000000000000000000001",
                "environment_id": "env_example",
                "status": "pending",
                "channel": "dashboard",
                "source": "manual",
                "principal": {
                  "kind": "session",
                  "id": "user_example"
                },
                "commands": [
                  {
                    "type": "program.archive",
                    "key": "welcome"
                  }
                ],
                "plan": {
                  "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "commands_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "snapshot_at": "2026-09-27T00:00:00.000000Z",
                  "diff": {
                    "entries": [
                      {
                        "section": "programs",
                        "key": "[\"quest\",null,\"welcome\",null]",
                        "op": "update",
                        "fields": [
                          {
                            "path": "/status",
                            "before": "active",
                            "after": "archived"
                          }
                        ]
                      }
                    ],
                    "unchanged": 12
                  },
                  "expected_versions": [
                    {
                      "resource": "configuration",
                      "key": "env_example",
                      "version": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
                    }
                  ],
                  "effects": {
                    "customers_affected": null,
                    "liability": [],
                    "stock": [],
                    "codes": [],
                    "webhooks": {
                      "event_types": []
                    },
                    "notes": []
                  },
                  "irreversibility": [],
                  "flags": [],
                  "required_scopes": [
                    "config:write"
                  ],
                  "approved_bounds": {}
                },
                "publish": true,
                "expires_at": "2026-09-28T00:00:00.000000Z",
                "stale_reason": null,
                "committed_at": null,
                "commit_id": null,
                "commit": null,
                "undo_of": null,
                "undone_by": null,
                "created_at": "2026-09-27T00:00:00.000000Z",
                "updated_at": "2026-09-27T00:00:00.000000Z",
                "version": 1
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads configuration of the selected environment through its environment-scoped resolution."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "config:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "config:read"
            ]
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "include_advisories",
            "schema": {
              "description": "true: commit.policy keeps the advisories its limits evaluation recorded (never blocking: trust_weakening, client_uncapped, withholds_rewards). Left out by default. Applications and undos never carry them (their responses are stored and replayed whatever the query).",
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "description": "true: commit.policy keeps the advisories its limits evaluation recorded (never blocking: trust_weakening, client_uncapped, withholds_rewards). Left out by default. Applications and undos never carry them (their responses are stored and replayed whatever the query)."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangeSetWithConfirmation"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/change_set_commits": {
      "post": {
        "summary": "Commit a reviewed change set (signed-in dashboard confirmation only)",
        "tags": [
          "change_sets"
        ],
        "operationId": "create_change_set_commit",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "origin_mismatch",
            "csrf_invalid",
            "preview_stale",
            "acknowledgement_required",
            "change_set_not_pending",
            "change_set_expired",
            "rule_invalid",
            "invalid_state",
            "resource_in_use",
            "already_exists",
            "stale_write",
            "capability_unavailable",
            "item_archived",
            "offer_unavailable",
            "invalid_economy_request",
            "energy_archived",
            "loot_table_unavailable",
            "battle_pass_unavailable"
          ],
          "resource": "change_sets",
          "action": "create",
          "examples": {
            "request": {
              "change_set_id": "chs_00000000000000000000000000000001",
              "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "chc_00000000000000000000000000000001",
                "change_set_id": "chs_00000000000000000000000000000001",
                "status": "committed",
                "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "acknowledged_flags": [],
                "outcome": {
                  "changes": 1,
                  "published_rules": [],
                  "diff": {
                    "entries": [
                      {
                        "section": "programs",
                        "key": "[\"quest\",null,\"welcome\",null]",
                        "op": "update",
                        "fields": [
                          {
                            "path": "/status",
                            "before": "active",
                            "after": "archived"
                          }
                        ]
                      }
                    ],
                    "unchanged": 12
                  }
                },
                "change_set": {
                  "id": "chs_00000000000000000000000000000001",
                  "environment_id": "env_example",
                  "status": "committed",
                  "channel": "dashboard",
                  "source": "manual",
                  "principal": {
                    "kind": "session",
                    "id": "user_example"
                  },
                  "commands": [
                    {
                      "type": "program.archive",
                      "key": "welcome"
                    }
                  ],
                  "plan": {
                    "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                    "commands_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                    "snapshot_at": "2026-09-27T00:00:00.000000Z",
                    "diff": {
                      "entries": [
                        {
                          "section": "programs",
                          "key": "[\"quest\",null,\"welcome\",null]",
                          "op": "update",
                          "fields": [
                            {
                              "path": "/status",
                              "before": "active",
                              "after": "archived"
                            }
                          ]
                        }
                      ],
                      "unchanged": 12
                    },
                    "expected_versions": [
                      {
                        "resource": "configuration",
                        "key": "env_example",
                        "version": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
                      }
                    ],
                    "effects": {
                      "customers_affected": null,
                      "liability": [],
                      "stock": [],
                      "codes": [],
                      "webhooks": {
                        "event_types": []
                      },
                      "notes": []
                    },
                    "irreversibility": [],
                    "flags": [],
                    "required_scopes": [
                      "config:write"
                    ],
                    "approved_bounds": {}
                  },
                  "publish": true,
                  "expires_at": "2026-09-28T00:00:00.000000Z",
                  "stale_reason": null,
                  "committed_at": "2026-09-27T00:00:00.000000Z",
                  "commit_id": "chc_00000000000000000000000000000001",
                  "commit": {
                    "id": "chc_00000000000000000000000000000001",
                    "authority": "confirmation",
                    "principal": {
                      "kind": "session",
                      "id": "user_example"
                    },
                    "policy": null,
                    "committed_at": "2026-09-27T00:00:00.000000Z"
                  },
                  "undo_of": null,
                  "undone_by": null,
                  "created_at": "2026-09-27T00:00:00.000000Z",
                  "updated_at": "2026-09-27T00:00:00.000000Z",
                  "version": 2
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "chc_00000000000000000000000000000001",
                "change_set_id": "chs_00000000000000000000000000000001",
                "status": "committed",
                "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "acknowledged_flags": [],
                "outcome": {
                  "changes": 1,
                  "published_rules": [],
                  "diff": {
                    "entries": [
                      {
                        "section": "programs",
                        "key": "[\"quest\",null,\"welcome\",null]",
                        "op": "update",
                        "fields": [
                          {
                            "path": "/status",
                            "before": "active",
                            "after": "archived"
                          }
                        ]
                      }
                    ],
                    "unchanged": 12
                  }
                },
                "change_set": {
                  "id": "chs_00000000000000000000000000000001",
                  "environment_id": "env_example",
                  "status": "committed",
                  "channel": "dashboard",
                  "source": "manual",
                  "principal": {
                    "kind": "session",
                    "id": "user_example"
                  },
                  "commands": [
                    {
                      "type": "program.archive",
                      "key": "welcome"
                    }
                  ],
                  "plan": {
                    "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                    "commands_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                    "snapshot_at": "2026-09-27T00:00:00.000000Z",
                    "diff": {
                      "entries": [
                        {
                          "section": "programs",
                          "key": "[\"quest\",null,\"welcome\",null]",
                          "op": "update",
                          "fields": [
                            {
                              "path": "/status",
                              "before": "active",
                              "after": "archived"
                            }
                          ]
                        }
                      ],
                      "unchanged": 12
                    },
                    "expected_versions": [
                      {
                        "resource": "configuration",
                        "key": "env_example",
                        "version": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
                      }
                    ],
                    "effects": {
                      "customers_affected": null,
                      "liability": [],
                      "stock": [],
                      "codes": [],
                      "webhooks": {
                        "event_types": []
                      },
                      "notes": []
                    },
                    "irreversibility": [],
                    "flags": [],
                    "required_scopes": [
                      "config:write"
                    ],
                    "approved_bounds": {}
                  },
                  "publish": true,
                  "expires_at": "2026-09-28T00:00:00.000000Z",
                  "stale_reason": null,
                  "committed_at": "2026-09-27T00:00:00.000000Z",
                  "commit_id": "chc_00000000000000000000000000000001",
                  "commit": {
                    "id": "chc_00000000000000000000000000000001",
                    "authority": "confirmation",
                    "principal": {
                      "kind": "session",
                      "id": "user_example"
                    },
                    "policy": null,
                    "committed_at": "2026-09-27T00:00:00.000000Z"
                  },
                  "undo_of": null,
                  "undone_by": null,
                  "created_at": "2026-09-27T00:00:00.000000Z",
                  "updated_at": "2026-09-27T00:00:00.000000Z",
                  "version": 2
                }
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "config:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "config:write"
            ]
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "change_set_id": "chs_00000000000000000000000000000001",
                "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "change_set_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "plan_digest": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$"
                  },
                  "acknowledged_flags": {
                    "default": [],
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[0-9a-f]{64}$"
                    }
                  }
                },
                "required": [
                  "change_set_id",
                  "plan_digest"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangeSetCommit"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/change_set_applications": {
      "post": {
        "summary": "Apply a proposed change set under the environment autonomy policy, without a dashboard confirmation: always in a sandbox; in production when GET /autonomy_policy says auto, or limits and the plan is inside them. A policy refusal is confirmation_required with details.reasons and details.review_url, and the change set stays pending for a person",
        "tags": [
          "change_sets"
        ],
        "operationId": "create_change_set_application",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "confirmation_required",
            "preview_stale",
            "change_set_not_pending",
            "change_set_expired",
            "rule_invalid",
            "invalid_state",
            "resource_in_use",
            "already_exists",
            "stale_write",
            "capability_unavailable",
            "item_archived",
            "offer_unavailable",
            "invalid_economy_request",
            "energy_archived",
            "loot_table_unavailable",
            "battle_pass_unavailable"
          ],
          "resource": "change_sets",
          "action": "create",
          "examples": {
            "request": {
              "change_set_id": "chs_00000000000000000000000000000001",
              "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "chc_00000000000000000000000000000002",
                "change_set_id": "chs_00000000000000000000000000000001",
                "status": "committed",
                "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "acknowledged_flags": [],
                "outcome": {
                  "changes": 1,
                  "published_rules": [],
                  "diff": {
                    "entries": [
                      {
                        "section": "programs",
                        "key": "[\"quest\",null,\"welcome\",null]",
                        "op": "update",
                        "fields": [
                          {
                            "path": "/status",
                            "before": "active",
                            "after": "archived"
                          }
                        ]
                      }
                    ],
                    "unchanged": 12
                  }
                },
                "authority": "policy",
                "change_set": {
                  "id": "chs_00000000000000000000000000000001",
                  "environment_id": "env_example",
                  "status": "committed",
                  "channel": "api",
                  "source": "manual",
                  "principal": {
                    "kind": "secret_key",
                    "id": "key_example"
                  },
                  "commands": [
                    {
                      "type": "program.archive",
                      "key": "welcome"
                    }
                  ],
                  "plan": {
                    "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                    "commands_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                    "snapshot_at": "2026-09-27T00:00:00.000000Z",
                    "diff": {
                      "entries": [
                        {
                          "section": "programs",
                          "key": "[\"quest\",null,\"welcome\",null]",
                          "op": "update",
                          "fields": [
                            {
                              "path": "/status",
                              "before": "active",
                              "after": "archived"
                            }
                          ]
                        }
                      ],
                      "unchanged": 12
                    },
                    "expected_versions": [
                      {
                        "resource": "configuration",
                        "key": "env_example",
                        "version": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
                      }
                    ],
                    "effects": {
                      "customers_affected": null,
                      "liability": [],
                      "stock": [],
                      "codes": [],
                      "webhooks": {
                        "event_types": []
                      },
                      "notes": []
                    },
                    "irreversibility": [],
                    "flags": [],
                    "required_scopes": [
                      "config:write"
                    ],
                    "approved_bounds": {}
                  },
                  "publish": true,
                  "expires_at": "2026-09-28T00:00:00.000000Z",
                  "stale_reason": null,
                  "committed_at": "2026-09-27T00:00:00.000000Z",
                  "commit_id": "chc_00000000000000000000000000000002",
                  "commit": {
                    "id": "chc_00000000000000000000000000000002",
                    "authority": "policy",
                    "principal": {
                      "kind": "secret_key",
                      "id": "key_example"
                    },
                    "policy": {
                      "allowed": true,
                      "mode": "auto",
                      "reasons": [],
                      "limits": {
                        "max_award_per_grant": "10000",
                        "max_liability_per_currency": "1000000",
                        "max_issuances": "1000",
                        "max_customers_affected": "10000",
                        "max_stock_units": "1000",
                        "max_codes": "1000"
                      }
                    },
                    "committed_at": "2026-09-27T00:00:00.000000Z"
                  },
                  "undo_of": null,
                  "undone_by": null,
                  "created_at": "2026-09-27T00:00:00.000000Z",
                  "updated_at": "2026-09-27T00:00:00.000000Z",
                  "version": 2
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "chc_00000000000000000000000000000002",
                "change_set_id": "chs_00000000000000000000000000000001",
                "status": "committed",
                "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "acknowledged_flags": [],
                "outcome": {
                  "changes": 1,
                  "published_rules": [],
                  "diff": {
                    "entries": [
                      {
                        "section": "programs",
                        "key": "[\"quest\",null,\"welcome\",null]",
                        "op": "update",
                        "fields": [
                          {
                            "path": "/status",
                            "before": "active",
                            "after": "archived"
                          }
                        ]
                      }
                    ],
                    "unchanged": 12
                  }
                },
                "authority": "policy",
                "change_set": {
                  "id": "chs_00000000000000000000000000000001",
                  "environment_id": "env_example",
                  "status": "committed",
                  "channel": "api",
                  "source": "manual",
                  "principal": {
                    "kind": "secret_key",
                    "id": "key_example"
                  },
                  "commands": [
                    {
                      "type": "program.archive",
                      "key": "welcome"
                    }
                  ],
                  "plan": {
                    "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                    "commands_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                    "snapshot_at": "2026-09-27T00:00:00.000000Z",
                    "diff": {
                      "entries": [
                        {
                          "section": "programs",
                          "key": "[\"quest\",null,\"welcome\",null]",
                          "op": "update",
                          "fields": [
                            {
                              "path": "/status",
                              "before": "active",
                              "after": "archived"
                            }
                          ]
                        }
                      ],
                      "unchanged": 12
                    },
                    "expected_versions": [
                      {
                        "resource": "configuration",
                        "key": "env_example",
                        "version": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
                      }
                    ],
                    "effects": {
                      "customers_affected": null,
                      "liability": [],
                      "stock": [],
                      "codes": [],
                      "webhooks": {
                        "event_types": []
                      },
                      "notes": []
                    },
                    "irreversibility": [],
                    "flags": [],
                    "required_scopes": [
                      "config:write"
                    ],
                    "approved_bounds": {}
                  },
                  "publish": true,
                  "expires_at": "2026-09-28T00:00:00.000000Z",
                  "stale_reason": null,
                  "committed_at": "2026-09-27T00:00:00.000000Z",
                  "commit_id": "chc_00000000000000000000000000000002",
                  "commit": {
                    "id": "chc_00000000000000000000000000000002",
                    "authority": "policy",
                    "principal": {
                      "kind": "secret_key",
                      "id": "key_example"
                    },
                    "policy": {
                      "allowed": true,
                      "mode": "auto",
                      "reasons": [],
                      "limits": {
                        "max_award_per_grant": "10000",
                        "max_liability_per_currency": "1000000",
                        "max_issuances": "1000",
                        "max_customers_affected": "10000",
                        "max_stock_units": "1000",
                        "max_codes": "1000"
                      }
                    },
                    "committed_at": "2026-09-27T00:00:00.000000Z"
                  },
                  "undo_of": null,
                  "undone_by": null,
                  "created_at": "2026-09-27T00:00:00.000000Z",
                  "updated_at": "2026-09-27T00:00:00.000000Z",
                  "version": 2
                }
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "apply",
            "destructive": false,
            "effectFamilies": [
              "configuration"
            ],
            "assistant": {
              "offered": true,
              "reason": "Applies a pending change set of the selected environment under that environment's autonomy policy (always in a sandbox; in production only in auto, or limits with the plan inside them), as the member the assistant acts for; a policy refusal leaves it pending for a person. Never the dashboard confirmation."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "config:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "config:write"
            ]
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "change_set_id": "chs_00000000000000000000000000000001",
                "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "change_set_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "plan_digest": {
                    "type": "string",
                    "pattern": "^[0-9a-f]{64}$",
                    "description": "plan.plan_digest of the change set as proposed or last read."
                  }
                },
                "required": [
                  "change_set_id",
                  "plan_digest"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangeSetApplication"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/change_set_undos": {
      "post": {
        "summary": "Undo a committed change set: propose a change set that restores what it changed (what it created is archived or deactivated, never deleted) and apply it under the autonomy policy when the policy allows; otherwise application is null and the undo waits for a dashboard confirmation. invalid_state when it has no undo: not committed, already undone, bulk or playbook (their own undo), an operation command, an irreversible change, a deletion or creation the configuration document cannot reverse, or an item changed again since",
        "tags": [
          "change_sets"
        ],
        "operationId": "create_change_set_undo",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "invalid_state",
            "preview_stale",
            "change_set_not_pending",
            "change_set_expired",
            "rule_invalid"
          ],
          "resource": "change_sets",
          "action": "create",
          "examples": {
            "request": {
              "change_set_id": "chs_00000000000000000000000000000001"
            },
            "success": {
              "status": 201,
              "body": {
                "change_set": {
                  "id": "chs_00000000000000000000000000000003",
                  "environment_id": "env_example",
                  "status": "pending",
                  "channel": "api",
                  "source": "manual",
                  "principal": {
                    "kind": "pat",
                    "id": "user_example"
                  },
                  "commands": [
                    {
                      "type": "program.archive",
                      "key": "welcome"
                    }
                  ],
                  "plan": {
                    "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                    "commands_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                    "snapshot_at": "2026-09-27T00:00:00.000000Z",
                    "diff": {
                      "entries": [
                        {
                          "section": "programs",
                          "key": "[\"quest\",null,\"welcome\",null]",
                          "op": "update",
                          "fields": [
                            {
                              "path": "/status",
                              "before": "active",
                              "after": "archived"
                            }
                          ]
                        }
                      ],
                      "unchanged": 12
                    },
                    "expected_versions": [
                      {
                        "resource": "configuration",
                        "key": "env_example",
                        "version": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
                      }
                    ],
                    "effects": {
                      "customers_affected": null,
                      "liability": [],
                      "stock": [],
                      "codes": [],
                      "webhooks": {
                        "event_types": []
                      },
                      "notes": []
                    },
                    "irreversibility": [],
                    "flags": [],
                    "required_scopes": [
                      "config:write"
                    ],
                    "approved_bounds": {},
                    "undo_of": "chs_00000000000000000000000000000001"
                  },
                  "publish": true,
                  "expires_at": "2026-09-28T00:00:00.000000Z",
                  "stale_reason": null,
                  "committed_at": null,
                  "commit_id": null,
                  "commit": null,
                  "undo_of": "chs_00000000000000000000000000000001",
                  "undone_by": null,
                  "created_at": "2026-09-27T00:00:00.000000Z",
                  "updated_at": "2026-09-27T00:00:00.000000Z",
                  "version": 1
                },
                "application": null,
                "residuals": []
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "change_set": {
                  "id": "chs_00000000000000000000000000000003",
                  "environment_id": "env_example",
                  "status": "pending",
                  "channel": "api",
                  "source": "manual",
                  "principal": {
                    "kind": "pat",
                    "id": "user_example"
                  },
                  "commands": [
                    {
                      "type": "program.archive",
                      "key": "welcome"
                    }
                  ],
                  "plan": {
                    "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                    "commands_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                    "snapshot_at": "2026-09-27T00:00:00.000000Z",
                    "diff": {
                      "entries": [
                        {
                          "section": "programs",
                          "key": "[\"quest\",null,\"welcome\",null]",
                          "op": "update",
                          "fields": [
                            {
                              "path": "/status",
                              "before": "active",
                              "after": "archived"
                            }
                          ]
                        }
                      ],
                      "unchanged": 12
                    },
                    "expected_versions": [
                      {
                        "resource": "configuration",
                        "key": "env_example",
                        "version": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
                      }
                    ],
                    "effects": {
                      "customers_affected": null,
                      "liability": [],
                      "stock": [],
                      "codes": [],
                      "webhooks": {
                        "event_types": []
                      },
                      "notes": []
                    },
                    "irreversibility": [],
                    "flags": [],
                    "required_scopes": [
                      "config:write"
                    ],
                    "approved_bounds": {},
                    "undo_of": "chs_00000000000000000000000000000001"
                  },
                  "publish": true,
                  "expires_at": "2026-09-28T00:00:00.000000Z",
                  "stale_reason": null,
                  "committed_at": null,
                  "commit_id": null,
                  "commit": null,
                  "undo_of": "chs_00000000000000000000000000000001",
                  "undone_by": null,
                  "created_at": "2026-09-27T00:00:00.000000Z",
                  "updated_at": "2026-09-27T00:00:00.000000Z",
                  "version": 1
                },
                "application": null,
                "residuals": []
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "apply",
            "destructive": false,
            "effectFamilies": [
              "configuration"
            ],
            "assistant": {
              "offered": true,
              "reason": "Proposes the undo of a committed change set of the selected environment and applies it under that environment's autonomy policy when it allows; otherwise the undo waits for a person."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "config:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "config:write"
            ]
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "change_set_id": "chs_00000000000000000000000000000001"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "change_set_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64,
                    "description": "The committed change set to undo."
                  }
                },
                "required": [
                  "change_set_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangeSetUndo"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/change_sets/{id}/cancellations": {
      "post": {
        "summary": "Cancel a pending change set",
        "tags": [
          "change_sets"
        ],
        "operationId": "create_change_set_cancellation",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "change_set_not_pending",
            "change_set_expired"
          ],
          "resource": "change_sets",
          "action": "create",
          "examples": {
            "request": {},
            "success": {
              "status": 200,
              "body": {
                "id": "chs_00000000000000000000000000000001",
                "environment_id": "env_example",
                "status": "cancelled",
                "channel": "dashboard",
                "source": "manual",
                "principal": {
                  "kind": "session",
                  "id": "user_example"
                },
                "commands": [
                  {
                    "type": "program.archive",
                    "key": "welcome"
                  }
                ],
                "plan": {
                  "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "commands_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "snapshot_at": "2026-09-27T00:00:00.000000Z",
                  "diff": {
                    "entries": [
                      {
                        "section": "programs",
                        "key": "[\"quest\",null,\"welcome\",null]",
                        "op": "update",
                        "fields": [
                          {
                            "path": "/status",
                            "before": "active",
                            "after": "archived"
                          }
                        ]
                      }
                    ],
                    "unchanged": 12
                  },
                  "expected_versions": [
                    {
                      "resource": "configuration",
                      "key": "env_example",
                      "version": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
                    }
                  ],
                  "effects": {
                    "customers_affected": null,
                    "liability": [],
                    "stock": [],
                    "codes": [],
                    "webhooks": {
                      "event_types": []
                    },
                    "notes": []
                  },
                  "irreversibility": [],
                  "flags": [],
                  "required_scopes": [
                    "config:write"
                  ],
                  "approved_bounds": {}
                },
                "publish": true,
                "expires_at": "2026-09-28T00:00:00.000000Z",
                "stale_reason": null,
                "committed_at": null,
                "commit_id": null,
                "commit": null,
                "undo_of": null,
                "undone_by": null,
                "created_at": "2026-09-27T00:00:00.000000Z",
                "updated_at": "2026-09-27T00:00:00.000000Z",
                "version": 2
              }
            },
            "sameKeyReplay": {
              "status": 200,
              "body": {
                "id": "chs_00000000000000000000000000000001",
                "environment_id": "env_example",
                "status": "cancelled",
                "channel": "dashboard",
                "source": "manual",
                "principal": {
                  "kind": "session",
                  "id": "user_example"
                },
                "commands": [
                  {
                    "type": "program.archive",
                    "key": "welcome"
                  }
                ],
                "plan": {
                  "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "commands_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "snapshot_at": "2026-09-27T00:00:00.000000Z",
                  "diff": {
                    "entries": [
                      {
                        "section": "programs",
                        "key": "[\"quest\",null,\"welcome\",null]",
                        "op": "update",
                        "fields": [
                          {
                            "path": "/status",
                            "before": "active",
                            "after": "archived"
                          }
                        ]
                      }
                    ],
                    "unchanged": 12
                  },
                  "expected_versions": [
                    {
                      "resource": "configuration",
                      "key": "env_example",
                      "version": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
                    }
                  ],
                  "effects": {
                    "customers_affected": null,
                    "liability": [],
                    "stock": [],
                    "codes": [],
                    "webhooks": {
                      "event_types": []
                    },
                    "notes": []
                  },
                  "irreversibility": [],
                  "flags": [],
                  "required_scopes": [
                    "config:write"
                  ],
                  "approved_bounds": {}
                },
                "publish": true,
                "expires_at": "2026-09-28T00:00:00.000000Z",
                "stale_reason": null,
                "committed_at": null,
                "commit_id": null,
                "commit": null,
                "undo_of": null,
                "undone_by": null,
                "created_at": "2026-09-27T00:00:00.000000Z",
                "updated_at": "2026-09-27T00:00:00.000000Z",
                "version": 2
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "propose",
            "destructive": false,
            "effectFamilies": [
              "configuration"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "config:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "config:write"
            ]
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangeSet"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/principal": {
      "get": {
        "summary": "The calling credential and the scopes it holds in its environment now",
        "tags": [
          "account"
        ],
        "operationId": "get_principal",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found"
          ],
          "resource": "principal",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "kind": "pat",
                "id": "usr_example",
                "token_id": "pat_example",
                "staff": false,
                "organization_id": "org_example",
                "environment_id": "env_example",
                "scopes": [
                  "campaigns:read",
                  "rules:read"
                ]
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session",
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "secret_key",
                        "pat",
                        "session",
                        "staff"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "token_id": {
                      "type": "string"
                    },
                    "staff": {
                      "type": "boolean"
                    },
                    "organization_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "environment_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "scopes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "kind",
                    "id",
                    "staff",
                    "organization_id",
                    "environment_id",
                    "scopes"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/bulk_operations": {
      "post": {
        "summary": "Propose a bulk operation: freeze the selection into items, pin dependencies and store a change set for dashboard confirmation",
        "tags": [
          "bulk_operations"
        ],
        "operationId": "create_bulk_operation",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "selection_unsupported",
            "selection_too_large",
            "selection_empty",
            "reward_unavailable",
            "invalid_state"
          ],
          "resource": "bulk_operations",
          "action": "create",
          "examples": {
            "request": {
              "kind": "ledger.adjust",
              "selection": {
                "source": "customers",
                "customer_ids": [
                  "cust_a",
                  "cust_b"
                ]
              },
              "parameters": {
                "currency": "points",
                "amount": 100,
                "reason": "Goodwill credit"
              }
            },
            "success": {
              "status": 201,
              "body": {
                "id": "blk_00000000000000000000000000000001",
                "environment_id": "env_example",
                "kind": "ledger.adjust",
                "status": "proposed",
                "pause_reason": null,
                "parameters": {
                  "currency": "points",
                  "amount": 100,
                  "reason": "Goodwill credit"
                },
                "selection": {
                  "source": "customers",
                  "requested": 2,
                  "count": 2,
                  "not_found": 0
                },
                "item_count": 2,
                "items_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "undo_of": null,
                "undo_class": "compensable",
                "change_set": {
                  "id": "chs_00000000000000000000000000000001",
                  "status": "pending",
                  "plan_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "expires_at": "2026-09-29T00:00:00.000000Z"
                },
                "confirmer_user_id": null,
                "current_pass": 0,
                "generation": 0,
                "version": 1,
                "counts": {
                  "pending": 2,
                  "succeeded": 0,
                  "failed": 0,
                  "skipped": 0
                },
                "created_at": "2026-09-28T00:00:00.000000Z",
                "committed_at": null,
                "started_at": null,
                "completed_at": null,
                "errors": [],
                "passes": [],
                "resume": {
                  "resumable": false,
                  "reason": null
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "blk_00000000000000000000000000000001",
                "environment_id": "env_example",
                "kind": "ledger.adjust",
                "status": "proposed",
                "pause_reason": null,
                "parameters": {
                  "currency": "points",
                  "amount": 100,
                  "reason": "Goodwill credit"
                },
                "selection": {
                  "source": "customers",
                  "requested": 2,
                  "count": 2,
                  "not_found": 0
                },
                "item_count": 2,
                "items_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "undo_of": null,
                "undo_class": "compensable",
                "change_set": {
                  "id": "chs_00000000000000000000000000000001",
                  "status": "pending",
                  "plan_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "expires_at": "2026-09-29T00:00:00.000000Z"
                },
                "confirmer_user_id": null,
                "current_pass": 0,
                "generation": 0,
                "version": 1,
                "counts": {
                  "pending": 2,
                  "succeeded": 0,
                  "failed": 0,
                  "skipped": 0
                },
                "created_at": "2026-09-28T00:00:00.000000Z",
                "committed_at": null,
                "started_at": null,
                "completed_at": null,
                "errors": [],
                "passes": [],
                "resume": {
                  "resumable": false,
                  "reason": null
                }
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "propose",
            "destructive": false,
            "effectFamilies": [
              "bulk_operations"
            ],
            "assistant": {
              "offered": true,
              "reason": "Stores a proposal in the selected environment; commits nothing by itself. A person confirms it in the dashboard, or create_change_set_application applies it where the autonomy policy allows."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "customers:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "customers:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "ledger:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "ledger:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "segments:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "segments:write"
            ],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "kind": "ledger.adjust",
                "selection": {
                  "source": "customers",
                  "customer_ids": [
                    "cust_a",
                    "cust_b"
                  ]
                },
                "parameters": {
                  "currency": "points",
                  "amount": 100,
                  "reason": "Goodwill credit"
                }
              },
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "ledger.adjust",
                      "reward.issue",
                      "challenge.enroll",
                      "segment.membership",
                      "customer.attributes"
                    ]
                  },
                  "selection": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "source": {
                            "type": "string",
                            "const": "customers"
                          },
                          "customer_ids": {
                            "minItems": 1,
                            "maxItems": 100000,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            }
                          }
                        },
                        "required": [
                          "source",
                          "customer_ids"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "source": {
                            "type": "string",
                            "const": "segment"
                          },
                          "segment": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255
                          }
                        },
                        "required": [
                          "source",
                          "segment"
                        ],
                        "additionalProperties": false
                      }
                    ],
                    "type": "object"
                  },
                  "parameters": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {}
                  }
                },
                "required": [
                  "kind",
                  "selection",
                  "parameters"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkOperationDetail"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "List bulk operations (newest first)",
        "tags": [
          "bulk_operations"
        ],
        "operationId": "list_bulk_operations",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "bulk_operations",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [
                  {
                    "id": "blk_00000000000000000000000000000001",
                    "environment_id": "env_example",
                    "kind": "ledger.adjust",
                    "status": "proposed",
                    "pause_reason": null,
                    "parameters": {
                      "currency": "points",
                      "amount": 100,
                      "reason": "Goodwill credit"
                    },
                    "selection": {
                      "source": "customers",
                      "requested": 2,
                      "count": 2,
                      "not_found": 0
                    },
                    "item_count": 2,
                    "items_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                    "undo_of": null,
                    "undo_class": "compensable",
                    "change_set": {
                      "id": "chs_00000000000000000000000000000001",
                      "status": "pending",
                      "plan_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                      "expires_at": "2026-09-29T00:00:00.000000Z"
                    },
                    "confirmer_user_id": null,
                    "current_pass": 0,
                    "generation": 0,
                    "version": 1,
                    "counts": {
                      "pending": 2,
                      "succeeded": 0,
                      "failed": 0,
                      "skipped": 0
                    },
                    "created_at": "2026-09-28T00:00:00.000000Z",
                    "committed_at": null,
                    "started_at": null,
                    "completed_at": null
                  }
                ],
                "next_cursor": null,
                "has_more": false
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads configuration of the selected environment through its environment-scoped resolution."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "config:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "config:read"
            ],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "proposed",
                "committed",
                "running",
                "paused",
                "completed",
                "cancelled"
              ]
            }
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "type": "string",
              "enum": [
                "ledger.adjust",
                "reward.issue",
                "reward.cancel",
                "challenge.enroll",
                "challenge.unenroll",
                "segment.membership",
                "customer.attributes"
              ]
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/BulkOperation"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/bulk_operations/{id}": {
      "get": {
        "summary": "Read a bulk operation: counts by status, a sample of errors, its passes and change set",
        "tags": [
          "bulk_operations"
        ],
        "operationId": "get_bulk_operation",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found"
          ],
          "resource": "bulk_operations",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "blk_00000000000000000000000000000001",
                "environment_id": "env_example",
                "kind": "ledger.adjust",
                "status": "proposed",
                "pause_reason": null,
                "parameters": {
                  "currency": "points",
                  "amount": 100,
                  "reason": "Goodwill credit"
                },
                "selection": {
                  "source": "customers",
                  "requested": 2,
                  "count": 2,
                  "not_found": 0
                },
                "item_count": 2,
                "items_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "undo_of": null,
                "undo_class": "compensable",
                "change_set": {
                  "id": "chs_00000000000000000000000000000001",
                  "status": "pending",
                  "plan_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "expires_at": "2026-09-29T00:00:00.000000Z"
                },
                "confirmer_user_id": null,
                "current_pass": 0,
                "generation": 0,
                "version": 1,
                "counts": {
                  "pending": 2,
                  "succeeded": 0,
                  "failed": 0,
                  "skipped": 0
                },
                "created_at": "2026-09-28T00:00:00.000000Z",
                "committed_at": null,
                "started_at": null,
                "completed_at": null,
                "errors": [],
                "passes": [],
                "resume": {
                  "resumable": false,
                  "reason": null
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads configuration of the selected environment through its environment-scoped resolution."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "config:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "config:read"
            ],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkOperationDetail"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/bulk_operations/{id}/items": {
      "get": {
        "summary": "List the frozen items of a bulk operation with their status and error",
        "tags": [
          "bulk_operations"
        ],
        "operationId": "list_bulk_operation_items",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "bulk_operations",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [
                  {
                    "id": "bli_0123456789abcdef0123456789abcdef",
                    "bulk_operation_id": "blk_00000000000000000000000000000001",
                    "customer_id": "cus_example",
                    "status": "succeeded",
                    "error_code": null,
                    "skip_reason": null,
                    "pass": 1,
                    "attempts": 1,
                    "input": {
                      "amount": 100,
                      "currency": "points",
                      "reason": "goodwill"
                    },
                    "pins": {
                      "currency_id": "cur_example",
                      "currency_version": 1
                    },
                    "bound": {
                      "liability": {
                        "points": "100"
                      },
                      "customers_affected": "1"
                    },
                    "result": {
                      "changed": true
                    },
                    "updated_at": "2026-09-28T10:00:00.000000Z"
                  }
                ],
                "next_cursor": null,
                "has_more": false
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads customer data of the selected environment; identities are replaced by conversation references before the model or storage sees them."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "config:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "config:read"
            ],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "pending",
                "succeeded",
                "failed",
                "skipped"
              ]
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/BulkOperationItem"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/bulk_operation_runs": {
      "post": {
        "summary": "Start a committed bulk operation (pass 1), or resume one paused because authority was revoked",
        "tags": [
          "bulk_operations"
        ],
        "operationId": "create_bulk_operation_run",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "invalid_state",
            "operation_running"
          ],
          "resource": "bulk_operations",
          "action": "create",
          "examples": {
            "request": {
              "bulk_operation_id": "blk_00000000000000000000000000000001"
            },
            "success": {
              "status": 202,
              "body": {
                "id": "blk_00000000000000000000000000000001",
                "environment_id": "env_example",
                "kind": "ledger.adjust",
                "status": "running",
                "pause_reason": null,
                "parameters": {
                  "currency": "points",
                  "amount": 100,
                  "reason": "Goodwill credit"
                },
                "selection": {
                  "source": "customers",
                  "requested": 2,
                  "count": 2,
                  "not_found": 0
                },
                "item_count": 2,
                "items_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "undo_of": null,
                "undo_class": "compensable",
                "change_set": {
                  "id": "chs_00000000000000000000000000000001",
                  "status": "committed",
                  "plan_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "expires_at": "2026-09-29T00:00:00.000000Z"
                },
                "confirmer_user_id": "user_example",
                "current_pass": 1,
                "generation": 1,
                "version": 3,
                "counts": {
                  "pending": 2,
                  "succeeded": 0,
                  "failed": 0,
                  "skipped": 0
                },
                "created_at": "2026-09-28T00:00:00.000000Z",
                "committed_at": "2026-09-28T00:00:00.000000Z",
                "started_at": "2026-09-28T00:00:00.000000Z",
                "completed_at": null,
                "errors": [],
                "passes": [
                  {
                    "pass": 1,
                    "requested_by": "user_example",
                    "item_count": 2,
                    "created_at": "2026-09-28T00:00:00.000000Z"
                  }
                ],
                "resume": {
                  "resumable": false,
                  "reason": null
                }
              }
            },
            "sameKeyReplay": {
              "status": 202,
              "body": {
                "id": "blk_00000000000000000000000000000001",
                "environment_id": "env_example",
                "kind": "ledger.adjust",
                "status": "running",
                "pause_reason": null,
                "parameters": {
                  "currency": "points",
                  "amount": 100,
                  "reason": "Goodwill credit"
                },
                "selection": {
                  "source": "customers",
                  "requested": 2,
                  "count": 2,
                  "not_found": 0
                },
                "item_count": 2,
                "items_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "undo_of": null,
                "undo_class": "compensable",
                "change_set": {
                  "id": "chs_00000000000000000000000000000001",
                  "status": "committed",
                  "plan_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "expires_at": "2026-09-29T00:00:00.000000Z"
                },
                "confirmer_user_id": "user_example",
                "current_pass": 1,
                "generation": 1,
                "version": 3,
                "counts": {
                  "pending": 2,
                  "succeeded": 0,
                  "failed": 0,
                  "skipped": 0
                },
                "created_at": "2026-09-28T00:00:00.000000Z",
                "committed_at": "2026-09-28T00:00:00.000000Z",
                "started_at": "2026-09-28T00:00:00.000000Z",
                "completed_at": null,
                "errors": [],
                "passes": [
                  {
                    "pass": 1,
                    "requested_by": "user_example",
                    "item_count": 2,
                    "created_at": "2026-09-28T00:00:00.000000Z"
                  }
                ],
                "resume": {
                  "resumable": false,
                  "reason": null
                }
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "transition": {
            "from": [
              "committed",
              "paused"
            ],
            "to": "running"
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "bulk_operations"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "customers:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "customers:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "ledger:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "ledger:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "segments:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "segments:write"
            ],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "bulk_operation_id": "blk_00000000000000000000000000000001"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "bulk_operation_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "required": [
                  "bulk_operation_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkOperationDetail"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/bulk_operations/{id}/retries": {
      "post": {
        "summary": "Retry the failed items of a completed bulk operation in a new pass",
        "tags": [
          "bulk_operations"
        ],
        "operationId": "create_bulk_operation_retry",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "invalid_state",
            "operation_running"
          ],
          "resource": "bulk_operations",
          "action": "create",
          "examples": {
            "request": {},
            "success": {
              "status": 202,
              "body": {
                "id": "blk_00000000000000000000000000000001",
                "environment_id": "env_example",
                "kind": "ledger.adjust",
                "status": "running",
                "pause_reason": null,
                "parameters": {
                  "currency": "points",
                  "amount": 100,
                  "reason": "Goodwill credit"
                },
                "selection": {
                  "source": "customers",
                  "requested": 2,
                  "count": 2,
                  "not_found": 0
                },
                "item_count": 2,
                "items_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "undo_of": null,
                "undo_class": "compensable",
                "change_set": {
                  "id": "chs_00000000000000000000000000000001",
                  "status": "committed",
                  "plan_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "expires_at": "2026-09-29T00:00:00.000000Z"
                },
                "confirmer_user_id": "user_example",
                "current_pass": 2,
                "generation": 2,
                "version": 3,
                "counts": {
                  "pending": 2,
                  "succeeded": 0,
                  "failed": 0,
                  "skipped": 0
                },
                "created_at": "2026-09-28T00:00:00.000000Z",
                "committed_at": "2026-09-28T00:00:00.000000Z",
                "started_at": "2026-09-28T00:00:00.000000Z",
                "completed_at": null,
                "errors": [],
                "passes": [
                  {
                    "pass": 1,
                    "requested_by": "user_example",
                    "item_count": 2,
                    "created_at": "2026-09-28T00:00:00.000000Z"
                  }
                ],
                "resume": {
                  "resumable": false,
                  "reason": null
                }
              }
            },
            "sameKeyReplay": {
              "status": 202,
              "body": {
                "id": "blk_00000000000000000000000000000001",
                "environment_id": "env_example",
                "kind": "ledger.adjust",
                "status": "running",
                "pause_reason": null,
                "parameters": {
                  "currency": "points",
                  "amount": 100,
                  "reason": "Goodwill credit"
                },
                "selection": {
                  "source": "customers",
                  "requested": 2,
                  "count": 2,
                  "not_found": 0
                },
                "item_count": 2,
                "items_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "undo_of": null,
                "undo_class": "compensable",
                "change_set": {
                  "id": "chs_00000000000000000000000000000001",
                  "status": "committed",
                  "plan_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "expires_at": "2026-09-29T00:00:00.000000Z"
                },
                "confirmer_user_id": "user_example",
                "current_pass": 2,
                "generation": 2,
                "version": 3,
                "counts": {
                  "pending": 2,
                  "succeeded": 0,
                  "failed": 0,
                  "skipped": 0
                },
                "created_at": "2026-09-28T00:00:00.000000Z",
                "committed_at": "2026-09-28T00:00:00.000000Z",
                "started_at": "2026-09-28T00:00:00.000000Z",
                "completed_at": null,
                "errors": [],
                "passes": [
                  {
                    "pass": 1,
                    "requested_by": "user_example",
                    "item_count": 2,
                    "created_at": "2026-09-28T00:00:00.000000Z"
                  }
                ],
                "resume": {
                  "resumable": false,
                  "reason": null
                }
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "transition": {
            "from": [
              "completed"
            ],
            "to": "running"
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "bulk_operations"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "customers:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "customers:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "ledger:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "ledger:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "segments:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "segments:write"
            ],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {},
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkOperationDetail"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/bulk_operations/{id}/cancellations": {
      "post": {
        "summary": "Cancel a running or paused bulk operation; claimed items finish, no new item starts",
        "tags": [
          "bulk_operations"
        ],
        "operationId": "create_bulk_operation_cancellation",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "invalid_state"
          ],
          "resource": "bulk_operations",
          "action": "create",
          "examples": {
            "request": {},
            "success": {
              "status": 200,
              "body": {
                "id": "blk_00000000000000000000000000000001",
                "environment_id": "env_example",
                "kind": "ledger.adjust",
                "status": "cancelled",
                "pause_reason": null,
                "parameters": {
                  "currency": "points",
                  "amount": 100,
                  "reason": "Goodwill credit"
                },
                "selection": {
                  "source": "customers",
                  "requested": 2,
                  "count": 2,
                  "not_found": 0
                },
                "item_count": 2,
                "items_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "undo_of": null,
                "undo_class": "compensable",
                "change_set": {
                  "id": "chs_00000000000000000000000000000001",
                  "status": "committed",
                  "plan_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "expires_at": "2026-09-29T00:00:00.000000Z"
                },
                "confirmer_user_id": "user_example",
                "current_pass": 1,
                "generation": 1,
                "version": 3,
                "counts": {
                  "pending": 2,
                  "succeeded": 0,
                  "failed": 0,
                  "skipped": 0
                },
                "created_at": "2026-09-28T00:00:00.000000Z",
                "committed_at": "2026-09-28T00:00:00.000000Z",
                "started_at": "2026-09-28T00:00:00.000000Z",
                "completed_at": null,
                "errors": [],
                "passes": [
                  {
                    "pass": 1,
                    "requested_by": "user_example",
                    "item_count": 2,
                    "created_at": "2026-09-28T00:00:00.000000Z"
                  }
                ],
                "resume": {
                  "resumable": false,
                  "reason": null
                }
              }
            },
            "sameKeyReplay": {
              "status": 200,
              "body": {
                "id": "blk_00000000000000000000000000000001",
                "environment_id": "env_example",
                "kind": "ledger.adjust",
                "status": "cancelled",
                "pause_reason": null,
                "parameters": {
                  "currency": "points",
                  "amount": 100,
                  "reason": "Goodwill credit"
                },
                "selection": {
                  "source": "customers",
                  "requested": 2,
                  "count": 2,
                  "not_found": 0
                },
                "item_count": 2,
                "items_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "undo_of": null,
                "undo_class": "compensable",
                "change_set": {
                  "id": "chs_00000000000000000000000000000001",
                  "status": "committed",
                  "plan_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "expires_at": "2026-09-29T00:00:00.000000Z"
                },
                "confirmer_user_id": "user_example",
                "current_pass": 1,
                "generation": 1,
                "version": 3,
                "counts": {
                  "pending": 2,
                  "succeeded": 0,
                  "failed": 0,
                  "skipped": 0
                },
                "created_at": "2026-09-28T00:00:00.000000Z",
                "committed_at": "2026-09-28T00:00:00.000000Z",
                "started_at": "2026-09-28T00:00:00.000000Z",
                "completed_at": null,
                "errors": [],
                "passes": [
                  {
                    "pass": 1,
                    "requested_by": "user_example",
                    "item_count": 2,
                    "created_at": "2026-09-28T00:00:00.000000Z"
                  }
                ],
                "resume": {
                  "resumable": false,
                  "reason": null
                }
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "transition": {
            "from": [
              "running",
              "paused"
            ],
            "to": "cancelled"
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "bulk_operations"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "customers:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "customers:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "ledger:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "ledger:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "segments:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "segments:write"
            ],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {},
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkOperationDetail"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/bulk_operations/{id}/undo_proposals": {
      "post": {
        "summary": "Propose the undo of a bulk operation: an inverse operation of its succeeded items, classified now",
        "tags": [
          "bulk_operations"
        ],
        "operationId": "create_bulk_operation_undo_proposal",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "invalid_state",
            "operation_running",
            "selection_empty"
          ],
          "resource": "bulk_operations",
          "action": "create",
          "examples": {
            "request": {},
            "success": {
              "status": 201,
              "body": {
                "id": "blk_00000000000000000000000000000002",
                "environment_id": "env_example",
                "kind": "ledger.adjust",
                "status": "proposed",
                "pause_reason": null,
                "parameters": {
                  "undo_of": "blk_00000000000000000000000000000001",
                  "original_kind": "ledger.adjust"
                },
                "selection": {
                  "source": "undo",
                  "undo_of": "blk_00000000000000000000000000000001",
                  "succeeded": 2,
                  "count": 2
                },
                "item_count": 2,
                "items_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "undo_of": "blk_00000000000000000000000000000001",
                "undo_class": "irreversible",
                "change_set": {
                  "id": "chs_00000000000000000000000000000002",
                  "status": "pending",
                  "plan_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "expires_at": "2026-09-29T00:00:00.000000Z"
                },
                "confirmer_user_id": null,
                "current_pass": 0,
                "generation": 0,
                "version": 1,
                "counts": {
                  "pending": 2,
                  "succeeded": 0,
                  "failed": 0,
                  "skipped": 0
                },
                "created_at": "2026-09-28T00:00:00.000000Z",
                "committed_at": null,
                "started_at": null,
                "completed_at": null,
                "errors": [],
                "passes": [],
                "resume": {
                  "resumable": false,
                  "reason": null
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "blk_00000000000000000000000000000002",
                "environment_id": "env_example",
                "kind": "ledger.adjust",
                "status": "proposed",
                "pause_reason": null,
                "parameters": {
                  "undo_of": "blk_00000000000000000000000000000001",
                  "original_kind": "ledger.adjust"
                },
                "selection": {
                  "source": "undo",
                  "undo_of": "blk_00000000000000000000000000000001",
                  "succeeded": 2,
                  "count": 2
                },
                "item_count": 2,
                "items_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "undo_of": "blk_00000000000000000000000000000001",
                "undo_class": "irreversible",
                "change_set": {
                  "id": "chs_00000000000000000000000000000002",
                  "status": "pending",
                  "plan_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "expires_at": "2026-09-29T00:00:00.000000Z"
                },
                "confirmer_user_id": null,
                "current_pass": 0,
                "generation": 0,
                "version": 1,
                "counts": {
                  "pending": 2,
                  "succeeded": 0,
                  "failed": 0,
                  "skipped": 0
                },
                "created_at": "2026-09-28T00:00:00.000000Z",
                "committed_at": null,
                "started_at": null,
                "completed_at": null,
                "errors": [],
                "passes": [],
                "resume": {
                  "resumable": false,
                  "reason": null
                }
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "propose",
            "destructive": false,
            "effectFamilies": [
              "bulk_operations"
            ],
            "assistant": {
              "offered": true,
              "reason": "Stores a proposal in the selected environment; commits nothing by itself. A person confirms it in the dashboard, or create_change_set_application applies it where the autonomy policy allows."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "customers:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "customers:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "ledger:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "ledger:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "segments:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "segments:write"
            ],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {},
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BulkOperationDetail"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/playbooks": {
      "get": {
        "summary": "List the first-party playbooks with their versions and requirements",
        "tags": [
          "playbooks"
        ],
        "operationId": "list_playbooks",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found"
          ],
          "resource": "playbooks",
          "action": "list",
          "pagination": {
            "kind": "bounded",
            "maximumItems": 64,
            "reason": "The catalogue is a small fixed set of first-party manifests."
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [
                  {
                    "id": "daily_habit",
                    "version": "1.0.0",
                    "versions": [
                      "1.0.0"
                    ],
                    "title": "Daily habit",
                    "summary": "A daily streak with badges.",
                    "business_types": [
                      "consumer_app"
                    ],
                    "requires": {
                      "events": [],
                      "mechanics": [
                        "streaks"
                      ],
                      "currencies": [],
                      "webhooks": []
                    }
                  }
                ],
                "next_cursor": null,
                "has_more": false
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads configuration of the selected environment through its environment-scoped resolution."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "config:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "config:read"
            ]
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlaybookSummary"
                      }
                    },
                    "next_cursor": {
                      "type": "null"
                    },
                    "has_more": {
                      "type": "boolean",
                      "const": false
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/playbooks/{id}": {
      "get": {
        "summary": "Read one playbook manifest (the latest version, or ?version=)",
        "tags": [
          "playbooks"
        ],
        "operationId": "get_playbook",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found"
          ],
          "resource": "playbooks",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "schema": "orishare.playbook/v1",
                "id": "daily_habit",
                "version": "1.0.0",
                "versions": [
                  "1.0.0"
                ],
                "title": "Daily habit",
                "summary": "A daily streak with badges.",
                "business_types": [
                  "consumer_app"
                ],
                "requires": {
                  "events": [],
                  "mechanics": [
                    "streaks"
                  ],
                  "currencies": [],
                  "webhooks": []
                },
                "parameters": {},
                "resources": {
                  "schema": "orishare.config/v2"
                },
                "references": {},
                "display": {},
                "corrections": "Uninstall archives the program.",
                "holdout": {
                  "offered": true,
                  "default": "off"
                },
                "verification": []
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads configuration of the selected environment through its environment-scoped resolution."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "config:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "config:read"
            ]
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "version",
            "schema": {
              "type": "string",
              "maxLength": 64,
              "pattern": "^(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8})$"
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Playbook"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/playbook_previews": {
      "post": {
        "summary": "Preview a playbook install: compile it into a change set (source playbook) for dashboard confirmation, or a structured refusal",
        "tags": [
          "playbooks"
        ],
        "operationId": "create_playbook_preview",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "playbook_refused",
            "playbook_too_large",
            "rule_invalid",
            "invalid_state",
            "capability_unavailable"
          ],
          "resource": "playbook_previews",
          "action": "create",
          "examples": {
            "request": {
              "playbook_id": "daily_habit",
              "version": "1.0.0",
              "parameters": {}
            },
            "success": {
              "status": 201,
              "body": {
                "id": "chs_00000000000000000000000000000001",
                "environment_id": "env_example",
                "status": "pending",
                "channel": "api",
                "source": "playbook",
                "principal": {
                  "kind": "secret_key",
                  "id": "key_example"
                },
                "commands": [
                  {
                    "type": "playbook.apply",
                    "document": {},
                    "intent": {}
                  }
                ],
                "plan": {
                  "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "commands_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "snapshot_at": "2026-09-28T00:00:00.000000Z",
                  "diff": {
                    "entries": [],
                    "unchanged": 0
                  },
                  "expected_versions": [
                    {
                      "resource": "configuration",
                      "key": "env_example",
                      "version": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
                    }
                  ],
                  "effects": {
                    "customers_affected": null,
                    "liability": [],
                    "stock": [],
                    "codes": [],
                    "webhooks": {
                      "event_types": []
                    },
                    "notes": []
                  },
                  "irreversibility": [],
                  "flags": [],
                  "required_scopes": [
                    "config:write"
                  ],
                  "approved_bounds": {},
                  "playbook": {
                    "action": "install",
                    "installation_id": "pbi_0123456789abcdef0123456789abcdef",
                    "effects": []
                  }
                },
                "publish": true,
                "expires_at": "2026-09-29T00:00:00.000000Z",
                "stale_reason": null,
                "committed_at": null,
                "commit_id": null,
                "commit": null,
                "undo_of": null,
                "undone_by": null,
                "created_at": "2026-09-28T00:00:00.000000Z",
                "updated_at": "2026-09-28T00:00:00.000000Z",
                "version": 1
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "chs_00000000000000000000000000000001",
                "environment_id": "env_example",
                "status": "pending",
                "channel": "api",
                "source": "playbook",
                "principal": {
                  "kind": "secret_key",
                  "id": "key_example"
                },
                "commands": [
                  {
                    "type": "playbook.apply",
                    "document": {},
                    "intent": {}
                  }
                ],
                "plan": {
                  "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "commands_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "snapshot_at": "2026-09-28T00:00:00.000000Z",
                  "diff": {
                    "entries": [],
                    "unchanged": 0
                  },
                  "expected_versions": [
                    {
                      "resource": "configuration",
                      "key": "env_example",
                      "version": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
                    }
                  ],
                  "effects": {
                    "customers_affected": null,
                    "liability": [],
                    "stock": [],
                    "codes": [],
                    "webhooks": {
                      "event_types": []
                    },
                    "notes": []
                  },
                  "irreversibility": [],
                  "flags": [],
                  "required_scopes": [
                    "config:write"
                  ],
                  "approved_bounds": {},
                  "playbook": {
                    "action": "install",
                    "installation_id": "pbi_0123456789abcdef0123456789abcdef",
                    "effects": []
                  }
                },
                "publish": true,
                "expires_at": "2026-09-29T00:00:00.000000Z",
                "stale_reason": null,
                "committed_at": null,
                "commit_id": null,
                "commit": null,
                "undo_of": null,
                "undone_by": null,
                "created_at": "2026-09-28T00:00:00.000000Z",
                "updated_at": "2026-09-28T00:00:00.000000Z",
                "version": 1
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "playbook_refused",
                  "message": "playbook refused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#playbook_refused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "propose",
            "destructive": false,
            "effectFamilies": [
              "configuration"
            ],
            "assistant": {
              "offered": true,
              "reason": "Stores a proposal in the selected environment; commits nothing by itself. A person confirms it in the dashboard, or create_change_set_application applies it where the autonomy policy allows."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "config:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "config:write"
            ]
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "playbook_id": "daily_habit",
                "version": "1.0.0",
                "parameters": {}
              },
              "schema": {
                "type": "object",
                "properties": {
                  "playbook_id": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                  },
                  "version": {
                    "type": "string",
                    "maxLength": 64,
                    "pattern": "^(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8})$"
                  },
                  "parameters": {
                    "default": {},
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "maxLength": 63
                    },
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 4096
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        }
                      ]
                    }
                  },
                  "collisions": {
                    "default": {},
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 300
                    },
                    "additionalProperties": {
                      "type": "string",
                      "enum": [
                        "adopt",
                        "transfer"
                      ]
                    }
                  },
                  "prefix": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_]{0,31}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "holdout": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "enabled": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "enabled"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "playbook_id",
                  "version"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangeSet"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/playbook_installations": {
      "get": {
        "summary": "List playbook installations with the drift of every owned resource",
        "tags": [
          "playbooks"
        ],
        "operationId": "list_playbook_installations",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "playbook_installations",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [
                  {
                    "id": "pbi_0123456789abcdef0123456789abcdef",
                    "playbook_id": "daily_habit",
                    "version": "1.0.0",
                    "revision": 1,
                    "status": "active",
                    "parameters": {
                      "streak_goal": 7
                    },
                    "prefix": null,
                    "holdout": null,
                    "installed_change_set_id": "chs_00000000000000000000000000000001",
                    "last_change_set_id": "chs_00000000000000000000000000000001",
                    "created_at": "2026-09-28T00:00:00.000000Z",
                    "updated_at": "2026-09-28T00:00:00.000000Z",
                    "resources": [
                      {
                        "kind": "program",
                        "key": "daily_streak",
                        "adopted": false,
                        "applied_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "upstream_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                        "current_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                        "drift": "clean",
                        "released_at": null
                      }
                    ]
                  }
                ],
                "next_cursor": null,
                "has_more": false
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads configuration of the selected environment through its environment-scoped resolution."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "config:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "config:read"
            ]
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "uninstalled"
              ]
            }
          },
          {
            "in": "query",
            "name": "playbook_id",
            "schema": {
              "type": "string",
              "pattern": "^[a-z][a-z0-9_]{0,62}$"
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PlaybookInstallation"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/playbook_installations/{id}": {
      "get": {
        "summary": "Read a playbook installation with its owned resources and their drift",
        "tags": [
          "playbooks"
        ],
        "operationId": "get_playbook_installation",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found"
          ],
          "resource": "playbook_installations",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "pbi_0123456789abcdef0123456789abcdef",
                "playbook_id": "daily_habit",
                "version": "1.0.0",
                "revision": 1,
                "status": "active",
                "parameters": {
                  "streak_goal": 7
                },
                "prefix": null,
                "holdout": null,
                "installed_change_set_id": "chs_00000000000000000000000000000001",
                "last_change_set_id": "chs_00000000000000000000000000000001",
                "created_at": "2026-09-28T00:00:00.000000Z",
                "updated_at": "2026-09-28T00:00:00.000000Z",
                "resources": [
                  {
                    "kind": "program",
                    "key": "daily_streak",
                    "adopted": false,
                    "applied_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                    "upstream_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                    "current_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                    "drift": "clean",
                    "released_at": null
                  }
                ]
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads configuration of the selected environment through its environment-scoped resolution."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "config:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "config:read"
            ]
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookInstallation"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/playbook_upgrade_previews": {
      "post": {
        "summary": "Preview a three-way playbook upgrade: a change set (source upgrade), or the conflicts that need resolutions",
        "tags": [
          "playbooks"
        ],
        "operationId": "create_playbook_upgrade_preview",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "playbook_refused",
            "playbook_too_large",
            "rule_invalid",
            "invalid_state",
            "capability_unavailable"
          ],
          "resource": "playbook_upgrade_previews",
          "action": "create",
          "examples": {
            "request": {
              "installation_id": "pbi_0123456789abcdef0123456789abcdef",
              "version": "1.1.0",
              "resolutions": [
                {
                  "kind": "rule",
                  "key": "daily_check_in",
                  "resolution": "keep"
                }
              ]
            },
            "success": {
              "status": 201,
              "body": {
                "id": "chs_00000000000000000000000000000001",
                "environment_id": "env_example",
                "status": "pending",
                "channel": "api",
                "source": "upgrade",
                "principal": {
                  "kind": "secret_key",
                  "id": "key_example"
                },
                "commands": [
                  {
                    "type": "playbook.apply",
                    "document": {},
                    "intent": {}
                  }
                ],
                "plan": {
                  "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "commands_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "snapshot_at": "2026-09-28T00:00:00.000000Z",
                  "diff": {
                    "entries": [],
                    "unchanged": 0
                  },
                  "expected_versions": [
                    {
                      "resource": "configuration",
                      "key": "env_example",
                      "version": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
                    }
                  ],
                  "effects": {
                    "customers_affected": null,
                    "liability": [],
                    "stock": [],
                    "codes": [],
                    "webhooks": {
                      "event_types": []
                    },
                    "notes": []
                  },
                  "irreversibility": [],
                  "flags": [],
                  "required_scopes": [
                    "config:write"
                  ],
                  "approved_bounds": {},
                  "playbook": {
                    "action": "upgrade",
                    "installation_id": "pbi_0123456789abcdef0123456789abcdef",
                    "effects": []
                  }
                },
                "publish": true,
                "expires_at": "2026-09-29T00:00:00.000000Z",
                "stale_reason": null,
                "committed_at": null,
                "commit_id": null,
                "commit": null,
                "undo_of": null,
                "undone_by": null,
                "created_at": "2026-09-28T00:00:00.000000Z",
                "updated_at": "2026-09-28T00:00:00.000000Z",
                "version": 1
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "chs_00000000000000000000000000000001",
                "environment_id": "env_example",
                "status": "pending",
                "channel": "api",
                "source": "upgrade",
                "principal": {
                  "kind": "secret_key",
                  "id": "key_example"
                },
                "commands": [
                  {
                    "type": "playbook.apply",
                    "document": {},
                    "intent": {}
                  }
                ],
                "plan": {
                  "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "commands_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "snapshot_at": "2026-09-28T00:00:00.000000Z",
                  "diff": {
                    "entries": [],
                    "unchanged": 0
                  },
                  "expected_versions": [
                    {
                      "resource": "configuration",
                      "key": "env_example",
                      "version": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
                    }
                  ],
                  "effects": {
                    "customers_affected": null,
                    "liability": [],
                    "stock": [],
                    "codes": [],
                    "webhooks": {
                      "event_types": []
                    },
                    "notes": []
                  },
                  "irreversibility": [],
                  "flags": [],
                  "required_scopes": [
                    "config:write"
                  ],
                  "approved_bounds": {},
                  "playbook": {
                    "action": "upgrade",
                    "installation_id": "pbi_0123456789abcdef0123456789abcdef",
                    "effects": []
                  }
                },
                "publish": true,
                "expires_at": "2026-09-29T00:00:00.000000Z",
                "stale_reason": null,
                "committed_at": null,
                "commit_id": null,
                "commit": null,
                "undo_of": null,
                "undone_by": null,
                "created_at": "2026-09-28T00:00:00.000000Z",
                "updated_at": "2026-09-28T00:00:00.000000Z",
                "version": 1
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "playbook_refused",
                  "message": "playbook refused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#playbook_refused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "propose",
            "destructive": false,
            "effectFamilies": [
              "configuration"
            ],
            "assistant": {
              "offered": true,
              "reason": "Stores a proposal in the selected environment; commits nothing by itself. A person confirms it in the dashboard, or create_change_set_application applies it where the autonomy policy allows."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "config:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "config:write"
            ]
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "installation_id": "pbi_0123456789abcdef0123456789abcdef",
                "version": "1.1.0",
                "resolutions": [
                  {
                    "kind": "rule",
                    "key": "daily_check_in",
                    "resolution": "keep"
                  }
                ]
              },
              "schema": {
                "type": "object",
                "properties": {
                  "installation_id": {
                    "type": "string",
                    "pattern": "^pbi_[0-9a-f]{32}$"
                  },
                  "version": {
                    "type": "string",
                    "maxLength": 64,
                    "pattern": "^(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8})\\.(0|[1-9][0-9]{0,8})$"
                  },
                  "parameters": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "maxLength": 63
                    },
                    "additionalProperties": {
                      "anyOf": [
                        {
                          "type": "string",
                          "maxLength": 4096
                        },
                        {
                          "type": "number"
                        },
                        {
                          "type": "boolean"
                        }
                      ]
                    }
                  },
                  "resolutions": {
                    "default": [],
                    "maxItems": 1000,
                    "type": "array",
                    "items": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "currency",
                                "attribute_definition",
                                "segment",
                                "counter_definition",
                                "program",
                                "season",
                                "rule",
                                "catalogue",
                                "offer",
                                "inventory",
                                "code_pool"
                              ]
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "resolution": {
                              "type": "string",
                              "enum": [
                                "keep",
                                "take",
                                "keep_missing",
                                "recreate",
                                "keep_release",
                                "dispose"
                              ]
                            }
                          },
                          "required": [
                            "kind",
                            "key",
                            "resolution"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "enum": [
                                "currency",
                                "attribute_definition",
                                "segment",
                                "counter_definition",
                                "program",
                                "season",
                                "rule",
                                "catalogue",
                                "offer",
                                "inventory",
                                "code_pool"
                              ]
                            },
                            "key": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "resolution": {
                              "type": "string",
                              "const": "edit"
                            },
                            "row": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {}
                            }
                          },
                          "required": [
                            "kind",
                            "key",
                            "resolution",
                            "row"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "collisions": {
                    "default": {},
                    "type": "object",
                    "propertyNames": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 300
                    },
                    "additionalProperties": {
                      "type": "string",
                      "enum": [
                        "adopt",
                        "transfer"
                      ]
                    }
                  }
                },
                "required": [
                  "installation_id",
                  "version"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangeSet"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/playbook_uninstall_previews": {
      "post": {
        "summary": "Preview a playbook uninstall: archive, revoke, disable or stop what it owns and release ownership; balances and history stay",
        "tags": [
          "playbooks"
        ],
        "operationId": "create_playbook_uninstall_preview",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "playbook_refused",
            "playbook_too_large",
            "rule_invalid",
            "invalid_state",
            "capability_unavailable"
          ],
          "resource": "playbook_uninstall_previews",
          "action": "create",
          "examples": {
            "request": {
              "installation_id": "pbi_0123456789abcdef0123456789abcdef"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "chs_00000000000000000000000000000001",
                "environment_id": "env_example",
                "status": "pending",
                "channel": "api",
                "source": "playbook",
                "principal": {
                  "kind": "secret_key",
                  "id": "key_example"
                },
                "commands": [
                  {
                    "type": "playbook.apply",
                    "document": {},
                    "intent": {}
                  }
                ],
                "plan": {
                  "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "commands_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "snapshot_at": "2026-09-28T00:00:00.000000Z",
                  "diff": {
                    "entries": [],
                    "unchanged": 0
                  },
                  "expected_versions": [
                    {
                      "resource": "configuration",
                      "key": "env_example",
                      "version": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
                    }
                  ],
                  "effects": {
                    "customers_affected": null,
                    "liability": [],
                    "stock": [],
                    "codes": [],
                    "webhooks": {
                      "event_types": []
                    },
                    "notes": []
                  },
                  "irreversibility": [],
                  "flags": [],
                  "required_scopes": [
                    "config:write"
                  ],
                  "approved_bounds": {},
                  "playbook": {
                    "action": "uninstall",
                    "installation_id": "pbi_0123456789abcdef0123456789abcdef",
                    "effects": []
                  }
                },
                "publish": true,
                "expires_at": "2026-09-29T00:00:00.000000Z",
                "stale_reason": null,
                "committed_at": null,
                "commit_id": null,
                "commit": null,
                "undo_of": null,
                "undone_by": null,
                "created_at": "2026-09-28T00:00:00.000000Z",
                "updated_at": "2026-09-28T00:00:00.000000Z",
                "version": 1
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "chs_00000000000000000000000000000001",
                "environment_id": "env_example",
                "status": "pending",
                "channel": "api",
                "source": "playbook",
                "principal": {
                  "kind": "secret_key",
                  "id": "key_example"
                },
                "commands": [
                  {
                    "type": "playbook.apply",
                    "document": {},
                    "intent": {}
                  }
                ],
                "plan": {
                  "plan_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "commands_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
                  "snapshot_at": "2026-09-28T00:00:00.000000Z",
                  "diff": {
                    "entries": [],
                    "unchanged": 0
                  },
                  "expected_versions": [
                    {
                      "resource": "configuration",
                      "key": "env_example",
                      "version": "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"
                    }
                  ],
                  "effects": {
                    "customers_affected": null,
                    "liability": [],
                    "stock": [],
                    "codes": [],
                    "webhooks": {
                      "event_types": []
                    },
                    "notes": []
                  },
                  "irreversibility": [],
                  "flags": [],
                  "required_scopes": [
                    "config:write"
                  ],
                  "approved_bounds": {},
                  "playbook": {
                    "action": "uninstall",
                    "installation_id": "pbi_0123456789abcdef0123456789abcdef",
                    "effects": []
                  }
                },
                "publish": true,
                "expires_at": "2026-09-29T00:00:00.000000Z",
                "stale_reason": null,
                "committed_at": null,
                "commit_id": null,
                "commit": null,
                "undo_of": null,
                "undone_by": null,
                "created_at": "2026-09-28T00:00:00.000000Z",
                "updated_at": "2026-09-28T00:00:00.000000Z",
                "version": 1
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "playbook_refused",
                  "message": "playbook refused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#playbook_refused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "propose",
            "destructive": false,
            "effectFamilies": [
              "configuration"
            ],
            "assistant": {
              "offered": true,
              "reason": "Stores a proposal in the selected environment; commits nothing by itself. A person confirms it in the dashboard, or create_change_set_application applies it where the autonomy policy allows."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "config:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "config:write"
            ]
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "installation_id": "pbi_0123456789abcdef0123456789abcdef"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "installation_id": {
                    "type": "string",
                    "pattern": "^pbi_[0-9a-f]{32}$"
                  }
                },
                "required": [
                  "installation_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChangeSet"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/trust_policy": {
      "get": {
        "summary": "Read the environment trust policy",
        "tags": [
          "management"
        ],
        "operationId": "getTrustPolicy",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found"
          ],
          "resource": "trust_policy",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "version": 1,
                "configured": false,
                "policy": {}
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads the selected environment's trust policy."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "environments:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "environments:read"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "configured": {
                      "type": "boolean"
                    },
                    "policy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "monetary_currencies": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9_-]+$"
                              }
                            },
                            "caps": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "trust": {
                                    "type": "string",
                                    "enum": [
                                      "anonymous_claim",
                                      "customer_claim",
                                      "merchant_asserted",
                                      "verified_evidence",
                                      "legacy_unknown"
                                    ]
                                  },
                                  "currency": {
                                    "type": "string",
                                    "pattern": "^[A-Za-z0-9_-]+$"
                                  },
                                  "scope": {
                                    "type": "string",
                                    "enum": [
                                      "customer",
                                      "environment"
                                    ]
                                  },
                                  "window": {
                                    "type": "string",
                                    "enum": [
                                      "day",
                                      "month",
                                      "lifetime"
                                    ]
                                  },
                                  "maximum_minor": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "trust",
                                  "currency",
                                  "scope",
                                  "window",
                                  "maximum_minor"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "monetary_currencies",
                            "caps"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": [
                    "version",
                    "configured",
                    "policy"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Requires If-Match against the environment revision. The policy and audit commit together. Repeating the same Idempotency-Key and body returns the committed response; a new key with an old revision returns stale_write. Existing cap consumption is retained.",
        "tags": [
          "management"
        ],
        "operationId": "updateTrustPolicy",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "required",
            "responseEtag": true
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "resource_not_found",
            "concurrent_update"
          ],
          "resource": "trust_policy",
          "action": "update",
          "examples": {
            "request": {
              "monetary_currencies": [
                "points"
              ],
              "caps": []
            },
            "success": {
              "status": 200,
              "body": {
                "version": 2,
                "configured": true,
                "policy": {
                  "monetary_currencies": [
                    "points"
                  ],
                  "caps": []
                }
              }
            },
            "sameKeyReplay": {
              "status": 200,
              "body": {
                "version": 2,
                "configured": true,
                "policy": {
                  "monetary_currencies": [
                    "points"
                  ],
                  "caps": []
                }
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "trust_policy"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "environments:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "environments:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Required revision, checked in the owning transaction."
            },
            "required": true,
            "description": "Required revision, checked in the owning transaction."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "monetary_currencies": [
                  "points"
                ],
                "caps": []
              },
              "schema": {
                "type": "object",
                "properties": {
                  "monetary_currencies": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9_-]+$"
                    }
                  },
                  "caps": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "trust": {
                          "type": "string",
                          "enum": [
                            "anonymous_claim",
                            "customer_claim",
                            "merchant_asserted",
                            "verified_evidence",
                            "legacy_unknown"
                          ]
                        },
                        "currency": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9_-]+$"
                        },
                        "scope": {
                          "type": "string",
                          "enum": [
                            "customer",
                            "environment"
                          ]
                        },
                        "window": {
                          "type": "string",
                          "enum": [
                            "day",
                            "month",
                            "lifetime"
                          ]
                        },
                        "maximum_minor": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        }
                      },
                      "required": [
                        "trust",
                        "currency",
                        "scope",
                        "window",
                        "maximum_minor"
                      ],
                      "additionalProperties": false
                    }
                  }
                },
                "required": [
                  "monetary_currencies",
                  "caps"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "configured": {
                      "type": "boolean"
                    },
                    "policy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "monetary_currencies": {
                              "type": "array",
                              "items": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9_-]+$"
                              }
                            },
                            "caps": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "trust": {
                                    "type": "string",
                                    "enum": [
                                      "anonymous_claim",
                                      "customer_claim",
                                      "merchant_asserted",
                                      "verified_evidence",
                                      "legacy_unknown"
                                    ]
                                  },
                                  "currency": {
                                    "type": "string",
                                    "pattern": "^[A-Za-z0-9_-]+$"
                                  },
                                  "scope": {
                                    "type": "string",
                                    "enum": [
                                      "customer",
                                      "environment"
                                    ]
                                  },
                                  "window": {
                                    "type": "string",
                                    "enum": [
                                      "day",
                                      "month",
                                      "lifetime"
                                    ]
                                  },
                                  "maximum_minor": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "trust",
                                  "currency",
                                  "scope",
                                  "window",
                                  "maximum_minor"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "monetary_currencies",
                            "caps"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {},
                          "additionalProperties": false
                        }
                      ]
                    }
                  },
                  "required": [
                    "version",
                    "configured",
                    "policy"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/organizations/{id}": {
      "get": {
        "summary": "One organization",
        "tags": [
          "management"
        ],
        "operationId": "get_organizations_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "resource_not_found"
          ],
          "resource": "organizations",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "org_example",
                "name": "Example",
                "slug": "example",
                "plan": {
                  "id": "developer",
                  "version": 1
                },
                "billing_mode": "none",
                "ai_drafting_disabled": false,
                "version": 1,
                "created_at": "2026-09-20T10:00:00.000000Z",
                "updated_at": "2026-09-20T10:00:00.000000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "organizations:read"
            ],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "plan": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "version": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "id",
                        "version"
                      ],
                      "additionalProperties": false
                    },
                    "billing_mode": {
                      "type": "string",
                      "enum": [
                        "card",
                        "invoice",
                        "none"
                      ]
                    },
                    "ai_drafting_disabled": {
                      "type": "boolean"
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "slug",
                    "plan",
                    "billing_mode",
                    "ai_drafting_disabled",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Rename an organization or flip the AI drafting kill switch (If-Match for safe edits)",
        "tags": [
          "management"
        ],
        "operationId": "patch_organizations_id",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "optional",
            "responseEtag": true
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "confirmation_required",
            "stale_write",
            "resource_not_found"
          ],
          "resource": "organizations",
          "action": "update",
          "examples": {
            "request": {
              "name": "Example"
            },
            "success": {
              "status": 200,
              "body": {
                "id": "org_example",
                "name": "Example",
                "slug": "example",
                "plan": {
                  "id": "developer",
                  "version": 1
                },
                "billing_mode": "none",
                "ai_drafting_disabled": false,
                "version": 1,
                "created_at": "2026-09-20T10:00:00.000000Z",
                "updated_at": "2026-09-20T10:00:00.000000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "organizations"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "organizations:read",
              "organizations:write"
            ],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Optional legacy revision. Missing or malformed values follow the existing route parser."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "Example"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "ai_drafting_disabled": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "plan": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "version": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "id",
                        "version"
                      ],
                      "additionalProperties": false
                    },
                    "billing_mode": {
                      "type": "string",
                      "enum": [
                        "card",
                        "invoice",
                        "none"
                      ]
                    },
                    "ai_drafting_disabled": {
                      "type": "boolean"
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "slug",
                    "plan",
                    "billing_mode",
                    "ai_drafting_disabled",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/projects": {
      "get": {
        "summary": "Projects of an organization",
        "tags": [
          "management"
        ],
        "operationId": "get_projects",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "projects",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "projects:read"
            ],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "organization_id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "organization_id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "version": {
                            "type": "number"
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "id",
                          "organization_id",
                          "name",
                          "slug",
                          "version",
                          "created_at",
                          "updated_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a project with a test environment and a production environment",
        "tags": [
          "management"
        ],
        "operationId": "post_projects",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "resource_not_found",
            "quota_exceeded"
          ],
          "resource": "projects",
          "action": "create",
          "examples": {
            "request": {
              "organization_id": "org_example",
              "name": "Example",
              "timezone": "UTC"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "proj_example",
                "organization_id": "org_example",
                "name": "Example",
                "slug": "example",
                "version": 1,
                "created_at": "2026-09-20T10:00:00.000000Z",
                "updated_at": "2026-09-20T10:00:00.000000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "projects"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "projects:write"
            ],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "organization_id": "org_example",
                "name": "Example",
                "timezone": "UTC"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "organization_id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "timezone": {
                    "default": "UTC",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "required": [
                  "organization_id",
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "organization_id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "organization_id",
                    "name",
                    "slug",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/projects/{id}": {
      "get": {
        "summary": "One project",
        "tags": [
          "management"
        ],
        "operationId": "get_projects_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "resource_not_found"
          ],
          "resource": "projects",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "proj_example",
                "organization_id": "org_example",
                "name": "Example",
                "slug": "example",
                "version": 1,
                "created_at": "2026-09-20T10:00:00.000000Z",
                "updated_at": "2026-09-20T10:00:00.000000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "projects:read"
            ],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "organization_id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "organization_id",
                    "name",
                    "slug",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Rename a project",
        "tags": [
          "management"
        ],
        "operationId": "patch_projects_id",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "optional",
            "responseEtag": true
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "confirmation_required",
            "stale_write",
            "resource_not_found"
          ],
          "resource": "projects",
          "action": "update",
          "examples": {
            "request": {
              "name": "Example"
            },
            "success": {
              "status": 200,
              "body": {
                "id": "proj_example",
                "organization_id": "org_example",
                "name": "Example",
                "slug": "example",
                "version": 1,
                "created_at": "2026-09-20T10:00:00.000000Z",
                "updated_at": "2026-09-20T10:00:00.000000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "projects"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "projects:read",
              "projects:write"
            ],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Optional legacy revision. Missing or malformed values follow the existing route parser."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "Example"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "ai_drafting_disabled": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "organization_id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "organization_id",
                    "name",
                    "slug",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/projects/{id}/environments": {
      "get": {
        "summary": "Environments of a project",
        "tags": [
          "management"
        ],
        "operationId": "get_projects_id_environments",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "environments",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "projects:read"
            ],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "project_id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "test",
                              "live"
                            ],
                            "description": "test: free, simulated delivery, capped test players; live: a production environment, billable, real delivery"
                          },
                          "test_mode": {
                            "type": "boolean"
                          },
                          "runtime_class": {
                            "type": "string",
                            "enum": [
                              "sandbox",
                              "production"
                            ]
                          },
                          "timezone": {
                            "type": "string"
                          },
                          "rules_paused": {
                            "type": "boolean"
                          },
                          "version": {
                            "type": "number"
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "id",
                          "project_id",
                          "name",
                          "kind",
                          "test_mode",
                          "runtime_class",
                          "timezone",
                          "rules_paused",
                          "version",
                          "created_at",
                          "updated_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Add a test or production environment to a project",
        "tags": [
          "management"
        ],
        "operationId": "createEnvironment",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "resource_not_found",
            "already_exists",
            "live_requires_claim"
          ],
          "resource": "environments",
          "action": "create",
          "examples": {
            "request": {
              "name": "staging",
              "kind": "live"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "env_example",
                "project_id": "proj_example",
                "name": "test",
                "kind": "test",
                "test_mode": true,
                "runtime_class": "sandbox",
                "timezone": "UTC",
                "rules_paused": false,
                "version": 1,
                "created_at": "2026-09-20T10:00:00.000000Z",
                "updated_at": "2026-09-20T10:00:00.000000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "environments"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "environments:write"
            ],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "staging",
                "kind": "live"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "test",
                      "live"
                    ]
                  },
                  "timezone": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "required": [
                  "name",
                  "kind"
                ],
                "description": "The kind is chosen here and never changes: `test` (free; outbound notifications and commerce fulfilment are simulated, webhooks carry `test_mode: true`, at most the plan's test players until a reset) or `live`, a production environment (billable against the organization's monthly allowance, real delivery). Names are free-form (\"staging\", \"playtest\") and renaming never changes the kind or billing. Every production environment of the organization shares one allowance."
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "project_id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "test",
                        "live"
                      ],
                      "description": "test: free, simulated delivery, capped test players; live: a production environment, billable, real delivery"
                    },
                    "test_mode": {
                      "type": "boolean"
                    },
                    "runtime_class": {
                      "type": "string",
                      "enum": [
                        "sandbox",
                        "production"
                      ]
                    },
                    "timezone": {
                      "type": "string"
                    },
                    "rules_paused": {
                      "type": "boolean"
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "project_id",
                    "name",
                    "kind",
                    "test_mode",
                    "runtime_class",
                    "timezone",
                    "rules_paused",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/environments/{id}/test_players": {
      "get": {
        "summary": "Test players used and the limit of a test environment",
        "tags": [
          "management"
        ],
        "operationId": "getTestPlayers",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "resource_not_found",
            "invalid_state"
          ],
          "resource": "environments",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "environment_id": "env_example",
                "test_mode": true,
                "players_created": 3,
                "player_limit": 25,
                "resetting": false,
                "resets": 0,
                "reset_at": null
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "environments:read"
            ],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TestEnvironmentState"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/environments/{id}/reset": {
      "post": {
        "summary": "Reset a test environment: delete every test player and their runtime state, keep the configuration",
        "tags": [
          "management"
        ],
        "operationId": "resetTestEnvironment",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "keyed_resume",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "resource_not_found",
            "invalid_state",
            "test_environment_resetting"
          ],
          "resource": "environments",
          "action": "delete",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "environment_id": "env_example",
                "test_mode": true,
                "players_created": 0,
                "player_limit": 25,
                "resetting": false,
                "resets": 1,
                "reset_at": "2026-09-20T10:00:00.000000Z",
                "players_deleted": 25
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": true,
            "effectFamilies": [
              "environments"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "environments:write"
            ],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TestEnvironmentReset"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/environments/{id}": {
      "get": {
        "summary": "One environment",
        "tags": [
          "management"
        ],
        "operationId": "get_environments_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "resource_not_found"
          ],
          "resource": "environments",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "env_example",
                "project_id": "proj_example",
                "name": "test",
                "kind": "test",
                "test_mode": true,
                "runtime_class": "sandbox",
                "timezone": "UTC",
                "rules_paused": false,
                "version": 1,
                "created_at": "2026-09-20T10:00:00.000000Z",
                "updated_at": "2026-09-20T10:00:00.000000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [],
            "environment": "none"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "environments:read"
            ],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "project_id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "test",
                        "live"
                      ],
                      "description": "test: free, simulated delivery, capped test players; live: a production environment, billable, real delivery"
                    },
                    "test_mode": {
                      "type": "boolean"
                    },
                    "runtime_class": {
                      "type": "string",
                      "enum": [
                        "sandbox",
                        "production"
                      ]
                    },
                    "timezone": {
                      "type": "string"
                    },
                    "rules_paused": {
                      "type": "boolean"
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "project_id",
                    "name",
                    "kind",
                    "test_mode",
                    "runtime_class",
                    "timezone",
                    "rules_paused",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Update name, timezone, or the rules kill switch (the kind never changes)",
        "tags": [
          "management"
        ],
        "operationId": "patch_environments_id",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "optional",
            "responseEtag": true
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "confirmation_required",
            "stale_write",
            "resource_not_found",
            "already_exists"
          ],
          "resource": "environments",
          "action": "update",
          "examples": {
            "request": {
              "name": "staging"
            },
            "success": {
              "status": 200,
              "body": {
                "id": "env_example",
                "project_id": "proj_example",
                "name": "test",
                "kind": "test",
                "test_mode": true,
                "runtime_class": "sandbox",
                "timezone": "UTC",
                "rules_paused": false,
                "version": 1,
                "created_at": "2026-09-20T10:00:00.000000Z",
                "updated_at": "2026-09-20T10:00:00.000000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "environments"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "environments:read",
              "environments:write"
            ],
            "environment": "none"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "none"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Optional legacy revision. Missing or malformed values follow the existing route parser."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "staging"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "timezone": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "rules_paused": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "project_id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "test",
                        "live"
                      ],
                      "description": "test: free, simulated delivery, capped test players; live: a production environment, billable, real delivery"
                    },
                    "test_mode": {
                      "type": "boolean"
                    },
                    "runtime_class": {
                      "type": "string",
                      "enum": [
                        "sandbox",
                        "production"
                      ]
                    },
                    "timezone": {
                      "type": "string"
                    },
                    "rules_paused": {
                      "type": "boolean"
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "project_id",
                    "name",
                    "kind",
                    "test_mode",
                    "runtime_class",
                    "timezone",
                    "rules_paused",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/environments/{id}/api_keys": {
      "post": {
        "summary": "Create a secret or publishable key; the token is returned once",
        "tags": [
          "management"
        ],
        "operationId": "post_environments_id_api_keys",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found"
          ],
          "resource": "api_keys",
          "action": "create",
          "examples": {
            "request": {
              "kind": "secret",
              "name": "Server"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "key_example",
                "environment_id": "env_example",
                "kind": "secret",
                "name": "Server",
                "prefix": "osk_test_example",
                "scopes": [
                  "events:write"
                ],
                "last_used_at": null,
                "revoked_at": null,
                "created_at": "2026-09-20T10:00:00.000000Z",
                "token": "osk_test_example_secret",
                "organization_id": "org_example"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": [
              "api_keys"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "environments:read",
              "environments:write"
            ],
            "environment": "resource_bound"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "resource_bound"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "kind": "secret",
                "name": "Server"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "secret",
                      "publishable"
                    ]
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "scopes": {
                    "maxItems": 50,
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "required": [
                  "kind",
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "environment_id": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "secret",
                        "publishable"
                      ]
                    },
                    "name": {
                      "type": "string"
                    },
                    "prefix": {
                      "type": "string"
                    },
                    "scopes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "last_used_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "revoked_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "token": {
                      "type": "string"
                    },
                    "organization_id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "environment_id",
                    "kind",
                    "name",
                    "prefix",
                    "scopes",
                    "last_used_at",
                    "revoked_at",
                    "created_at",
                    "token",
                    "organization_id"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "List keys (hashes never returned)",
        "tags": [
          "management"
        ],
        "operationId": "get_environments_id_api_keys",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "api_keys",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "environments:read"
            ],
            "environment": "resource_bound"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "resource_bound"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "environment_id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "secret",
                              "publishable"
                            ]
                          },
                          "name": {
                            "type": "string"
                          },
                          "prefix": {
                            "type": "string"
                          },
                          "scopes": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          },
                          "last_used_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "revoked_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "id",
                          "environment_id",
                          "kind",
                          "name",
                          "prefix",
                          "scopes",
                          "last_used_at",
                          "revoked_at",
                          "created_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api_keys/{id}": {
      "delete": {
        "summary": "Revoke a key",
        "tags": [
          "management"
        ],
        "operationId": "delete_api_keys_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found"
          ],
          "resource": "api_keys",
          "action": "delete",
          "examples": {
            "success": {
              "status": 204
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": true,
            "effectFamilies": [
              "api_keys"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "environments:read",
              "environments:write"
            ],
            "environment": "resource_bound"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "resource_bound"
          }
        ],
        "security": [
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/environments/{id}/usage": {
      "get": {
        "summary": "Metered usage per calendar month",
        "tags": [
          "management"
        ],
        "operationId": "get_environments_id_usage",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "usage",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "forbidden",
                  "message": "forbidden",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#forbidden",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "environments:read",
              "usage:read"
            ],
            "environment": "resource_bound"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "resource_bound"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "period",
            "schema": {
              "type": "string",
              "pattern": "^\\d{4}-\\d{2}$"
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "environment_id": {
                            "type": "string"
                          },
                          "period": {
                            "type": "string"
                          },
                          "accepted_events": {
                            "type": "number"
                          },
                          "active_customers": {
                            "type": "number"
                          },
                          "webhook_deliveries": {
                            "type": "number"
                          },
                          "ai_drafts": {
                            "type": "number"
                          },
                          "sync_evaluations": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "environment_id",
                          "period",
                          "accepted_events",
                          "active_customers",
                          "webhook_deliveries",
                          "ai_drafts",
                          "sync_evaluations"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/events": {
      "post": {
        "summary": "Send one event or a batch; async by default, `mode: sync` evaluates inline (secret keys)",
        "tags": [
          "events"
        ],
        "operationId": "post_events",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "confirmation_required",
            "usage_allowance_exhausted",
            "free_allowance_exhausted",
            "live_requires_claim",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "customer_credential_retired",
            "customer_admission_unavailable",
            "idempotency_key_required",
            "idempotency_key_reused",
            "batch_too_large",
            "event_too_large",
            "event_requires_secret_key",
            "anonymous_id_retired",
            "event_id_conflict",
            "occurred_at_in_future",
            "quota_exceeded",
            "invalid_state",
            "trust_insufficient",
            "source_time_untrusted",
            "concurrent_update"
          ],
          "resource": "event",
          "action": "create",
          "examples": {
            "request": {
              "id": "order_42",
              "name": "order.paid",
              "customer_id": "reader_42",
              "properties": {},
              "mode": "async"
            },
            "success": {
              "status": 202,
              "body": {
                "id": "evt_00000000000000000000000000000042",
                "customer_id": "cust_00000000000000000000000000000042",
                "status": "accepted",
                "late": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 200,
              "body": {
                "id": "evt_00000000000000000000000000000042",
                "customer_id": "cust_00000000000000000000000000000042",
                "status": "duplicate",
                "late": false
              }
            },
            "differentBody": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "event_id_conflict",
                  "message": "event id conflict",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#event_id_conflict",
                  "request_id": "req_example"
                }
              }
            },
            "pending": {
              "status": 202,
              "body": {
                "id": "evt_00000000000000000000000000000042",
                "customer_id": "cust_00000000000000000000000000000042",
                "status": "accepted",
                "late": false
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "event",
              "evaluation"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "events:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "customer_session"
            ],
            "scopes": [
              "events:write_client"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "publishable_key"
            ],
            "scopes": [
              "events:write_client"
            ],
            "environment": "credential_bound"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "publishableKey": [],
            "customerToken": []
          },
          {
            "publishableKey": []
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "id": "order_42",
                "name": "order.paid",
                "customer_id": "reader_42",
                "properties": {},
                "mode": "async"
              },
              "schema": {
                "anyOf": [
                  {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 255
                          },
                          "name": {
                            "type": "string",
                            "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                          },
                          "properties": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "$ref": "#/components/schemas/__schema4"
                            }
                          },
                          "occurred_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "events": {
                            "minItems": 1,
                            "maxItems": 25,
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 255
                                },
                                "name": {
                                  "type": "string",
                                  "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                },
                                "properties": {
                                  "type": "object",
                                  "propertyNames": {
                                    "type": "string"
                                  },
                                  "additionalProperties": {
                                    "$ref": "#/components/schemas/__schema4"
                                  }
                                },
                                "occurred_at": {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                }
                              },
                              "required": [
                                "id",
                                "name"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "events"
                        ],
                        "additionalProperties": false
                      }
                    ]
                  },
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 120
                      },
                      "occurred_at": {
                        "type": "string",
                        "maxLength": 40
                      },
                      "customer_id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "external_customer_id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "customer": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              }
                            },
                            "required": [
                              "id"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "external_id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              }
                            },
                            "required": [
                              "external_id"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "anonymous_id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 200
                              }
                            },
                            "required": [
                              "anonymous_id"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      },
                      "anonymous_id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      },
                      "customer_token": {
                        "type": "string",
                        "maxLength": 200
                      },
                      "properties": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                        }
                      },
                      "mode": {
                        "type": "string",
                        "enum": [
                          "async",
                          "sync"
                        ]
                      }
                    },
                    "required": [
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "events": {
                        "minItems": 1,
                        "maxItems": 100,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "occurred_at": {
                              "type": "string",
                              "maxLength": 40
                            },
                            "customer_id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "external_customer_id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "customer": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200
                                    }
                                  },
                                  "required": [
                                    "id"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "external_id": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200
                                    }
                                  },
                                  "required": [
                                    "external_id"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "anonymous_id": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 200
                                    }
                                  },
                                  "required": [
                                    "anonymous_id"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            },
                            "anonymous_id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 200
                            },
                            "customer_token": {
                              "type": "string",
                              "maxLength": 200
                            },
                            "properties": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {
                                "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                              }
                            }
                          },
                          "required": [
                            "name"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "mode": {
                        "type": "string",
                        "enum": [
                          "async",
                          "sync"
                        ]
                      }
                    },
                    "required": [
                      "events"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "results": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "pending",
                                  "evaluated"
                                ]
                              },
                              "receipt_url": {
                                "type": "string"
                              },
                              "effects": {
                                "type": "object",
                                "properties": {
                                  "mechanic_changes": {
                                    "maxItems": 128,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "streak.progressed",
                                            "streak.extended",
                                            "streak.at_risk",
                                            "streak.broken",
                                            "streak.freeze_consumed",
                                            "streak.restored",
                                            "streak.milestone_reached",
                                            "tier.changed",
                                            "achievement.progressed",
                                            "badge.granted",
                                            "badge.revoked",
                                            "leaderboard.score_changed",
                                            "leaderboard.prize_settled",
                                            "referral.qualified",
                                            "referral.completed",
                                            "referral.reversed"
                                          ]
                                        },
                                        "program_id": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "program_id"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "coupons": {
                                    "maxItems": 128,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "entitlement_id": {
                                          "type": "string"
                                        },
                                        "offer_version_id": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "entitlement_id",
                                        "offer_version_id"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "discounts": {
                                    "maxItems": 128,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "quote_id": {
                                          "type": "string"
                                        },
                                        "offer_version_id": {
                                          "type": "string"
                                        },
                                        "currency": {
                                          "type": "string"
                                        },
                                        "subtotal_minor": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]*)$"
                                        },
                                        "discount_minor": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]*)$"
                                        },
                                        "total_minor": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]*)$"
                                        }
                                      },
                                      "required": [
                                        "quote_id",
                                        "offer_version_id",
                                        "currency",
                                        "subtotal_minor",
                                        "discount_minor",
                                        "total_minor"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "graph_quest_progress": {
                                    "maxItems": 128,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "program_id": {
                                          "type": "string"
                                        },
                                        "participation_id": {
                                          "type": "string"
                                        },
                                        "run_id": {
                                          "type": "string"
                                        },
                                        "status": {
                                          "type": "string",
                                          "enum": [
                                            "enrolled",
                                            "active",
                                            "qualified",
                                            "claimable",
                                            "completed",
                                            "claimed",
                                            "expired",
                                            "corrected"
                                          ]
                                        },
                                        "steps": {
                                          "maxItems": 32,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "key": {
                                                "type": "string"
                                              },
                                              "progress": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9][0-9]*)$"
                                              },
                                              "completed": {
                                                "type": "boolean"
                                              }
                                            },
                                            "required": [
                                              "key",
                                              "progress",
                                              "completed"
                                            ],
                                            "additionalProperties": false
                                          }
                                        }
                                      },
                                      "required": [
                                        "program_id",
                                        "participation_id",
                                        "run_id",
                                        "status",
                                        "steps"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "currency_deltas": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "currency_id": {
                                          "type": "string"
                                        },
                                        "amount": {
                                          "type": "string",
                                          "pattern": "^-?\\d+$"
                                        }
                                      },
                                      "required": [
                                        "currency_id",
                                        "amount"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "quest_progress": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "program_id": {
                                          "type": "string"
                                        },
                                        "participation_id": {
                                          "type": "string"
                                        },
                                        "progress": {
                                          "type": "integer",
                                          "minimum": -9007199254740991,
                                          "maximum": 9007199254740991
                                        },
                                        "target": {
                                          "type": "integer",
                                          "minimum": -9007199254740991,
                                          "maximum": 9007199254740991
                                        },
                                        "completed": {
                                          "type": "boolean"
                                        }
                                      },
                                      "required": [
                                        "program_id",
                                        "participation_id",
                                        "progress",
                                        "target",
                                        "completed"
                                      ],
                                      "additionalProperties": false
                                    }
                                  }
                                },
                                "required": [
                                  "currency_deltas",
                                  "quest_progress"
                                ],
                                "additionalProperties": false
                              },
                              "pending_followups": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "status",
                              "receipt_url",
                              "effects",
                              "pending_followups"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "results"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "accepted",
                            "evaluated",
                            "duplicate",
                            "rejected"
                          ]
                        },
                        "id": {
                          "type": "string"
                        },
                        "customer_id": {
                          "type": "string"
                        },
                        "late": {
                          "type": "boolean"
                        },
                        "fallback": {
                          "type": "boolean"
                        },
                        "execution_id": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "effects": {
                          "type": "array",
                          "items": {}
                        },
                        "queued_work": {
                          "description": "Pending follow-ups after sync evaluation. Omitted if the queue summary is unavailable.",
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "kind": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "kind",
                              "status"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "pending_followups": {
                          "description": "Number of listed follow-ups. Omitted if the queue summary is unavailable.",
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "trace": {},
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            },
                            "message": {
                              "type": "string"
                            },
                            "param": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code",
                            "message"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "status"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "results": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "index": {
                                "type": "number"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "accepted",
                                  "evaluated",
                                  "duplicate",
                                  "rejected"
                                ]
                              },
                              "id": {
                                "type": "string"
                              },
                              "customer_id": {
                                "type": "string"
                              },
                              "late": {
                                "type": "boolean"
                              },
                              "fallback": {
                                "type": "boolean"
                              },
                              "execution_id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "effects": {
                                "type": "array",
                                "items": {}
                              },
                              "queued_work": {
                                "description": "Pending follow-ups after sync evaluation. Omitted if the queue summary is unavailable.",
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "kind": {
                                      "type": "string"
                                    },
                                    "status": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "kind",
                                    "status"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "pending_followups": {
                                "description": "Number of listed follow-ups. Omitted if the queue summary is unavailable.",
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "trace": {},
                              "error": {
                                "type": "object",
                                "properties": {
                                  "code": {
                                    "type": "string"
                                  },
                                  "message": {
                                    "type": "string"
                                  },
                                  "param": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "code",
                                  "message"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "index",
                              "status"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "results"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "202": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "results": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "pending",
                                  "evaluated"
                                ]
                              },
                              "receipt_url": {
                                "type": "string"
                              },
                              "effects": {
                                "type": "object",
                                "properties": {
                                  "mechanic_changes": {
                                    "maxItems": 128,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "streak.progressed",
                                            "streak.extended",
                                            "streak.at_risk",
                                            "streak.broken",
                                            "streak.freeze_consumed",
                                            "streak.restored",
                                            "streak.milestone_reached",
                                            "tier.changed",
                                            "achievement.progressed",
                                            "badge.granted",
                                            "badge.revoked",
                                            "leaderboard.score_changed",
                                            "leaderboard.prize_settled",
                                            "referral.qualified",
                                            "referral.completed",
                                            "referral.reversed"
                                          ]
                                        },
                                        "program_id": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "program_id"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "coupons": {
                                    "maxItems": 128,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "entitlement_id": {
                                          "type": "string"
                                        },
                                        "offer_version_id": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "entitlement_id",
                                        "offer_version_id"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "discounts": {
                                    "maxItems": 128,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "quote_id": {
                                          "type": "string"
                                        },
                                        "offer_version_id": {
                                          "type": "string"
                                        },
                                        "currency": {
                                          "type": "string"
                                        },
                                        "subtotal_minor": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]*)$"
                                        },
                                        "discount_minor": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]*)$"
                                        },
                                        "total_minor": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]*)$"
                                        }
                                      },
                                      "required": [
                                        "quote_id",
                                        "offer_version_id",
                                        "currency",
                                        "subtotal_minor",
                                        "discount_minor",
                                        "total_minor"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "graph_quest_progress": {
                                    "maxItems": 128,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "program_id": {
                                          "type": "string"
                                        },
                                        "participation_id": {
                                          "type": "string"
                                        },
                                        "run_id": {
                                          "type": "string"
                                        },
                                        "status": {
                                          "type": "string",
                                          "enum": [
                                            "enrolled",
                                            "active",
                                            "qualified",
                                            "claimable",
                                            "completed",
                                            "claimed",
                                            "expired",
                                            "corrected"
                                          ]
                                        },
                                        "steps": {
                                          "maxItems": 32,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "key": {
                                                "type": "string"
                                              },
                                              "progress": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9][0-9]*)$"
                                              },
                                              "completed": {
                                                "type": "boolean"
                                              }
                                            },
                                            "required": [
                                              "key",
                                              "progress",
                                              "completed"
                                            ],
                                            "additionalProperties": false
                                          }
                                        }
                                      },
                                      "required": [
                                        "program_id",
                                        "participation_id",
                                        "run_id",
                                        "status",
                                        "steps"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "currency_deltas": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "currency_id": {
                                          "type": "string"
                                        },
                                        "amount": {
                                          "type": "string",
                                          "pattern": "^-?\\d+$"
                                        }
                                      },
                                      "required": [
                                        "currency_id",
                                        "amount"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "quest_progress": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "program_id": {
                                          "type": "string"
                                        },
                                        "participation_id": {
                                          "type": "string"
                                        },
                                        "progress": {
                                          "type": "integer",
                                          "minimum": -9007199254740991,
                                          "maximum": 9007199254740991
                                        },
                                        "target": {
                                          "type": "integer",
                                          "minimum": -9007199254740991,
                                          "maximum": 9007199254740991
                                        },
                                        "completed": {
                                          "type": "boolean"
                                        }
                                      },
                                      "required": [
                                        "program_id",
                                        "participation_id",
                                        "progress",
                                        "target",
                                        "completed"
                                      ],
                                      "additionalProperties": false
                                    }
                                  }
                                },
                                "required": [
                                  "currency_deltas",
                                  "quest_progress"
                                ],
                                "additionalProperties": false
                              },
                              "pending_followups": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "status",
                              "receipt_url",
                              "effects",
                              "pending_followups"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "results"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "accepted",
                            "evaluated",
                            "duplicate",
                            "rejected"
                          ]
                        },
                        "id": {
                          "type": "string"
                        },
                        "customer_id": {
                          "type": "string"
                        },
                        "late": {
                          "type": "boolean"
                        },
                        "fallback": {
                          "type": "boolean"
                        },
                        "execution_id": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "effects": {
                          "type": "array",
                          "items": {}
                        },
                        "queued_work": {
                          "description": "Pending follow-ups after sync evaluation. Omitted if the queue summary is unavailable.",
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "kind": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "kind",
                              "status"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "pending_followups": {
                          "description": "Number of listed follow-ups. Omitted if the queue summary is unavailable.",
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "trace": {},
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            },
                            "message": {
                              "type": "string"
                            },
                            "param": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code",
                            "message"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "status"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "results": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "index": {
                                "type": "number"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "accepted",
                                  "evaluated",
                                  "duplicate",
                                  "rejected"
                                ]
                              },
                              "id": {
                                "type": "string"
                              },
                              "customer_id": {
                                "type": "string"
                              },
                              "late": {
                                "type": "boolean"
                              },
                              "fallback": {
                                "type": "boolean"
                              },
                              "execution_id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "effects": {
                                "type": "array",
                                "items": {}
                              },
                              "queued_work": {
                                "description": "Pending follow-ups after sync evaluation. Omitted if the queue summary is unavailable.",
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "kind": {
                                      "type": "string"
                                    },
                                    "status": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "kind",
                                    "status"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "pending_followups": {
                                "description": "Number of listed follow-ups. Omitted if the queue summary is unavailable.",
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "trace": {},
                              "error": {
                                "type": "object",
                                "properties": {
                                  "code": {
                                    "type": "string"
                                  },
                                  "message": {
                                    "type": "string"
                                  },
                                  "param": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "code",
                                  "message"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "index",
                              "status"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "results"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "207": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "results": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "pending",
                                  "evaluated"
                                ]
                              },
                              "receipt_url": {
                                "type": "string"
                              },
                              "effects": {
                                "type": "object",
                                "properties": {
                                  "mechanic_changes": {
                                    "maxItems": 128,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "enum": [
                                            "streak.progressed",
                                            "streak.extended",
                                            "streak.at_risk",
                                            "streak.broken",
                                            "streak.freeze_consumed",
                                            "streak.restored",
                                            "streak.milestone_reached",
                                            "tier.changed",
                                            "achievement.progressed",
                                            "badge.granted",
                                            "badge.revoked",
                                            "leaderboard.score_changed",
                                            "leaderboard.prize_settled",
                                            "referral.qualified",
                                            "referral.completed",
                                            "referral.reversed"
                                          ]
                                        },
                                        "program_id": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "program_id"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "coupons": {
                                    "maxItems": 128,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "entitlement_id": {
                                          "type": "string"
                                        },
                                        "offer_version_id": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "entitlement_id",
                                        "offer_version_id"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "discounts": {
                                    "maxItems": 128,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "quote_id": {
                                          "type": "string"
                                        },
                                        "offer_version_id": {
                                          "type": "string"
                                        },
                                        "currency": {
                                          "type": "string"
                                        },
                                        "subtotal_minor": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]*)$"
                                        },
                                        "discount_minor": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]*)$"
                                        },
                                        "total_minor": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]*)$"
                                        }
                                      },
                                      "required": [
                                        "quote_id",
                                        "offer_version_id",
                                        "currency",
                                        "subtotal_minor",
                                        "discount_minor",
                                        "total_minor"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "graph_quest_progress": {
                                    "maxItems": 128,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "program_id": {
                                          "type": "string"
                                        },
                                        "participation_id": {
                                          "type": "string"
                                        },
                                        "run_id": {
                                          "type": "string"
                                        },
                                        "status": {
                                          "type": "string",
                                          "enum": [
                                            "enrolled",
                                            "active",
                                            "qualified",
                                            "claimable",
                                            "completed",
                                            "claimed",
                                            "expired",
                                            "corrected"
                                          ]
                                        },
                                        "steps": {
                                          "maxItems": 32,
                                          "type": "array",
                                          "items": {
                                            "type": "object",
                                            "properties": {
                                              "key": {
                                                "type": "string"
                                              },
                                              "progress": {
                                                "type": "string",
                                                "pattern": "^(0|[1-9][0-9]*)$"
                                              },
                                              "completed": {
                                                "type": "boolean"
                                              }
                                            },
                                            "required": [
                                              "key",
                                              "progress",
                                              "completed"
                                            ],
                                            "additionalProperties": false
                                          }
                                        }
                                      },
                                      "required": [
                                        "program_id",
                                        "participation_id",
                                        "run_id",
                                        "status",
                                        "steps"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "currency_deltas": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "currency_id": {
                                          "type": "string"
                                        },
                                        "amount": {
                                          "type": "string",
                                          "pattern": "^-?\\d+$"
                                        }
                                      },
                                      "required": [
                                        "currency_id",
                                        "amount"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "quest_progress": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "program_id": {
                                          "type": "string"
                                        },
                                        "participation_id": {
                                          "type": "string"
                                        },
                                        "progress": {
                                          "type": "integer",
                                          "minimum": -9007199254740991,
                                          "maximum": 9007199254740991
                                        },
                                        "target": {
                                          "type": "integer",
                                          "minimum": -9007199254740991,
                                          "maximum": 9007199254740991
                                        },
                                        "completed": {
                                          "type": "boolean"
                                        }
                                      },
                                      "required": [
                                        "program_id",
                                        "participation_id",
                                        "progress",
                                        "target",
                                        "completed"
                                      ],
                                      "additionalProperties": false
                                    }
                                  }
                                },
                                "required": [
                                  "currency_deltas",
                                  "quest_progress"
                                ],
                                "additionalProperties": false
                              },
                              "pending_followups": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "status",
                              "receipt_url",
                              "effects",
                              "pending_followups"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "results"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "accepted",
                            "evaluated",
                            "duplicate",
                            "rejected"
                          ]
                        },
                        "id": {
                          "type": "string"
                        },
                        "customer_id": {
                          "type": "string"
                        },
                        "late": {
                          "type": "boolean"
                        },
                        "fallback": {
                          "type": "boolean"
                        },
                        "execution_id": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "effects": {
                          "type": "array",
                          "items": {}
                        },
                        "queued_work": {
                          "description": "Pending follow-ups after sync evaluation. Omitted if the queue summary is unavailable.",
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "kind": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "kind",
                              "status"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "pending_followups": {
                          "description": "Number of listed follow-ups. Omitted if the queue summary is unavailable.",
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "trace": {},
                        "error": {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "string"
                            },
                            "message": {
                              "type": "string"
                            },
                            "param": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "code",
                            "message"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "status"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "results": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "index": {
                                "type": "number"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "accepted",
                                  "evaluated",
                                  "duplicate",
                                  "rejected"
                                ]
                              },
                              "id": {
                                "type": "string"
                              },
                              "customer_id": {
                                "type": "string"
                              },
                              "late": {
                                "type": "boolean"
                              },
                              "fallback": {
                                "type": "boolean"
                              },
                              "execution_id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "effects": {
                                "type": "array",
                                "items": {}
                              },
                              "queued_work": {
                                "description": "Pending follow-ups after sync evaluation. Omitted if the queue summary is unavailable.",
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "id": {
                                      "type": "string"
                                    },
                                    "kind": {
                                      "type": "string"
                                    },
                                    "status": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "id",
                                    "kind",
                                    "status"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "pending_followups": {
                                "description": "Number of listed follow-ups. Omitted if the queue summary is unavailable.",
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "trace": {},
                              "error": {
                                "type": "object",
                                "properties": {
                                  "code": {
                                    "type": "string"
                                  },
                                  "message": {
                                    "type": "string"
                                  },
                                  "param": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "code",
                                  "message"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "index",
                              "status"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "results"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "List events (newest first)",
        "tags": [
          "events"
        ],
        "operationId": "get_events",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "event",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads customer data of the selected environment; identities are replaced by conversation references before the model or storage sees them."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "events:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "events:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "customer_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "name",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "since",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "client_event_id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "customer_id": {
                            "type": "string"
                          },
                          "occurred_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "received_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "properties": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          "mode": {
                            "type": "string",
                            "enum": [
                              "async",
                              "sync"
                            ]
                          },
                          "late": {
                            "type": "boolean"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "accepted",
                              "evaluated",
                              "failed",
                              "poison",
                              "redacted"
                            ]
                          },
                          "execution_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "client_event_id",
                          "name",
                          "customer_id",
                          "occurred_at",
                          "received_at",
                          "properties",
                          "mode",
                          "late",
                          "status",
                          "execution_id"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/events/{id}": {
      "get": {
        "summary": "One event with its evaluation status",
        "tags": [
          "events"
        ],
        "operationId": "get_events_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found"
          ],
          "resource": "event",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "evt_00000000000000000000000000000042",
                "client_event_id": "order_42",
                "name": "order.paid",
                "customer_id": "cust_00000000000000000000000000000042",
                "occurred_at": "2026-09-20T00:00:00.000Z",
                "received_at": "2026-09-20T00:00:00.000Z",
                "properties": {},
                "mode": "async",
                "late": false,
                "status": "accepted",
                "execution_id": null
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads customer data of the selected environment; identities are replaced by conversation references before the model or storage sees them."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "events:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "events:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "client_event_id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "customer_id": {
                      "type": "string"
                    },
                    "occurred_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "received_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "properties": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "async",
                        "sync"
                      ]
                    },
                    "late": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "accepted",
                        "evaluated",
                        "failed",
                        "poison",
                        "redacted"
                      ]
                    },
                    "execution_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "client_event_id",
                    "name",
                    "customer_id",
                    "occurred_at",
                    "received_at",
                    "properties",
                    "mode",
                    "late",
                    "status",
                    "execution_id"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/events/{id}/execution": {
      "get": {
        "summary": "Plan and trace of an evaluated event",
        "tags": [
          "events"
        ],
        "operationId": "get_events_id_execution",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found"
          ],
          "resource": "event",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "exec_00000000000000000000000000000042",
                "event_id": "evt_00000000000000000000000000000042",
                "customer_id": "cust_00000000000000000000000000000042",
                "version_set": "example",
                "matched_rules": 0,
                "plan": [],
                "trace": {},
                "created_at": "2026-09-20T00:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads why an event of the selected environment did or did not award."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "events:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "events:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "event_id": {
                      "type": "string"
                    },
                    "customer_id": {
                      "type": "string"
                    },
                    "version_set": {
                      "type": "string"
                    },
                    "matched_rules": {
                      "type": "number"
                    },
                    "plan": {
                      "type": "array",
                      "items": {}
                    },
                    "trace": {},
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "event_id",
                    "customer_id",
                    "version_set",
                    "matched_rules",
                    "plan",
                    "trace",
                    "created_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/event_definitions": {
      "get": {
        "summary": "Observed event names with property types and samples",
        "tags": [
          "events"
        ],
        "operationId": "get_event_definitions",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "event_definition",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Lists event contracts (trust, client_allowed) of the selected environment."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "events:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "events:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "observed_schema": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {}
                          },
                          "confirmed_schema": {
                            "anyOf": [
                              {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string"
                                },
                                "additionalProperties": {}
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "schema_enforcement": {
                            "type": "string",
                            "enum": [
                              "off",
                              "warn",
                              "enforce"
                            ]
                          },
                          "schema_violation_count": {
                            "type": "number"
                          },
                          "schema_last_violation": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "property": {
                                    "type": "string"
                                  },
                                  "message": {
                                    "type": "string"
                                  },
                                  "event_id": {
                                    "type": "string"
                                  },
                                  "at": {
                                    "type": "string",
                                    "format": "date-time",
                                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                                  },
                                  "sample": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "propertyNames": {
                                          "type": "string"
                                        },
                                        "additionalProperties": {}
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "property",
                                  "message",
                                  "event_id",
                                  "at",
                                  "sample"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "samples": {
                            "type": "array",
                            "items": {}
                          },
                          "event_count": {
                            "type": "number"
                          },
                          "client_allowed": {
                            "type": "boolean"
                          },
                          "minimum_trust": {
                            "anyOf": [
                              {
                                "type": "string",
                                "enum": [
                                  "anonymous_claim",
                                  "customer_claim",
                                  "merchant_asserted",
                                  "verified_evidence"
                                ]
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "fact_policy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "object_type": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120
                                  },
                                  "key": {
                                    "minItems": 1,
                                    "maxItems": 32,
                                    "type": "array",
                                    "items": {
                                      "type": "string",
                                      "minLength": 1,
                                      "maxLength": 500,
                                      "pattern": "^[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)*$"
                                    }
                                  },
                                  "owner": {
                                    "type": "string",
                                    "enum": [
                                      "merchant",
                                      "customer"
                                    ]
                                  }
                                },
                                "required": [
                                  "object_type",
                                  "key",
                                  "owner"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "time_policy": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "client": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "const": "received_at"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "offline_seconds": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 2147483647
                                          }
                                        },
                                        "required": [
                                          "offline_seconds"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "client"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "first_seen_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "last_seen_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "version": {
                            "type": "number"
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "observed_schema",
                          "confirmed_schema",
                          "schema_enforcement",
                          "schema_violation_count",
                          "schema_last_violation",
                          "description",
                          "samples",
                          "event_count",
                          "client_allowed",
                          "minimum_trust",
                          "fact_policy",
                          "time_policy",
                          "first_seen_at",
                          "last_seen_at",
                          "version",
                          "updated_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/event_definitions/{id}": {
      "get": {
        "summary": "One event definition, with its schema enforcement mode and warn count",
        "tags": [
          "events"
        ],
        "operationId": "get_event_definitions_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found"
          ],
          "resource": "event_definition",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "evdef_00000000000000000000000000000042",
                "name": "order.paid",
                "observed_schema": {},
                "confirmed_schema": null,
                "schema_enforcement": "off",
                "schema_violation_count": 0,
                "schema_last_violation": null,
                "description": null,
                "samples": [],
                "event_count": 0,
                "client_allowed": false,
                "minimum_trust": null,
                "fact_policy": null,
                "time_policy": null,
                "first_seen_at": null,
                "last_seen_at": null,
                "version": 1,
                "updated_at": "2026-09-20T00:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads one event contract of the selected environment."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "events:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "events:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "observed_schema": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "confirmed_schema": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "schema_enforcement": {
                      "type": "string",
                      "enum": [
                        "off",
                        "warn",
                        "enforce"
                      ]
                    },
                    "schema_violation_count": {
                      "type": "number"
                    },
                    "schema_last_violation": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "property": {
                              "type": "string"
                            },
                            "message": {
                              "type": "string"
                            },
                            "event_id": {
                              "type": "string"
                            },
                            "at": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            },
                            "sample": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "propertyNames": {
                                    "type": "string"
                                  },
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "property",
                            "message",
                            "event_id",
                            "at",
                            "sample"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "samples": {
                      "type": "array",
                      "items": {}
                    },
                    "event_count": {
                      "type": "number"
                    },
                    "client_allowed": {
                      "type": "boolean"
                    },
                    "minimum_trust": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "anonymous_claim",
                            "customer_claim",
                            "merchant_asserted",
                            "verified_evidence"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "fact_policy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "object_type": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "key": {
                              "minItems": 1,
                              "maxItems": 32,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 500,
                                "pattern": "^[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)*$"
                              }
                            },
                            "owner": {
                              "type": "string",
                              "enum": [
                                "merchant",
                                "customer"
                              ]
                            }
                          },
                          "required": [
                            "object_type",
                            "key",
                            "owner"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "time_policy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "client": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "const": "received_at"
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "offline_seconds": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 2147483647
                                    }
                                  },
                                  "required": [
                                    "offline_seconds"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "client"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "first_seen_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "last_seen_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "observed_schema",
                    "confirmed_schema",
                    "schema_enforcement",
                    "schema_violation_count",
                    "schema_last_violation",
                    "description",
                    "samples",
                    "event_count",
                    "client_allowed",
                    "minimum_trust",
                    "fact_policy",
                    "time_policy",
                    "first_seen_at",
                    "last_seen_at",
                    "version",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Describe an event, confirm its schema, set schema enforcement, or allow it from publishable keys",
        "tags": [
          "events"
        ],
        "operationId": "patch_event_definitions_id",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "optional",
            "responseEtag": true
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "resource_not_found"
          ],
          "resource": "event_definition",
          "action": "update",
          "examples": {
            "request": {
              "description": "Paid order"
            },
            "success": {
              "status": 200,
              "body": {
                "id": "evdef_00000000000000000000000000000042",
                "name": "order.paid",
                "observed_schema": {},
                "confirmed_schema": null,
                "schema_enforcement": "off",
                "schema_violation_count": 0,
                "schema_last_violation": null,
                "description": null,
                "samples": [],
                "event_count": 0,
                "client_allowed": false,
                "minimum_trust": null,
                "fact_policy": null,
                "time_policy": null,
                "first_seen_at": null,
                "last_seen_at": null,
                "version": 1,
                "updated_at": "2026-09-20T00:00:00.000Z"
              },
              "headers": {
                "ETag": "\"1\""
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "event_definition"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "events:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "events:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Optional legacy revision. Missing or malformed values follow the existing route parser."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "description": "Paid order"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "description": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 2000
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "client_allowed": {
                    "type": "boolean"
                  },
                  "confirmed_schema": {
                    "anyOf": [
                      {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                        }
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "schema_enforcement": {
                    "type": "string",
                    "enum": [
                      "off",
                      "warn",
                      "enforce"
                    ]
                  },
                  "minimum_trust": {
                    "anyOf": [
                      {
                        "type": "string",
                        "enum": [
                          "anonymous_claim",
                          "customer_claim",
                          "merchant_asserted",
                          "verified_evidence"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "fact_policy": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "object_type": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "key": {
                            "minItems": 1,
                            "maxItems": 32,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 500,
                              "pattern": "^[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)*$"
                            }
                          },
                          "owner": {
                            "type": "string",
                            "enum": [
                              "merchant",
                              "customer"
                            ]
                          }
                        },
                        "required": [
                          "object_type",
                          "key",
                          "owner"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "time_policy": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "client": {
                            "anyOf": [
                              {
                                "type": "string",
                                "const": "received_at"
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "offline_seconds": {
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 2147483647
                                  }
                                },
                                "required": [
                                  "offline_seconds"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "required": [
                          "client"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "observed_schema": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {}
                    },
                    "confirmed_schema": {
                      "anyOf": [
                        {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {}
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "schema_enforcement": {
                      "type": "string",
                      "enum": [
                        "off",
                        "warn",
                        "enforce"
                      ]
                    },
                    "schema_violation_count": {
                      "type": "number"
                    },
                    "schema_last_violation": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "property": {
                              "type": "string"
                            },
                            "message": {
                              "type": "string"
                            },
                            "event_id": {
                              "type": "string"
                            },
                            "at": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            },
                            "sample": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "propertyNames": {
                                    "type": "string"
                                  },
                                  "additionalProperties": {}
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "property",
                            "message",
                            "event_id",
                            "at",
                            "sample"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "samples": {
                      "type": "array",
                      "items": {}
                    },
                    "event_count": {
                      "type": "number"
                    },
                    "client_allowed": {
                      "type": "boolean"
                    },
                    "minimum_trust": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "anonymous_claim",
                            "customer_claim",
                            "merchant_asserted",
                            "verified_evidence"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "fact_policy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "object_type": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 120
                            },
                            "key": {
                              "minItems": 1,
                              "maxItems": 32,
                              "type": "array",
                              "items": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 500,
                                "pattern": "^[A-Za-z0-9_-]+(?:\\.[A-Za-z0-9_-]+)*$"
                              }
                            },
                            "owner": {
                              "type": "string",
                              "enum": [
                                "merchant",
                                "customer"
                              ]
                            }
                          },
                          "required": [
                            "object_type",
                            "key",
                            "owner"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "time_policy": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "client": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "const": "received_at"
                                },
                                {
                                  "type": "object",
                                  "properties": {
                                    "offline_seconds": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 2147483647
                                    }
                                  },
                                  "required": [
                                    "offline_seconds"
                                  ],
                                  "additionalProperties": false
                                }
                              ]
                            }
                          },
                          "required": [
                            "client"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "first_seen_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "last_seen_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "observed_schema",
                    "confirmed_schema",
                    "schema_enforcement",
                    "schema_violation_count",
                    "schema_last_violation",
                    "description",
                    "samples",
                    "event_count",
                    "client_allowed",
                    "minimum_trust",
                    "fact_policy",
                    "time_policy",
                    "first_seen_at",
                    "last_seen_at",
                    "version",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers": {
      "post": {
        "summary": "Create or update a customer by external id (201 created, 200 updated)",
        "tags": [
          "customers"
        ],
        "operationId": "post_customers",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state"
          ],
          "resource": "customer",
          "action": "create",
          "examples": {
            "request": {
              "external_id": "reader_42",
              "attributes": {}
            },
            "success": {
              "status": 201,
              "body": {
                "id": "cust_00000000000000000000000000000042",
                "external_id": "reader_42",
                "timezone": null,
                "attributes": {},
                "version": 1,
                "deleted_at": null,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z"
              },
              "headers": {
                "ETag": "\"1\""
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "cust_00000000000000000000000000000042",
                "external_id": "reader_42",
                "timezone": null,
                "attributes": {},
                "version": 1,
                "deleted_at": null,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z"
              },
              "headers": {
                "ETag": "\"1\"",
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_in_progress",
                  "message": "idempotency in progress",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_in_progress",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "customer"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "customers:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "customers:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "external_id": "reader_42",
                "attributes": {}
              },
              "schema": {
                "type": "object",
                "properties": {
                  "external_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "attributes": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                    }
                  },
                  "anonymous_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  },
                  "timezone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "external_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "external_id": {
                      "type": "string"
                    },
                    "timezone": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "attributes": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                      }
                    },
                    "version": {
                      "type": "number"
                    },
                    "deleted_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "external_id",
                    "timezone",
                    "attributes",
                    "version",
                    "deleted_at",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "external_id": {
                      "type": "string"
                    },
                    "timezone": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "attributes": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                      }
                    },
                    "version": {
                      "type": "number"
                    },
                    "deleted_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "external_id",
                    "timezone",
                    "attributes",
                    "version",
                    "deleted_at",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "List customers (newest first)",
        "tags": [
          "customers"
        ],
        "operationId": "get_customers",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "customer",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads customer data of the selected environment; identities are replaced by conversation references before the model or storage sees them."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "customers:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "customers:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "external_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "external_id": {
                            "type": "string"
                          },
                          "timezone": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "attributes": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                            }
                          },
                          "version": {
                            "type": "number"
                          },
                          "deleted_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "id",
                          "external_id",
                          "timezone",
                          "attributes",
                          "version",
                          "deleted_at",
                          "created_at",
                          "updated_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{id}": {
      "get": {
        "summary": "One customer by id or external id",
        "tags": [
          "customers"
        ],
        "operationId": "get_customers_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found"
          ],
          "resource": "customer",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "cust_00000000000000000000000000000042",
                "external_id": "reader_42",
                "timezone": null,
                "attributes": {},
                "version": 1,
                "deleted_at": null,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads customer data of the selected environment; identities are replaced by conversation references before the model or storage sees them."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "customers:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "customers:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "external_id": {
                      "type": "string"
                    },
                    "timezone": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "attributes": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                      }
                    },
                    "version": {
                      "type": "number"
                    },
                    "deleted_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "external_id",
                    "timezone",
                    "attributes",
                    "version",
                    "deleted_at",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Merge-patch attributes (null removes a key)",
        "tags": [
          "customers"
        ],
        "operationId": "patch_customers_id",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "optional",
            "responseEtag": true
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "resource_not_found",
            "invalid_state"
          ],
          "resource": "customer",
          "action": "update",
          "examples": {
            "request": {
              "attributes": {
                "favorite_genre": "history"
              }
            },
            "success": {
              "status": 200,
              "body": {
                "id": "cust_00000000000000000000000000000042",
                "external_id": "reader_42",
                "timezone": null,
                "attributes": {},
                "version": 1,
                "deleted_at": null,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z"
              },
              "headers": {
                "ETag": "\"1\""
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "customer"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "customers:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "customers:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Optional legacy revision. Missing or malformed values follow the existing route parser."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "attributes": {
                  "favorite_genre": "history"
                }
              },
              "schema": {
                "type": "object",
                "properties": {
                  "attributes": {
                    "type": "object",
                    "propertyNames": {
                      "type": "string"
                    },
                    "additionalProperties": {
                      "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                    }
                  },
                  "timezone": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 64
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "external_id": {
                      "type": "string"
                    },
                    "timezone": {
                      "anyOf": [
                        {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 64
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "attributes": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                      }
                    },
                    "version": {
                      "type": "number"
                    },
                    "deleted_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "external_id",
                    "timezone",
                    "attributes",
                    "version",
                    "deleted_at",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete: redact attributes and events, remove aliases, keep ledger history",
        "tags": [
          "customers"
        ],
        "operationId": "delete_customers_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state"
          ],
          "resource": "customer",
          "action": "delete",
          "examples": {
            "success": {
              "status": 204
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": true,
            "effectFamilies": [
              "customer"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "customers:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "customers:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{id}/export": {
      "get": {
        "summary": "Complete data export: profile plus the first page of every history section (events, ledger, programs, streaks, badges, quests, levels, leaderboards, referrals, commerce, identity, merges); continue a section on /customers/{id}/export/{section}",
        "tags": [
          "customers"
        ],
        "operationId": "get_customers_id_export",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found"
          ],
          "resource": "customer",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "export_version": 2,
                "generated_at": "2026-09-20T00:00:00.000Z",
                "section_names": [
                  "aliases"
                ],
                "page_limit": 200,
                "events_archive": "included",
                "sections": {
                  "aliases": {
                    "data": [],
                    "next_cursor": null
                  }
                },
                "exported_at": "2026-09-20T00:00:00.000Z",
                "customer": {
                  "id": "cust_00000000000000000000000000000042",
                  "external_id": "reader_42",
                  "timezone": null,
                  "attributes": {},
                  "version": 1,
                  "deleted_at": null,
                  "created_at": "2026-09-20T00:00:00.000Z",
                  "updated_at": "2026-09-20T00:00:00.000Z"
                },
                "member_profiles": [
                  {
                    "id": "cust_00000000000000000000000000000042",
                    "external_id": "reader_42",
                    "timezone": null,
                    "attributes": {},
                    "version": 1,
                    "deleted_at": null,
                    "created_at": "2026-09-20T00:00:00.000Z",
                    "updated_at": "2026-09-20T00:00:00.000Z"
                  }
                ],
                "aliases": [],
                "events": [],
                "events_since": "2026-09-20T00:00:00.000Z",
                "ledger_entries": [],
                "economy_awards": [],
                "reward_issuances": [],
                "tiers": [],
                "challenge_progress": [],
                "dates": []
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "customers:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "customers:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 200,
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "export_version": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "generated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "section_names": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "aliases",
                          "auth_states",
                          "identity_links",
                          "session_families",
                          "sessions",
                          "merges",
                          "ownership_links",
                          "segment_memberships",
                          "experiment_assignments",
                          "events",
                          "event_receipts",
                          "rule_executions",
                          "business_facts",
                          "balances",
                          "ledger_entries",
                          "reward_issuances",
                          "tiers",
                          "challenge_enrollments",
                          "challenge_progress",
                          "program_participations",
                          "program_transitions",
                          "program_contributions",
                          "program_award_links",
                          "mechanic_facts",
                          "streak_periods",
                          "streak_milestones",
                          "streak_inventory",
                          "streak_freeze_lots",
                          "streak_freeze_entries",
                          "badge_grants",
                          "badge_revocations",
                          "achievement_progress",
                          "achievement_entries",
                          "achievement_distinct_members",
                          "quest_runs",
                          "quest_step_states",
                          "quest_entries",
                          "quest_claims",
                          "quest_distinct_members",
                          "level_runs",
                          "level_attainments",
                          "leaderboard_entries",
                          "leaderboard_profiles",
                          "leaderboard_scores",
                          "leaderboard_contributions",
                          "leaderboard_prize_settlements",
                          "leaderboard_prize_allocations",
                          "leaderboard_prize_effects",
                          "referral_codes",
                          "referral_attributions",
                          "referral_conversions",
                          "referral_settlements",
                          "referral_beneficiaries",
                          "referral_pending_holds",
                          "referral_reward_reservations",
                          "redemption_quotes",
                          "reward_redemptions",
                          "fulfillments",
                          "reward_coupon_entitlements",
                          "reward_code_allocations",
                          "reward_commerce_facts",
                          "reward_commerce_rule_effects",
                          "league_memberships",
                          "league_entries",
                          "league_score_events",
                          "social_profile",
                          "notification_contact",
                          "notification_preferences",
                          "notification_devices",
                          "notification_messages",
                          "inventory_holdings",
                          "inventory_entries",
                          "energy_states",
                          "energy_entries",
                          "boost_activations",
                          "loot_draws",
                          "economy_award_provenance",
                          "battle_pass_premiums",
                          "battle_pass_claims",
                          "match_result_players",
                          "streak_commands",
                          "customer_dates",
                          "store_credit_applications",
                          "connector_orders",
                          "import_rows",
                          "klaviyo_sync",
                          "points_transfers",
                          "friend_codes",
                          "friendships",
                          "social_blocks",
                          "social_reactions",
                          "friend_quests",
                          "friend_quest_contributions",
                          "friend_streaks",
                          "friend_streak_days",
                          "friend_streak_awards",
                          "teams_owned",
                          "team_memberships",
                          "team_quest_contributions",
                          "team_quest_rewards"
                        ]
                      }
                    },
                    "page_limit": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "events_archive": {
                      "type": "string",
                      "enum": [
                        "included",
                        "unavailable"
                      ],
                      "description": "included: events older than the hot window are read from the archive. unavailable: no archive is configured, so the events section covers the hot window only."
                    },
                    "sections": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "object",
                        "properties": {
                          "data": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {
                                "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                              },
                              "description": "One stored row under its snake_case column names, without internal-only columns."
                            }
                          },
                          "next_cursor": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "data",
                          "next_cursor"
                        ],
                        "additionalProperties": false
                      },
                      "description": "One entry per name in section_names. A non-null next_cursor means the section has more rows."
                    },
                    "exported_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "customer": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "external_id": {
                          "type": "string"
                        },
                        "timezone": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "attributes": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                          }
                        },
                        "version": {
                          "type": "number"
                        },
                        "deleted_at": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "created_at": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        "updated_at": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        }
                      },
                      "required": [
                        "id",
                        "external_id",
                        "timezone",
                        "attributes",
                        "version",
                        "deleted_at",
                        "created_at",
                        "updated_at"
                      ],
                      "additionalProperties": false
                    },
                    "member_profiles": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "external_id": {
                            "type": "string"
                          },
                          "timezone": {
                            "anyOf": [
                              {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "attributes": {
                            "type": "object",
                            "propertyNames": {
                              "type": "string"
                            },
                            "additionalProperties": {
                              "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                            }
                          },
                          "version": {
                            "type": "number"
                          },
                          "deleted_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "id",
                          "external_id",
                          "timezone",
                          "attributes",
                          "version",
                          "deleted_at",
                          "created_at",
                          "updated_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "aliases": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "alias": {
                            "type": "string"
                          },
                          "customer_id": {
                            "type": "string"
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "alias",
                          "customer_id",
                          "created_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "customer_id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "occurred_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "received_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "properties": {
                            "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                          }
                        },
                        "required": [
                          "id",
                          "customer_id",
                          "name",
                          "occurred_at",
                          "received_at",
                          "properties"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "events_since": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "ledger_entries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "customer_id": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "amount": {
                            "type": "number"
                          },
                          "remaining": {
                            "type": "number"
                          },
                          "expires_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "source_type": {
                            "type": "string"
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "id",
                          "customer_id",
                          "currency",
                          "type",
                          "status",
                          "amount",
                          "remaining",
                          "expires_at",
                          "reason",
                          "source_type",
                          "created_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "economy_awards": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "ledger_entry_id": {
                            "type": "string"
                          },
                          "customer_id": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "amount": {
                            "type": "number"
                          },
                          "source_type": {
                            "type": "string"
                          },
                          "source_id": {
                            "type": "string"
                          },
                          "trust_level": {
                            "type": "string"
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "ledger_entry_id",
                          "customer_id",
                          "currency",
                          "amount",
                          "source_type",
                          "source_id",
                          "trust_level",
                          "created_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "reward_issuances": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "customer_id": {
                            "type": "string"
                          },
                          "reward": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "expires_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "redeemed_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "cancelled_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "id",
                          "customer_id",
                          "reward",
                          "status",
                          "expires_at",
                          "redeemed_at",
                          "cancelled_at",
                          "created_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "tiers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "customer_id": {
                            "type": "string"
                          },
                          "program": {
                            "type": "string"
                          },
                          "level": {
                            "type": "string"
                          },
                          "since": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "customer_id",
                          "program",
                          "level",
                          "since"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "challenge_progress": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "customer_id": {
                            "type": "string"
                          },
                          "challenge": {
                            "type": "string"
                          },
                          "period_key": {
                            "type": "string"
                          },
                          "count": {
                            "type": "number"
                          },
                          "completed_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "customer_id",
                          "challenge",
                          "period_key",
                          "count",
                          "completed_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "dates": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "customer_id": {
                            "type": "string"
                          },
                          "key": {
                            "type": "string"
                          },
                          "month": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "day": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "year": {
                            "anyOf": [
                              {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "set_by": {
                            "type": "string",
                            "enum": [
                              "customer",
                              "operator",
                              "import"
                            ]
                          },
                          "set_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "customer_id",
                          "key",
                          "month",
                          "day",
                          "year",
                          "set_by",
                          "set_at"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "export_version",
                    "generated_at",
                    "section_names",
                    "page_limit",
                    "events_archive",
                    "sections",
                    "exported_at",
                    "customer",
                    "member_profiles",
                    "aliases",
                    "events",
                    "events_since",
                    "ledger_entries",
                    "economy_awards",
                    "reward_issuances",
                    "tiers",
                    "challenge_progress",
                    "dates"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{id}/export/{section}": {
      "get": {
        "summary": "One page of one customer export section; follow next_cursor until it is null to read the section completely",
        "tags": [
          "customers"
        ],
        "operationId": "list_customer_export_section",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "customer",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 200,
            "maximumLimit": 1000
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "section": "aliases",
                "customer_id": "cust_00000000000000000000000000000042",
                "data": [],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "customers:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "customers:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "path",
            "name": "section",
            "schema": {
              "type": "string",
              "enum": [
                "aliases",
                "auth_states",
                "identity_links",
                "session_families",
                "sessions",
                "merges",
                "ownership_links",
                "segment_memberships",
                "experiment_assignments",
                "events",
                "event_receipts",
                "rule_executions",
                "business_facts",
                "balances",
                "ledger_entries",
                "reward_issuances",
                "tiers",
                "challenge_enrollments",
                "challenge_progress",
                "program_participations",
                "program_transitions",
                "program_contributions",
                "program_award_links",
                "mechanic_facts",
                "streak_periods",
                "streak_milestones",
                "streak_inventory",
                "streak_freeze_lots",
                "streak_freeze_entries",
                "badge_grants",
                "badge_revocations",
                "achievement_progress",
                "achievement_entries",
                "achievement_distinct_members",
                "quest_runs",
                "quest_step_states",
                "quest_entries",
                "quest_claims",
                "quest_distinct_members",
                "level_runs",
                "level_attainments",
                "leaderboard_entries",
                "leaderboard_profiles",
                "leaderboard_scores",
                "leaderboard_contributions",
                "leaderboard_prize_settlements",
                "leaderboard_prize_allocations",
                "leaderboard_prize_effects",
                "referral_codes",
                "referral_attributions",
                "referral_conversions",
                "referral_settlements",
                "referral_beneficiaries",
                "referral_pending_holds",
                "referral_reward_reservations",
                "redemption_quotes",
                "reward_redemptions",
                "fulfillments",
                "reward_coupon_entitlements",
                "reward_code_allocations",
                "reward_commerce_facts",
                "reward_commerce_rule_effects",
                "league_memberships",
                "league_entries",
                "league_score_events",
                "social_profile",
                "notification_contact",
                "notification_preferences",
                "notification_devices",
                "notification_messages",
                "inventory_holdings",
                "inventory_entries",
                "energy_states",
                "energy_entries",
                "boost_activations",
                "loot_draws",
                "economy_award_provenance",
                "battle_pass_premiums",
                "battle_pass_claims",
                "match_result_players",
                "streak_commands",
                "customer_dates",
                "store_credit_applications",
                "connector_orders",
                "import_rows",
                "klaviyo_sync",
                "points_transfers",
                "friend_codes",
                "friendships",
                "social_blocks",
                "social_reactions",
                "friend_quests",
                "friend_quest_contributions",
                "friend_streaks",
                "friend_streak_days",
                "friend_streak_awards",
                "teams_owned",
                "team_memberships",
                "team_quest_contributions",
                "team_quest_rewards"
              ]
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 200,
              "type": "integer",
              "minimum": 1,
              "maximum": 1000
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "section": {
                      "type": "string",
                      "enum": [
                        "aliases",
                        "auth_states",
                        "identity_links",
                        "session_families",
                        "sessions",
                        "merges",
                        "ownership_links",
                        "segment_memberships",
                        "experiment_assignments",
                        "events",
                        "event_receipts",
                        "rule_executions",
                        "business_facts",
                        "balances",
                        "ledger_entries",
                        "reward_issuances",
                        "tiers",
                        "challenge_enrollments",
                        "challenge_progress",
                        "program_participations",
                        "program_transitions",
                        "program_contributions",
                        "program_award_links",
                        "mechanic_facts",
                        "streak_periods",
                        "streak_milestones",
                        "streak_inventory",
                        "streak_freeze_lots",
                        "streak_freeze_entries",
                        "badge_grants",
                        "badge_revocations",
                        "achievement_progress",
                        "achievement_entries",
                        "achievement_distinct_members",
                        "quest_runs",
                        "quest_step_states",
                        "quest_entries",
                        "quest_claims",
                        "quest_distinct_members",
                        "level_runs",
                        "level_attainments",
                        "leaderboard_entries",
                        "leaderboard_profiles",
                        "leaderboard_scores",
                        "leaderboard_contributions",
                        "leaderboard_prize_settlements",
                        "leaderboard_prize_allocations",
                        "leaderboard_prize_effects",
                        "referral_codes",
                        "referral_attributions",
                        "referral_conversions",
                        "referral_settlements",
                        "referral_beneficiaries",
                        "referral_pending_holds",
                        "referral_reward_reservations",
                        "redemption_quotes",
                        "reward_redemptions",
                        "fulfillments",
                        "reward_coupon_entitlements",
                        "reward_code_allocations",
                        "reward_commerce_facts",
                        "reward_commerce_rule_effects",
                        "league_memberships",
                        "league_entries",
                        "league_score_events",
                        "social_profile",
                        "notification_contact",
                        "notification_preferences",
                        "notification_devices",
                        "notification_messages",
                        "inventory_holdings",
                        "inventory_entries",
                        "energy_states",
                        "energy_entries",
                        "boost_activations",
                        "loot_draws",
                        "economy_award_provenance",
                        "battle_pass_premiums",
                        "battle_pass_claims",
                        "match_result_players",
                        "streak_commands",
                        "customer_dates",
                        "store_credit_applications",
                        "connector_orders",
                        "import_rows",
                        "klaviyo_sync",
                        "points_transfers",
                        "friend_codes",
                        "friendships",
                        "social_blocks",
                        "social_reactions",
                        "friend_quests",
                        "friend_quest_contributions",
                        "friend_streaks",
                        "friend_streak_days",
                        "friend_streak_awards",
                        "teams_owned",
                        "team_memberships",
                        "team_quest_contributions",
                        "team_quest_rewards"
                      ]
                    },
                    "customer_id": {
                      "type": "string"
                    },
                    "events_archive": {
                      "type": "string",
                      "enum": [
                        "included",
                        "unavailable"
                      ],
                      "description": "included: events older than the hot window are read from the archive. unavailable: no archive is configured, so the events section covers the hot window only."
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                        },
                        "description": "One stored row under its snake_case column names, without internal-only columns."
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "section",
                    "customer_id",
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{id}/state": {
      "get": {
        "summary": "Balances, tiers, segments, counters, challenge progress, issuances and aliases",
        "tags": [
          "customers"
        ],
        "operationId": "get_customers_id_state",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found"
          ],
          "resource": "customer",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "customer": {
                  "id": "cust_00000000000000000000000000000042",
                  "external_id": "reader_42",
                  "timezone": null,
                  "attributes": {},
                  "version": 1,
                  "deleted_at": null,
                  "created_at": "2026-09-20T00:00:00.000Z",
                  "updated_at": "2026-09-20T00:00:00.000Z"
                },
                "balances": [],
                "tiers": [],
                "segments": [],
                "counters": {},
                "counter_windows": {},
                "challenges": [],
                "issuances": [],
                "aliases": [],
                "summary_limit": 50,
                "collection_links": {
                  "challenges": "/v1/customers/cust_00000000000000000000000000000042/challenge_progress",
                  "issuances": "/v1/reward_issuances?customer_id=cust_00000000000000000000000000000042"
                },
                "has_more": {
                  "challenges": false,
                  "issuances": false
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads customer data of the selected environment; identities are replaced by conversation references before the model or storage sees them."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "customers:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "customers:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "customer": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string"
                        },
                        "external_id": {
                          "type": "string"
                        },
                        "timezone": {
                          "anyOf": [
                            {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 64
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "attributes": {
                          "type": "object",
                          "propertyNames": {
                            "type": "string"
                          },
                          "additionalProperties": {
                            "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                          }
                        },
                        "version": {
                          "type": "number"
                        },
                        "deleted_at": {
                          "anyOf": [
                            {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            },
                            {
                              "type": "null"
                            }
                          ]
                        },
                        "created_at": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        "updated_at": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        }
                      },
                      "required": [
                        "id",
                        "external_id",
                        "timezone",
                        "attributes",
                        "version",
                        "deleted_at",
                        "created_at",
                        "updated_at"
                      ],
                      "additionalProperties": false
                    },
                    "balances": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "currency": {
                            "type": "string"
                          },
                          "available": {
                            "type": "number"
                          },
                          "pending": {
                            "type": "number"
                          },
                          "lifetime_earned": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "currency",
                          "available",
                          "pending",
                          "lifetime_earned"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "tiers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "program_id": {
                            "type": "string"
                          },
                          "level": {
                            "type": "string"
                          },
                          "since": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "program_id",
                          "level",
                          "since"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "segments": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Static memberships plus dynamic segments evaluated now, as rules see them."
                    },
                    "counters": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "number"
                      },
                      "description": "Counter values by definition name, as rules read them right now: the count in the current window, or the all-time count for `window: none`. Window metadata is in `counter_windows`."
                    },
                    "counter_windows": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "object",
                        "properties": {
                          "window": {
                            "type": "string",
                            "enum": [
                              "none",
                              "day",
                              "week",
                              "month",
                              "year"
                            ]
                          },
                          "period_key": {
                            "description": "The current window in the environment timezone; null for `window: none`.",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "all_time": {
                            "description": "Set only for `window: none` counters; windowed counters keep no total.",
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "ready": {
                            "type": "boolean",
                            "description": "False while the definition is still backfilling."
                          }
                        },
                        "required": [
                          "window",
                          "period_key",
                          "all_time",
                          "ready"
                        ],
                        "additionalProperties": false
                      },
                      "description": "Window metadata for each entry of `counters`, by definition name."
                    },
                    "challenges": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "challenge_id": {
                            "type": "string"
                          },
                          "period_key": {
                            "type": "string"
                          },
                          "count": {
                            "type": "number"
                          },
                          "status": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "challenge_id",
                          "period_key",
                          "count",
                          "status"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "issuances": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "reward_id": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "expires_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "reward_id",
                          "status",
                          "expires_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "aliases": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "alias": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "anonymous",
                              "external"
                            ]
                          },
                          "customer_id": {
                            "type": "string"
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "alias",
                          "kind",
                          "customer_id",
                          "created_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "collection_links": {
                      "type": "object",
                      "properties": {
                        "challenges": {
                          "type": "string"
                        },
                        "issuances": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "challenges",
                        "issuances"
                      ],
                      "additionalProperties": false
                    },
                    "summary_limit": {
                      "type": "number",
                      "const": 50
                    },
                    "has_more": {
                      "type": "object",
                      "properties": {
                        "challenges": {
                          "type": "boolean"
                        },
                        "issuances": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "challenges",
                        "issuances"
                      ],
                      "additionalProperties": false,
                      "description": "`challenges` and `issuances` hold the newest 50 rows; true when older ones were left out."
                    }
                  },
                  "required": [
                    "customer",
                    "balances",
                    "tiers",
                    "segments",
                    "counters",
                    "counter_windows",
                    "challenges",
                    "issuances",
                    "aliases",
                    "collection_links",
                    "summary_limit",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{id}/aliases": {
      "post": {
        "summary": "Identify an alias; active account movement additionally requires a secret key with customers:merge",
        "tags": [
          "customers"
        ],
        "operationId": "post_customers_id_aliases",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "merge_conflict",
            "merge_capacity_exceeded",
            "customer_surface_inactive",
            "resource_not_found",
            "invalid_state",
            "alias_conflict"
          ],
          "resource": "customer",
          "action": "create",
          "examples": {
            "request": {
              "alias": "anonymous_42"
            },
            "success": {
              "status": 201,
              "body": {
                "alias": {
                  "alias": "anonymous_42",
                  "kind": "anonymous",
                  "customer_id": "cust_00000000000000000000000000000042",
                  "created_at": "2026-09-20T00:00:00.000Z"
                },
                "merged_from": null
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "alias": {
                  "alias": "anonymous_42",
                  "kind": "anonymous",
                  "customer_id": "cust_00000000000000000000000000000042",
                  "created_at": "2026-09-20T00:00:00.000Z"
                },
                "merged_from": null
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_in_progress",
                  "message": "idempotency in progress",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_in_progress",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": true,
            "effectFamilies": [
              "customer"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "customers:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "customers:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "alias": "anonymous_42"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "alias": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 200
                  }
                },
                "required": [
                  "alias"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "alias": {
                      "type": "object",
                      "properties": {
                        "alias": {
                          "type": "string"
                        },
                        "kind": {
                          "type": "string",
                          "enum": [
                            "anonymous",
                            "external"
                          ]
                        },
                        "customer_id": {
                          "type": "string"
                        },
                        "created_at": {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        }
                      },
                      "required": [
                        "alias",
                        "kind",
                        "customer_id",
                        "created_at"
                      ],
                      "additionalProperties": false
                    },
                    "merged_from": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "alias",
                    "merged_from"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{id}/client_token": {
      "post": {
        "summary": "Mint the token a browser must present to send events as this customer",
        "tags": [
          "customers"
        ],
        "operationId": "post_customers_id_client_token",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "event_requires_secret_key",
            "test_player_limit",
            "test_environment_resetting",
            "customer_credential_retired",
            "resource_not_found",
            "invalid_state"
          ],
          "resource": "customer",
          "action": "create",
          "examples": {
            "success": {
              "status": 201,
              "body": {
                "customer_id": "cust_00000000000000000000000000000042",
                "external_id": "reader_42",
                "customer_token": "example_token_not_a_credential"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "customer"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "customers:client_token"
            ],
            "environment": "credential_bound"
          }
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          }
        ],
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "customer_id": {
                      "type": "string"
                    },
                    "external_id": {
                      "type": "string"
                    },
                    "customer_token": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "customer_id",
                    "external_id",
                    "customer_token"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "410": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/attribute_definitions": {
      "get": {
        "summary": "Declared customer attributes with types and PII flags",
        "tags": [
          "customers"
        ],
        "operationId": "get_attribute_definitions",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "attribute_definition",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads configuration of the selected environment through its environment-scoped resolution."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "customers:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "customers:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "key": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "string",
                              "number",
                              "boolean",
                              "timestamp"
                            ]
                          },
                          "description": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "pii": {
                            "type": "boolean"
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "id",
                          "key",
                          "type",
                          "description",
                          "pii",
                          "created_at",
                          "updated_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Declare or update an attribute definition by key; Location reads the collection",
        "tags": [
          "customers"
        ],
        "operationId": "post_attribute_definitions",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state"
          ],
          "resource": "attribute_definition",
          "action": "create",
          "examples": {
            "request": {
              "key": "favorite_genre",
              "type": "string",
              "pii": false
            },
            "success": {
              "status": 201,
              "body": {
                "id": "attr_00000000000000000000000000000042",
                "key": "favorite_genre",
                "type": "string",
                "description": null,
                "pii": false,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "attr_00000000000000000000000000000042",
                "key": "favorite_genre",
                "type": "string",
                "description": null,
                "pii": false,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z"
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_in_progress",
                  "message": "idempotency in progress",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_in_progress",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "customer"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "customers:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "customers:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "key": "favorite_genre",
                "type": "string",
                "pii": false
              },
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9_]{0,63}$"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "string",
                      "number",
                      "boolean",
                      "timestamp"
                    ]
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 500
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "pii": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "key",
                  "type"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "key": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "string",
                        "number",
                        "boolean",
                        "timestamp"
                      ]
                    },
                    "description": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "pii": {
                      "type": "boolean"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "key",
                    "type",
                    "description",
                    "pii",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{id}/challenge_progress": {
      "get": {
        "summary": "All challenge progress for a customer",
        "tags": [
          "customers"
        ],
        "operationId": "get_customer_challenge_progress",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "customer",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "customers:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "customers:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "customer_id": {
                            "type": "string"
                          },
                          "challenge_id": {
                            "type": "string"
                          },
                          "period_key": {
                            "type": "string"
                          },
                          "count": {
                            "type": "number"
                          },
                          "status": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "customer_id",
                          "challenge_id",
                          "period_key",
                          "count",
                          "status"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/identity_connections": {
      "post": {
        "summary": "Create a fixed identity verification connection",
        "tags": [
          "customer identity"
        ],
        "operationId": "post_identity_connections",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "invalid_cursor",
            "customer_surface_inactive",
            "invalid_customer_session",
            "invalid_session_grant",
            "customer_session_limit"
          ],
          "resource": "identity_connection",
          "action": "create",
          "examples": {
            "request": {
              "provider": "oidc",
              "issuer": "https://identity.example",
              "audience": "product",
              "verification_url": "https://identity.example/jwks",
              "algorithms": [
                "RS256"
              ],
              "token_profile": "oidc_id"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "ic_example",
                "provider": "oidc",
                "issuer": "https://identity.example",
                "audience": "product",
                "verification_url": "https://identity.example/jwks",
                "algorithms": [
                  "RS256"
                ],
                "token_profile": "oidc_id",
                "authorized_parties": [],
                "enabled": true,
                "security_generation": 1,
                "provider_issued_at_cutoff": null,
                "version": 1,
                "created_at": "2026-09-21T12:00:00.000Z",
                "updated_at": "2026-09-21T12:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "ic_example",
                "provider": "oidc",
                "issuer": "https://identity.example",
                "audience": "product",
                "verification_url": "https://identity.example/jwks",
                "algorithms": [
                  "RS256"
                ],
                "token_profile": "oidc_id",
                "authorized_parties": [],
                "enabled": true,
                "security_generation": 1,
                "provider_issued_at_cutoff": null,
                "version": 1,
                "created_at": "2026-09-21T12:00:00.000Z",
                "updated_at": "2026-09-21T12:00:00.000Z"
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "customer_identity"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "identity_connections:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "identity_connections:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "provider": "oidc",
                "issuer": "https://identity.example",
                "audience": "product",
                "verification_url": "https://identity.example/jwks",
                "algorithms": [
                  "RS256"
                ],
                "token_profile": "oidc_id"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "provider": {
                    "type": "string",
                    "enum": [
                      "firebase",
                      "supabase",
                      "clerk",
                      "auth0",
                      "oidc"
                    ]
                  },
                  "issuer": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048
                  },
                  "audience": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048
                  },
                  "verification_url": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048
                  },
                  "algorithms": {
                    "minItems": 1,
                    "maxItems": 2,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "RS256",
                        "ES256"
                      ]
                    }
                  },
                  "token_profile": {
                    "type": "string",
                    "enum": [
                      "firebase_id",
                      "supabase_access",
                      "clerk_template",
                      "auth0_user_access",
                      "oidc_id"
                    ]
                  },
                  "authorized_parties": {
                    "default": [],
                    "maxItems": 32,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2048
                    }
                  },
                  "enabled": {
                    "default": true,
                    "type": "boolean"
                  },
                  "provider_issued_at_cutoff": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  }
                },
                "required": [
                  "provider",
                  "issuer",
                  "audience",
                  "verification_url",
                  "algorithms",
                  "token_profile"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "provider": {
                      "type": "string",
                      "enum": [
                        "firebase",
                        "supabase",
                        "clerk",
                        "auth0",
                        "oidc"
                      ]
                    },
                    "issuer": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2048
                    },
                    "audience": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2048
                    },
                    "verification_url": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2048
                    },
                    "algorithms": {
                      "minItems": 1,
                      "maxItems": 2,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "RS256",
                          "ES256"
                        ]
                      }
                    },
                    "token_profile": {
                      "type": "string",
                      "enum": [
                        "firebase_id",
                        "supabase_access",
                        "clerk_template",
                        "auth0_user_access",
                        "oidc_id"
                      ]
                    },
                    "authorized_parties": {
                      "maxItems": 32,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2048
                      }
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "provider_issued_at_cutoff": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "security_generation": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "version": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "provider",
                    "issuer",
                    "audience",
                    "verification_url",
                    "algorithms",
                    "token_profile",
                    "authorized_parties",
                    "enabled",
                    "provider_issued_at_cutoff",
                    "security_generation",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "List identity connections",
        "tags": [
          "customer identity"
        ],
        "operationId": "get_identity_connections",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "invalid_cursor",
            "customer_surface_inactive",
            "invalid_customer_session",
            "invalid_session_grant",
            "customer_session_limit"
          ],
          "resource": "identity_connection",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "identity_connections:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "identity_connections:read"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "provider": {
                            "type": "string",
                            "enum": [
                              "firebase",
                              "supabase",
                              "clerk",
                              "auth0",
                              "oidc"
                            ]
                          },
                          "issuer": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 2048
                          },
                          "audience": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 2048
                          },
                          "verification_url": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 2048
                          },
                          "algorithms": {
                            "minItems": 1,
                            "maxItems": 2,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "RS256",
                                "ES256"
                              ]
                            }
                          },
                          "token_profile": {
                            "type": "string",
                            "enum": [
                              "firebase_id",
                              "supabase_access",
                              "clerk_template",
                              "auth0_user_access",
                              "oidc_id"
                            ]
                          },
                          "authorized_parties": {
                            "maxItems": 32,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 2048
                            }
                          },
                          "enabled": {
                            "type": "boolean"
                          },
                          "provider_issued_at_cutoff": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "security_generation": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "version": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "id",
                          "provider",
                          "issuer",
                          "audience",
                          "verification_url",
                          "algorithms",
                          "token_profile",
                          "authorized_parties",
                          "enabled",
                          "provider_issued_at_cutoff",
                          "security_generation",
                          "version",
                          "created_at",
                          "updated_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/identity_connections/{id}": {
      "get": {
        "summary": "Read an identity connection",
        "tags": [
          "customer identity"
        ],
        "operationId": "get_identity_connections_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "invalid_cursor",
            "customer_surface_inactive",
            "invalid_customer_session",
            "invalid_session_grant",
            "customer_session_limit"
          ],
          "resource": "identity_connection",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "ic_example",
                "provider": "oidc",
                "issuer": "https://identity.example",
                "audience": "product",
                "verification_url": "https://identity.example/jwks",
                "algorithms": [
                  "RS256"
                ],
                "token_profile": "oidc_id",
                "authorized_parties": [],
                "enabled": true,
                "security_generation": 1,
                "provider_issued_at_cutoff": null,
                "version": 1,
                "created_at": "2026-09-21T12:00:00.000Z",
                "updated_at": "2026-09-21T12:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "identity_connections:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "identity_connections:read"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "provider": {
                      "type": "string",
                      "enum": [
                        "firebase",
                        "supabase",
                        "clerk",
                        "auth0",
                        "oidc"
                      ]
                    },
                    "issuer": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2048
                    },
                    "audience": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2048
                    },
                    "verification_url": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2048
                    },
                    "algorithms": {
                      "minItems": 1,
                      "maxItems": 2,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "RS256",
                          "ES256"
                        ]
                      }
                    },
                    "token_profile": {
                      "type": "string",
                      "enum": [
                        "firebase_id",
                        "supabase_access",
                        "clerk_template",
                        "auth0_user_access",
                        "oidc_id"
                      ]
                    },
                    "authorized_parties": {
                      "maxItems": 32,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2048
                      }
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "provider_issued_at_cutoff": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "security_generation": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "version": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "provider",
                    "issuer",
                    "audience",
                    "verification_url",
                    "algorithms",
                    "token_profile",
                    "authorized_parties",
                    "enabled",
                    "provider_issued_at_cutoff",
                    "security_generation",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Update verification policy and invalidate old connection generations",
        "tags": [
          "customer identity"
        ],
        "operationId": "patch_identity_connections_id",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "required",
            "responseEtag": true
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "invalid_cursor",
            "customer_surface_inactive",
            "invalid_customer_session",
            "invalid_session_grant",
            "customer_session_limit"
          ],
          "resource": "identity_connection",
          "action": "update",
          "examples": {
            "request": {
              "audience": "product"
            },
            "success": {
              "status": 200,
              "body": {
                "id": "ic_example",
                "provider": "oidc",
                "issuer": "https://identity.example",
                "audience": "product",
                "verification_url": "https://identity.example/jwks",
                "algorithms": [
                  "RS256"
                ],
                "token_profile": "oidc_id",
                "authorized_parties": [],
                "enabled": true,
                "security_generation": 1,
                "provider_issued_at_cutoff": null,
                "version": 1,
                "created_at": "2026-09-21T12:00:00.000Z",
                "updated_at": "2026-09-21T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"1\""
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 200,
              "body": {
                "id": "ic_example",
                "provider": "oidc",
                "issuer": "https://identity.example",
                "audience": "product",
                "verification_url": "https://identity.example/jwks",
                "algorithms": [
                  "RS256"
                ],
                "token_profile": "oidc_id",
                "authorized_parties": [],
                "enabled": true,
                "security_generation": 1,
                "provider_issued_at_cutoff": null,
                "version": 1,
                "created_at": "2026-09-21T12:00:00.000Z",
                "updated_at": "2026-09-21T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"1\"",
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "customer_identity"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "identity_connections:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "identity_connections:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Required revision, checked in the owning transaction."
            },
            "required": true,
            "description": "Required revision, checked in the owning transaction."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "audience": "product"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "audience": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048
                  },
                  "verification_url": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2048
                  },
                  "algorithms": {
                    "minItems": 1,
                    "maxItems": 2,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "RS256",
                        "ES256"
                      ]
                    }
                  },
                  "token_profile": {
                    "type": "string",
                    "enum": [
                      "firebase_id",
                      "supabase_access",
                      "clerk_template",
                      "auth0_user_access",
                      "oidc_id"
                    ]
                  },
                  "authorized_parties": {
                    "maxItems": 32,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2048
                    }
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "provider_issued_at_cutoff": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "provider": {
                      "type": "string",
                      "enum": [
                        "firebase",
                        "supabase",
                        "clerk",
                        "auth0",
                        "oidc"
                      ]
                    },
                    "issuer": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2048
                    },
                    "audience": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2048
                    },
                    "verification_url": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2048
                    },
                    "algorithms": {
                      "minItems": 1,
                      "maxItems": 2,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "RS256",
                          "ES256"
                        ]
                      }
                    },
                    "token_profile": {
                      "type": "string",
                      "enum": [
                        "firebase_id",
                        "supabase_access",
                        "clerk_template",
                        "auth0_user_access",
                        "oidc_id"
                      ]
                    },
                    "authorized_parties": {
                      "maxItems": 32,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2048
                      }
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "provider_issued_at_cutoff": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "security_generation": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "version": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "provider",
                    "issuer",
                    "audience",
                    "verification_url",
                    "algorithms",
                    "token_profile",
                    "authorized_parties",
                    "enabled",
                    "provider_issued_at_cutoff",
                    "security_generation",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/identity_connections/{id}/disable": {
      "post": {
        "summary": "Disable exchange and sessions issued through this connection",
        "tags": [
          "customer identity"
        ],
        "operationId": "post_identity_connections_id_disable",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "required",
            "responseEtag": true
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "invalid_cursor",
            "customer_surface_inactive",
            "invalid_customer_session",
            "invalid_session_grant",
            "customer_session_limit"
          ],
          "resource": "identity_connection",
          "action": "transition",
          "examples": {
            "request": {},
            "success": {
              "status": 200,
              "body": {
                "id": "ic_example",
                "provider": "oidc",
                "issuer": "https://identity.example",
                "audience": "product",
                "verification_url": "https://identity.example/jwks",
                "algorithms": [
                  "RS256"
                ],
                "token_profile": "oidc_id",
                "authorized_parties": [],
                "enabled": false,
                "security_generation": 1,
                "provider_issued_at_cutoff": null,
                "version": 1,
                "created_at": "2026-09-21T12:00:00.000Z",
                "updated_at": "2026-09-21T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"1\""
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 200,
              "body": {
                "id": "ic_example",
                "provider": "oidc",
                "issuer": "https://identity.example",
                "audience": "product",
                "verification_url": "https://identity.example/jwks",
                "algorithms": [
                  "RS256"
                ],
                "token_profile": "oidc_id",
                "authorized_parties": [],
                "enabled": false,
                "security_generation": 1,
                "provider_issued_at_cutoff": null,
                "version": 1,
                "created_at": "2026-09-21T12:00:00.000Z",
                "updated_at": "2026-09-21T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"1\"",
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": true,
            "effectFamilies": [
              "customer_identity"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "identity_connections:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "identity_connections:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Required revision, checked in the owning transaction."
            },
            "required": true,
            "description": "Required revision, checked in the owning transaction."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {},
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "provider": {
                      "type": "string",
                      "enum": [
                        "firebase",
                        "supabase",
                        "clerk",
                        "auth0",
                        "oidc"
                      ]
                    },
                    "issuer": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2048
                    },
                    "audience": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2048
                    },
                    "verification_url": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 2048
                    },
                    "algorithms": {
                      "minItems": 1,
                      "maxItems": 2,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "RS256",
                          "ES256"
                        ]
                      }
                    },
                    "token_profile": {
                      "type": "string",
                      "enum": [
                        "firebase_id",
                        "supabase_access",
                        "clerk_template",
                        "auth0_user_access",
                        "oidc_id"
                      ]
                    },
                    "authorized_parties": {
                      "maxItems": 32,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 2048
                      }
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "provider_issued_at_cutoff": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "security_generation": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "version": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "provider",
                    "issuer",
                    "audience",
                    "verification_url",
                    "algorithms",
                    "token_profile",
                    "authorized_parties",
                    "enabled",
                    "provider_issued_at_cutoff",
                    "security_generation",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer_identity_bindings": {
      "get": {
        "summary": "List customer identity bindings without provider subjects",
        "tags": [
          "customer identity"
        ],
        "operationId": "get_customer_identity_bindings",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "invalid_cursor",
            "customer_surface_inactive",
            "invalid_customer_session",
            "invalid_session_grant",
            "customer_session_limit"
          ],
          "resource": "customer_identity_binding",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer_identity_bindings:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "customer_identity_bindings:read"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "customer_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "connection_id": {
                            "type": "string"
                          },
                          "customer_id": {
                            "type": "string"
                          },
                          "issuer": {
                            "type": "string"
                          },
                          "suspended_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "security_generation": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "provider_issued_at_cutoff": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "id",
                          "connection_id",
                          "customer_id",
                          "issuer",
                          "suspended_at",
                          "security_generation",
                          "provider_issued_at_cutoff",
                          "created_at",
                          "updated_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer_identity_bindings/{id}": {
      "get": {
        "summary": "Read customer identity binding security state",
        "tags": [
          "customer identity"
        ],
        "operationId": "get_customer_identity_bindings_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "invalid_cursor",
            "customer_surface_inactive",
            "invalid_customer_session",
            "invalid_session_grant",
            "customer_session_limit"
          ],
          "resource": "customer_identity_binding",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "cib_example",
                "connection_id": "ic_example",
                "customer_id": "cust_example",
                "issuer": "https://identity.example",
                "suspended_at": null,
                "security_generation": 1,
                "provider_issued_at_cutoff": null,
                "created_at": "2026-09-21T12:00:00.000Z",
                "updated_at": "2026-09-21T12:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer_identity_bindings:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "customer_identity_bindings:read"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "connection_id": {
                      "type": "string"
                    },
                    "customer_id": {
                      "type": "string"
                    },
                    "issuer": {
                      "type": "string"
                    },
                    "suspended_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "security_generation": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "provider_issued_at_cutoff": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "connection_id",
                    "customer_id",
                    "issuer",
                    "suspended_at",
                    "security_generation",
                    "provider_issued_at_cutoff",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Suspend a binding or raise its provider proof cutoff",
        "tags": [
          "customer identity"
        ],
        "operationId": "patch_customer_identity_bindings_id",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "required",
            "responseEtag": true
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "invalid_cursor",
            "customer_surface_inactive",
            "invalid_customer_session",
            "invalid_session_grant",
            "customer_session_limit"
          ],
          "resource": "customer_identity_binding",
          "action": "update",
          "examples": {
            "request": {
              "suspended": true
            },
            "success": {
              "status": 200,
              "body": {
                "id": "cib_example",
                "connection_id": "ic_example",
                "customer_id": "cust_example",
                "issuer": "https://identity.example",
                "suspended_at": null,
                "security_generation": 1,
                "provider_issued_at_cutoff": null,
                "created_at": "2026-09-21T12:00:00.000Z",
                "updated_at": "2026-09-21T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"1\""
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 200,
              "body": {
                "id": "cib_example",
                "connection_id": "ic_example",
                "customer_id": "cust_example",
                "issuer": "https://identity.example",
                "suspended_at": null,
                "security_generation": 1,
                "provider_issued_at_cutoff": null,
                "created_at": "2026-09-21T12:00:00.000Z",
                "updated_at": "2026-09-21T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"1\"",
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "customer_identity"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer_identity_bindings:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "customer_identity_bindings:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Required revision, checked in the owning transaction."
            },
            "required": true,
            "description": "Required revision, checked in the owning transaction."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "suspended": true
              },
              "schema": {
                "type": "object",
                "properties": {
                  "suspended": {
                    "type": "boolean"
                  },
                  "provider_issued_at_cutoff": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  }
                },
                "required": [
                  "suspended"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "connection_id": {
                      "type": "string"
                    },
                    "customer_id": {
                      "type": "string"
                    },
                    "issuer": {
                      "type": "string"
                    },
                    "suspended_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "security_generation": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "provider_issued_at_cutoff": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "connection_id",
                    "customer_id",
                    "issuer",
                    "suspended_at",
                    "security_generation",
                    "provider_issued_at_cutoff",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{id}/session_revocations": {
      "post": {
        "summary": "Revoke every customer session by advancing its authentication epoch",
        "tags": [
          "customer identity"
        ],
        "operationId": "post_customers_id_session_revocations",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "invalid_cursor",
            "customer_surface_inactive",
            "invalid_customer_session",
            "invalid_session_grant",
            "customer_session_limit"
          ],
          "resource": "customer_session",
          "action": "transition",
          "examples": {
            "request": {},
            "success": {
              "status": 200,
              "body": {
                "customer_id": "cust_example",
                "auth_epoch": 1
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 200,
              "body": {
                "customer_id": "cust_example",
                "auth_epoch": 1
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": true,
            "effectFamilies": [
              "customer_identity"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer_sessions:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "customer_sessions:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {},
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "customer_id": {
                      "type": "string"
                    },
                    "auth_epoch": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "customer_id",
                    "auth_epoch"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer_sessions": {
      "post": {
        "summary": "Exchange provider proof, backend authority or anonymous admission for a customer session",
        "tags": [
          "customer sessions"
        ],
        "operationId": "post_customer_sessions",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "invalid_cursor",
            "invalid_customer_session",
            "invalid_session_grant",
            "customer_session_limit"
          ],
          "replayRedaction": [
            "customer_token"
          ],
          "customerSurface": true,
          "resource": "customer_session",
          "action": "create",
          "examples": {
            "request": {
              "grant_type": "anonymous",
              "capabilities": [
                "customer:read"
              ]
            },
            "success": {
              "status": 201,
              "body": {
                "customer_token": "ocs_example_not_a_credential",
                "customer_id": "cust_example",
                "session_id": "cs_example",
                "family_id": "csf_example",
                "assurance": "anonymous",
                "capabilities": [
                  "customer:read"
                ],
                "expires_at": "2026-09-21T12:00:00.000Z",
                "test_mode": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "customer_token": null,
                "customer_id": null,
                "session_id": null,
                "family_id": null,
                "assurance": "anonymous",
                "capabilities": [
                  "customer:read"
                ],
                "expires_at": "2026-09-21T12:00:00.000Z",
                "test_mode": false
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": [
              "customer_identity"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "publishable_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer_sessions:exchange"
            ]
          },
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer_sessions:write"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": []
          },
          {
            "secretKey": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "grant_type": "anonymous",
                "capabilities": [
                  "customer:read"
                ]
              },
              "schema": {
                "oneOf": [
                  {
                    "type": "object",
                    "properties": {
                      "grant_type": {
                        "type": "string",
                        "const": "identity_token"
                      },
                      "connection_id": {
                        "type": "string",
                        "minLength": 1
                      },
                      "provider_token": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 16384
                      },
                      "capabilities": {
                        "maxItems": 3,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "customer:read",
                            "customer:write",
                            "events:write_client"
                          ]
                        }
                      },
                      "lifetime_seconds": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 3600
                      }
                    },
                    "required": [
                      "grant_type",
                      "connection_id",
                      "provider_token"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "grant_type": {
                        "type": "string",
                        "const": "secret_key"
                      },
                      "customer_id": {
                        "type": "string",
                        "format": "starts_with",
                        "pattern": "^cust_.*"
                      },
                      "capabilities": {
                        "maxItems": 3,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "customer:read",
                            "customer:write",
                            "events:write_client"
                          ]
                        }
                      },
                      "lifetime_seconds": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 3600
                      }
                    },
                    "required": [
                      "grant_type",
                      "customer_id"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "grant_type": {
                        "type": "string",
                        "const": "anonymous"
                      },
                      "capabilities": {
                        "maxItems": 3,
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "customer:read",
                            "customer:write",
                            "events:write_client"
                          ]
                        }
                      },
                      "lifetime_seconds": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 3600
                      }
                    },
                    "required": [
                      "grant_type"
                    ],
                    "additionalProperties": false
                  }
                ],
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Idempotent-Replay-Redacted": {
                "schema": {
                  "type": "string"
                },
                "description": "Fields withheld from replay: customer_token."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "customer_token": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "customer_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "session_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "family_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "assurance": {
                      "type": "string",
                      "enum": [
                        "anonymous",
                        "authenticated_customer"
                      ]
                    },
                    "capabilities": {
                      "maxItems": 3,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "customer:read",
                          "customer:write",
                          "events:write_client"
                        ]
                      }
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "test_mode": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "customer_token",
                    "customer_id",
                    "session_id",
                    "family_id",
                    "assurance",
                    "capabilities",
                    "expires_at",
                    "test_mode"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/session_renewals": {
      "post": {
        "summary": "Renew a live session within its original authority and family lifetime",
        "tags": [
          "customer sessions"
        ],
        "operationId": "post_customer_session_renewals",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "invalid_cursor",
            "invalid_session_grant",
            "customer_session_limit",
            "portal_version_stale"
          ],
          "replayRedaction": [
            "customer_token"
          ],
          "customerSurface": true,
          "resource": "customer_session",
          "action": "create",
          "examples": {
            "request": {},
            "success": {
              "status": 201,
              "body": {
                "customer_token": "ocs_example_not_a_credential",
                "customer_id": "cust_example",
                "session_id": "cs_example",
                "family_id": "csf_example",
                "assurance": "anonymous",
                "capabilities": [
                  "customer:read"
                ],
                "expires_at": "2026-09-21T12:00:00.000Z",
                "test_mode": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "customer_token": null,
                "customer_id": "cust_example",
                "session_id": "cs_example",
                "family_id": "csf_example",
                "assurance": "anonymous",
                "capabilities": [
                  "customer:read"
                ],
                "expires_at": "2026-09-21T12:00:00.000Z",
                "test_mode": false
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": [
              "customer_identity"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer_sessions:exchange"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {},
              "schema": {
                "type": "object",
                "properties": {
                  "capabilities": {
                    "maxItems": 3,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "customer:read",
                        "customer:write",
                        "events:write_client"
                      ]
                    }
                  },
                  "lifetime_seconds": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 3600
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Idempotent-Replay-Redacted": {
                "schema": {
                  "type": "string"
                },
                "description": "Fields withheld from replay: customer_token."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "customer_token": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "customer_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "session_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "family_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "assurance": {
                      "type": "string",
                      "enum": [
                        "anonymous",
                        "authenticated_customer"
                      ]
                    },
                    "capabilities": {
                      "maxItems": 3,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "customer:read",
                          "customer:write",
                          "events:write_client"
                        ]
                      }
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "test_mode": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "customer_token",
                    "customer_id",
                    "session_id",
                    "family_id",
                    "assurance",
                    "capabilities",
                    "expires_at",
                    "test_mode"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/embed_sessions": {
      "post": {
        "summary": "Exchange the parent page session for a short-lived portal-bound embed session (portal origin only)",
        "tags": [
          "customer sessions"
        ],
        "operationId": "post_customer_embed_sessions",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "invalid_cursor",
            "invalid_session_grant",
            "customer_session_limit",
            "portal_unavailable",
            "portal_version_stale"
          ],
          "replayRedaction": [
            "customer_token"
          ],
          "customerSurface": true,
          "resource": "customer_session",
          "action": "create",
          "examples": {
            "request": {
              "portal_id": "ptl_00000000000000000000000000000000",
              "version_id": "ptv_00000000000000000000000000000000",
              "acquisition_id": "acq_exampleexample01"
            },
            "success": {
              "status": 201,
              "body": {
                "customer_token": "oce_example_not_a_credential",
                "customer_id": "cust_example",
                "session_id": "cs_example",
                "family_id": "csf_example",
                "assurance": "anonymous",
                "capabilities": [
                  "customer:read"
                ],
                "expires_at": "2026-09-21T12:00:00.000Z",
                "test_mode": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "customer_token": null,
                "customer_id": "cust_example",
                "session_id": "cs_example",
                "family_id": "csf_example",
                "assurance": "anonymous",
                "capabilities": [
                  "customer:read"
                ],
                "expires_at": "2026-09-21T12:00:00.000Z",
                "test_mode": false
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": [
              "customer_identity"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer_sessions:exchange"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "portal_id": "ptl_00000000000000000000000000000000",
                "version_id": "ptv_00000000000000000000000000000000",
                "acquisition_id": "acq_exampleexample01"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "portal_id": {
                    "type": "string",
                    "pattern": "^ptl_[0-9a-f]{32}$"
                  },
                  "version_id": {
                    "type": "string",
                    "pattern": "^ptv_[0-9a-f]{32}$"
                  },
                  "acquisition_id": {
                    "type": "string",
                    "pattern": "^acq_[A-Za-z0-9_-]{16,64}$"
                  },
                  "lifetime_seconds": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 3600
                  }
                },
                "required": [
                  "portal_id",
                  "version_id",
                  "acquisition_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Idempotent-Replay-Redacted": {
                "schema": {
                  "type": "string"
                },
                "description": "Fields withheld from replay: customer_token."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "customer_token": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "customer_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "session_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "family_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "assurance": {
                      "type": "string",
                      "enum": [
                        "anonymous",
                        "authenticated_customer"
                      ]
                    },
                    "capabilities": {
                      "maxItems": 3,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "customer:read",
                          "customer:write",
                          "events:write_client"
                        ]
                      }
                    },
                    "expires_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "test_mode": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "customer_token",
                    "customer_id",
                    "session_id",
                    "family_id",
                    "assurance",
                    "capabilities",
                    "expires_at",
                    "test_mode"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/embed_session_retirements": {
      "post": {
        "summary": "Revoke this family's embed sessions of one portal by acquisition id (portal origin only)",
        "tags": [
          "customer sessions"
        ],
        "operationId": "post_customer_embed_session_retirements",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "invalid_cursor",
            "invalid_session_grant",
            "customer_session_limit",
            "insufficient_scope",
            "portal_unavailable"
          ],
          "customerSurface": true,
          "resource": "customer_session",
          "action": "transition",
          "examples": {
            "request": {
              "portal_id": "ptl_00000000000000000000000000000000",
              "acquisition_ids": [
                "acq_exampleexample01"
              ]
            },
            "success": {
              "status": 200,
              "body": {
                "retired": 1
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 200,
              "body": {
                "retired": 1
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": [
              "customer_identity"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": []
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "portal_id": "ptl_00000000000000000000000000000000",
                "acquisition_ids": [
                  "acq_exampleexample01"
                ]
              },
              "schema": {
                "type": "object",
                "properties": {
                  "portal_id": {
                    "type": "string",
                    "pattern": "^ptl_[0-9a-f]{32}$"
                  },
                  "acquisition_ids": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "pattern": "^acq_[A-Za-z0-9_-]{16,64}$"
                    }
                  }
                },
                "required": [
                  "portal_id",
                  "acquisition_ids"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "retired": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 20
                    }
                  },
                  "required": [
                    "retired"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/session_revocations": {
      "post": {
        "summary": "Revoke this session",
        "tags": [
          "customer sessions"
        ],
        "operationId": "post_customer_session_revocations",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "invalid_cursor",
            "invalid_session_grant",
            "customer_session_limit",
            "insufficient_scope"
          ],
          "customerSurface": true,
          "resource": "customer_session",
          "action": "transition",
          "examples": {
            "request": {},
            "success": {
              "status": 204
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 204,
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": true,
            "effectFamilies": [
              "customer_identity"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": []
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {},
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No content",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/session_family_revocations": {
      "post": {
        "summary": "Revoke this session family",
        "tags": [
          "customer sessions"
        ],
        "operationId": "post_customer_session_family_revocations",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "invalid_cursor",
            "invalid_session_grant",
            "customer_session_limit",
            "insufficient_scope"
          ],
          "customerSurface": true,
          "resource": "customer_session",
          "action": "transition",
          "examples": {
            "request": {},
            "success": {
              "status": 204
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 204,
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": true,
            "effectFamilies": [
              "customer_identity"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": []
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {},
              "schema": {
                "type": "object",
                "properties": {},
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "204": {
            "description": "No content",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/merges": {
      "post": {
        "summary": "Merge a proven anonymous account into the current known customer",
        "tags": [
          "customer merges"
        ],
        "operationId": "post_customer_merges",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "merge_conflict",
            "merge_capacity_exceeded"
          ],
          "customerSurface": true,
          "resource": "customer_merge",
          "action": "create",
          "examples": {
            "request": {
              "source_customer_token": "ocs_example_not_a_credential"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "cmg_example",
                "source_customer_id": "cust_source",
                "target_customer_id": "cust_target",
                "membership_generation": "1"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "merge_conflict",
                  "message": "merge conflict",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#merge_conflict",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "cmg_example",
                "source_customer_id": "cust_source",
                "target_customer_id": "cust_target",
                "membership_generation": "1"
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": true,
            "effectFamilies": [
              "customer_identity"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:write"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "source_customer_token": "ocs_example_not_a_credential"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "source_customer_token": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 4096
                  }
                },
                "required": [
                  "source_customer_token"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "source_customer_id": {
                      "type": "string"
                    },
                    "target_customer_id": {
                      "type": "string"
                    },
                    "membership_generation": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)$"
                    }
                  },
                  "required": [
                    "id",
                    "source_customer_id",
                    "target_customer_id",
                    "membership_generation"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer_merges": {
      "post": {
        "summary": "Merge an anonymous account using trusted backend authority",
        "tags": [
          "customer merges"
        ],
        "operationId": "post_customer_merges_backend",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "event_requires_secret_key",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "merge_conflict",
            "merge_capacity_exceeded",
            "customer_surface_inactive",
            "invalid_customer_session"
          ],
          "resource": "customer_merge",
          "action": "create",
          "examples": {
            "request": {
              "source_customer_id": "cust_source",
              "target_customer_id": "cust_target"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "cmg_example",
                "source_customer_id": "cust_source",
                "target_customer_id": "cust_target",
                "membership_generation": "1"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "merge_conflict",
                  "message": "merge conflict",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#merge_conflict",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "cmg_example",
                "source_customer_id": "cust_source",
                "target_customer_id": "cust_target",
                "membership_generation": "1"
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": true,
            "effectFamilies": [
              "customer_identity"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customers:merge"
            ]
          }
        ],
        "security": [
          {
            "secretKey": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "source_customer_id": "cust_source",
                "target_customer_id": "cust_target"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "source_customer_id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "target_customer_id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "source_customer_id",
                  "target_customer_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "source_customer_id": {
                      "type": "string"
                    },
                    "target_customer_id": {
                      "type": "string"
                    },
                    "membership_generation": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)$"
                    }
                  },
                  "required": [
                    "id",
                    "source_customer_id",
                    "target_customer_id",
                    "membership_generation"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/referral_claims": {
      "post": {
        "summary": "Claim a referral code",
        "tags": [
          "customer surface"
        ],
        "operationId": "post_customer_referral_claims",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "usage_allowance_exhausted",
            "free_allowance_exhausted",
            "live_requires_claim",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "capability_unavailable",
            "reward_unavailable",
            "insufficient_balance"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "create",
          "examples": {
            "request": {
              "code": "opaque-example"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "rfa_example",
                "program_id": "prg_example",
                "status": "attributed",
                "claimed_at": "2026-09-25T00:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "rfa_example",
                "program_id": "prg_example",
                "status": "attributed",
                "claimed_at": "2026-09-25T00:00:00.000Z"
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": [
              "customer_commands"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:write"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "code": "opaque-example"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  }
                },
                "required": [
                  "code"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "program_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "claimed_at": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "program_id",
                    "status",
                    "claimed_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/referral_codes": {
      "post": {
        "summary": "Create the signed-in customer's own referral share code",
        "tags": [
          "customer surface"
        ],
        "operationId": "post_customer_referral_codes",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "capability_unavailable",
            "reward_unavailable",
            "insufficient_balance"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "create",
          "examples": {
            "request": {
              "program_id": "prg_example"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "rfc_example",
                "program_id": "prg_example",
                "program_key": "refer_a_friend",
                "code": "opaque-example",
                "revoked": false,
                "created_at": "2026-09-25T00:00:00.000000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "rfc_example",
                "program_id": "prg_example",
                "program_key": "refer_a_friend",
                "code": "opaque-example",
                "revoked": false,
                "created_at": "2026-09-25T00:00:00.000000Z"
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": [
              "customer_commands"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:write"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "program_id": "prg_example"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "program_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "program_id": {
                      "type": "string"
                    },
                    "program_key": {
                      "type": "string",
                      "description": "The immutable program key, the same in every environment the program is promoted to."
                    },
                    "code": {
                      "type": "string"
                    },
                    "revoked": {
                      "type": "boolean"
                    },
                    "created_at": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "program_id",
                    "program_key",
                    "code",
                    "revoked",
                    "created_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "Read customer referral share codes",
        "tags": [
          "customer surface"
        ],
        "operationId": "get_customer_referral_codes",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "resource_not_found",
            "invalid_cursor",
            "concurrent_update"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 100
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "state_revision": "1",
                "as_of": "2026-09-22T12:00:00.000Z",
                "availability": "unavailable",
                "data": [],
                "next_cursor": null,
                "has_more": false,
                "reason": "mechanic_not_implemented"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:read"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string",
              "maxLength": 35,
              "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
            }
          },
          {
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304.",
              "type": "string"
            },
            "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "state_revision": {
                          "type": "string",
                          "pattern": "^\\d+$"
                        },
                        "as_of": {
                          "type": "string"
                        },
                        "availability": {
                          "type": "string",
                          "enum": [
                            "available",
                            "hidden",
                            "off"
                          ]
                        },
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "program_id": {
                                "type": "string"
                              },
                              "program_key": {
                                "type": "string",
                                "description": "The immutable program key, the same in every environment the program is promoted to."
                              },
                              "code": {
                                "type": "string"
                              },
                              "revoked": {
                                "type": "boolean"
                              },
                              "created_at": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "program_id",
                              "program_key",
                              "code",
                              "revoked",
                              "created_at"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "next_cursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "has_more": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "state_revision",
                        "as_of",
                        "availability",
                        "data",
                        "next_cursor",
                        "has_more"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "state_revision": {
                          "type": "string",
                          "pattern": "^\\d+$"
                        },
                        "as_of": {
                          "type": "string"
                        },
                        "availability": {
                          "type": "string",
                          "const": "unavailable"
                        },
                        "reason": {
                          "type": "string",
                          "const": "mechanic_not_implemented"
                        },
                        "data": {
                          "minItems": 0,
                          "maxItems": 0,
                          "type": "array",
                          "items": {
                            "not": {}
                          }
                        },
                        "next_cursor": {
                          "type": "null"
                        },
                        "has_more": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "state_revision",
                        "as_of",
                        "availability",
                        "reason",
                        "data",
                        "next_cursor",
                        "has_more"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "304": {
            "description": "No content",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/leaderboard_profiles": {
      "post": {
        "summary": "Update a customer leaderboard profile",
        "tags": [
          "customer surface"
        ],
        "operationId": "post_customer_leaderboard_profiles",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "stale_write",
            "capability_unavailable",
            "reward_unavailable",
            "insufficient_balance"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "create",
          "examples": {
            "request": {
              "entry_id": "entry_example",
              "profile_revision": "1",
              "pseudonym": "Player_1",
              "visible": false
            },
            "success": {
              "status": 201,
              "body": {
                "entry_id": "entry_example",
                "profile_revision": "2",
                "pseudonym": "Player_1",
                "visible": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "entry_id": "entry_example",
                "profile_revision": "2",
                "pseudonym": "Player_1",
                "visible": false
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": [
              "customer_commands"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:write"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "entry_id": "entry_example",
                "profile_revision": "1",
                "pseudonym": "Player_1",
                "visible": false
              },
              "schema": {
                "type": "object",
                "properties": {
                  "entry_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "profile_revision": {
                    "type": "string",
                    "pattern": "^(0|[1-9][0-9]{0,18})$"
                  },
                  "pseudonym": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^[A-Za-z][A-Za-z0-9_-]{2,31}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "visible": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "entry_id",
                  "profile_revision",
                  "pseudonym",
                  "visible"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entry_id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 255
                    },
                    "profile_revision": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]{0,18})$"
                    },
                    "pseudonym": {
                      "anyOf": [
                        {
                          "type": "string",
                          "pattern": "^[A-Za-z][A-Za-z0-9_-]{2,31}$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "visible": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "entry_id",
                    "profile_revision",
                    "pseudonym",
                    "visible"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/leaderboards/{id}/boards/{board_id}/standings": {
      "get": {
        "summary": "Read customer leaderboard standings",
        "tags": [
          "customer surface"
        ],
        "operationId": "get_customer_leaderboards_id_boards_board_id_standings",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "resource_not_found",
            "invalid_cursor",
            "concurrent_update",
            "invalid_state",
            "capability_unavailable"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 100
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "state_revision": "1",
                "as_of": "2026-09-22T12:00:00.000Z",
                "availability": "available",
                "data": [],
                "next_cursor": null,
                "has_more": false,
                "own_rank": null,
                "revision_id": null
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:read"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "path",
            "name": "board_id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "mode",
            "schema": {
              "default": "live",
              "type": "string",
              "enum": [
                "live",
                "frozen"
              ]
            }
          },
          {
            "in": "query",
            "name": "revision_id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            }
          },
          {
            "in": "query",
            "name": "neighbors",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 49
            }
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string",
              "maxLength": 35,
              "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
            }
          },
          {
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304.",
              "type": "string"
            },
            "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entry_id": {
                            "type": "string"
                          },
                          "pseudonym": {
                            "type": "string",
                            "pattern": "^[A-Za-z][A-Za-z0-9_-]{2,31}$"
                          },
                          "ordinal": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,18})$"
                          },
                          "score": {
                            "type": "string",
                            "pattern": "^(0|-?[1-9][0-9]{0,18})$"
                          }
                        },
                        "required": [
                          "entry_id",
                          "pseudonym",
                          "ordinal",
                          "score"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "own_rank": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "ordinal": {
                              "type": "string",
                              "pattern": "^(0|[1-9][0-9]{0,18})$"
                            },
                            "score": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "ordinal",
                            "score"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "revision_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "state_revision": {
                      "type": "string",
                      "pattern": "^\\d+$"
                    },
                    "as_of": {
                      "type": "string"
                    },
                    "availability": {
                      "type": "string",
                      "const": "available"
                    }
                  },
                  "required": [
                    "data",
                    "own_rank",
                    "revision_id",
                    "next_cursor",
                    "has_more",
                    "state_revision",
                    "as_of",
                    "availability"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "304": {
            "description": "No content",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/quest_claims": {
      "post": {
        "summary": "Claim a qualified quest",
        "tags": [
          "customer surface"
        ],
        "operationId": "post_customer_quest_claims",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "usage_allowance_exhausted",
            "free_allowance_exhausted",
            "live_requires_claim",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "stale_write",
            "capability_unavailable",
            "reward_unavailable",
            "insufficient_balance"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "create",
          "examples": {
            "request": {
              "program_id": "prg_reader",
              "program_version_id": "pv_reader",
              "run_id": "qrun_reader"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "qclaim_reader",
                "program_id": "prg_reader",
                "program_version_id": "pv_reader",
                "run_id": "qrun_reader",
                "participation_id": "pp_reader",
                "participation_revision": "4",
                "status": "claimed"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "qclaim_reader",
                "program_id": "prg_reader",
                "program_version_id": "pv_reader",
                "run_id": "qrun_reader",
                "participation_id": "pp_reader",
                "participation_revision": "4",
                "status": "claimed"
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": [
              "customer_commands"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:write"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "program_id": "prg_reader",
                "program_version_id": "pv_reader",
                "run_id": "qrun_reader"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "program_id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "program_version_id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "run_id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "program_id",
                  "program_version_id",
                  "run_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "program_id": {
                      "type": "string"
                    },
                    "program_version_id": {
                      "type": "string"
                    },
                    "run_id": {
                      "type": "string"
                    },
                    "participation_id": {
                      "type": "string"
                    },
                    "participation_revision": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]*)$"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "claimed",
                        "pending"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "program_id",
                    "program_version_id",
                    "run_id",
                    "participation_id",
                    "participation_revision",
                    "status"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/streaks/freeze_purchases": {
      "post": {
        "summary": "Purchase streak freezes",
        "tags": [
          "customer surface"
        ],
        "operationId": "post_customer_streaks_freeze_purchases",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "usage_allowance_exhausted",
            "free_allowance_exhausted",
            "live_requires_claim",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "capability_unavailable",
            "reward_unavailable",
            "insufficient_balance"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "create",
          "examples": {
            "request": {
              "program_id": "prg_daily",
              "program_version_id": "pv_daily",
              "quantity": 1
            },
            "success": {
              "status": 201,
              "body": {
                "id": "sfr_purchase",
                "program_id": "prg_daily",
                "program_version_id": "pv_daily",
                "purchase_id": "sfr_purchase",
                "status": "purchased",
                "quantity": 1,
                "freezes": 1,
                "cost": {
                  "currency_id": "cur_points",
                  "amount": "2"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "sfr_purchase",
                "program_id": "prg_daily",
                "program_version_id": "pv_daily",
                "purchase_id": "sfr_purchase",
                "status": "purchased",
                "quantity": 1,
                "freezes": 1,
                "cost": {
                  "currency_id": "cur_points",
                  "amount": "2"
                }
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": [
              "customer_commands"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:write"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "program_id": "prg_daily",
                "program_version_id": "pv_daily",
                "quantity": 1
              },
              "schema": {
                "type": "object",
                "properties": {
                  "program_id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "program_version_id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 1000
                  }
                },
                "required": [
                  "program_id",
                  "program_version_id",
                  "quantity"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "program_id": {
                      "type": "string"
                    },
                    "program_version_id": {
                      "type": "string"
                    },
                    "purchase_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "purchased",
                        "cancelled"
                      ]
                    },
                    "quantity": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 1000
                    },
                    "freezes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1000
                    },
                    "cost": {
                      "type": "object",
                      "properties": {
                        "currency_id": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "string",
                          "pattern": "^\\d+$"
                        }
                      },
                      "required": [
                        "currency_id",
                        "amount"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "program_id",
                    "program_version_id",
                    "purchase_id",
                    "status",
                    "quantity",
                    "freezes",
                    "cost"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/streaks/freeze_cancellations": {
      "post": {
        "summary": "Cancel an unconsumed freeze purchase",
        "tags": [
          "customer surface"
        ],
        "operationId": "post_customer_streaks_freeze_cancellations",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "capability_unavailable",
            "reward_unavailable",
            "insufficient_balance"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "create",
          "examples": {
            "request": {
              "program_id": "prg_daily",
              "program_version_id": "pv_daily",
              "purchase_id": "sfr_purchase"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "sfr_cancel",
                "program_id": "prg_daily",
                "program_version_id": "pv_daily",
                "purchase_id": "sfr_purchase",
                "status": "cancelled",
                "quantity": 1,
                "freezes": 0,
                "cost": {
                  "currency_id": "cur_points",
                  "amount": "2"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "sfr_cancel",
                "program_id": "prg_daily",
                "program_version_id": "pv_daily",
                "purchase_id": "sfr_purchase",
                "status": "cancelled",
                "quantity": 1,
                "freezes": 0,
                "cost": {
                  "currency_id": "cur_points",
                  "amount": "2"
                }
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": [
              "customer_commands"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:write"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "program_id": "prg_daily",
                "program_version_id": "pv_daily",
                "purchase_id": "sfr_purchase"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "program_id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "program_version_id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "purchase_id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "program_id",
                  "program_version_id",
                  "purchase_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "program_id": {
                      "type": "string"
                    },
                    "program_version_id": {
                      "type": "string"
                    },
                    "purchase_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "purchased",
                        "cancelled"
                      ]
                    },
                    "quantity": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 1000
                    },
                    "freezes": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1000
                    },
                    "cost": {
                      "type": "object",
                      "properties": {
                        "currency_id": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "string",
                          "pattern": "^\\d+$"
                        }
                      },
                      "required": [
                        "currency_id",
                        "amount"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "program_id",
                    "program_version_id",
                    "purchase_id",
                    "status",
                    "quantity",
                    "freezes",
                    "cost"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/streaks/repairs": {
      "post": {
        "summary": "Repair a broken streak",
        "tags": [
          "customer surface"
        ],
        "operationId": "post_customer_streaks_repairs",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "usage_allowance_exhausted",
            "free_allowance_exhausted",
            "live_requires_claim",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "capability_unavailable",
            "reward_unavailable",
            "insufficient_balance",
            "streak_repair_unavailable",
            "streak_repair_limit_reached"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "create",
          "examples": {
            "request": {
              "program_id": "prg_daily",
              "program_version_id": "pv_daily"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "pc_repair",
                "program_id": "prg_daily",
                "program_version_id": "pv_daily",
                "status": "repaired",
                "current": "12",
                "restored_length": "11",
                "repaired_periods": 1,
                "cost": {
                  "currency_id": "cur_gems",
                  "amount": "50"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "pc_repair",
                "program_id": "prg_daily",
                "program_version_id": "pv_daily",
                "status": "repaired",
                "current": "12",
                "restored_length": "11",
                "repaired_periods": 1,
                "cost": {
                  "currency_id": "cur_gems",
                  "amount": "50"
                }
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": [
              "customer_commands"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:write"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "program_id": "prg_daily",
                "program_version_id": "pv_daily"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "program_id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "program_version_id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "program_id",
                  "program_version_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "program_id": {
                      "type": "string"
                    },
                    "program_version_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "const": "repaired"
                    },
                    "current": {
                      "type": "string",
                      "pattern": "^\\d+$"
                    },
                    "restored_length": {
                      "type": "string",
                      "pattern": "^\\d+$"
                    },
                    "repaired_periods": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 366
                    },
                    "cost": {
                      "type": "object",
                      "properties": {
                        "currency_id": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "string",
                          "pattern": "^\\d+$"
                        }
                      },
                      "required": [
                        "currency_id",
                        "amount"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "program_id",
                    "program_version_id",
                    "status",
                    "current",
                    "restored_length",
                    "repaired_periods",
                    "cost"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/events": {
      "post": {
        "summary": "Admit customer events",
        "tags": [
          "customer surface"
        ],
        "operationId": "post_customer_events",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "usage_allowance_exhausted",
            "free_allowance_exhausted",
            "live_requires_claim",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "capability_unavailable",
            "event_id_conflict",
            "event_requires_secret_key",
            "batch_too_large",
            "body_too_large",
            "event_too_large",
            "occurred_at_in_future",
            "trust_insufficient",
            "source_time_untrusted",
            "quota_exceeded",
            "insufficient_balance"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "create",
          "examples": {
            "request": {
              "id": "visit_123",
              "name": "visit"
            },
            "success": {
              "status": 202,
              "body": {
                "results": [
                  {
                    "id": "visit_123",
                    "status": "pending",
                    "receipt_url": "/v1/customer/event_receipts/visit_123",
                    "effects": {
                      "currency_deltas": [],
                      "quest_progress": []
                    },
                    "pending_followups": true
                  }
                ]
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 202,
              "body": {
                "results": [
                  {
                    "id": "visit_123",
                    "status": "pending",
                    "receipt_url": "/v1/customer/event_receipts/visit_123",
                    "effects": {
                      "currency_deltas": [],
                      "quest_progress": []
                    },
                    "pending_followups": true
                  }
                ]
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            },
            "pending": {
              "status": 202,
              "body": {
                "results": [
                  {
                    "id": "visit_123",
                    "status": "pending",
                    "receipt_url": "/v1/customer/event_receipts/visit_123",
                    "effects": {
                      "currency_deltas": [],
                      "quest_progress": []
                    },
                    "pending_followups": true
                  }
                ]
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": [
              "customer_commands"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "events:write_client"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "id": "visit_123",
                "name": "visit"
              },
              "schema": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 255
                      },
                      "name": {
                        "type": "string",
                        "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                      },
                      "properties": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "$ref": "#/components/schemas/__schema4"
                        }
                      },
                      "occurred_at": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                      }
                    },
                    "required": [
                      "id",
                      "name"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "events": {
                        "minItems": 1,
                        "maxItems": 25,
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 255
                            },
                            "name": {
                              "type": "string",
                              "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                            },
                            "properties": {
                              "type": "object",
                              "propertyNames": {
                                "type": "string"
                              },
                              "additionalProperties": {
                                "$ref": "#/components/schemas/__schema4"
                              }
                            },
                            "occurred_at": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                            }
                          },
                          "required": [
                            "id",
                            "name"
                          ],
                          "additionalProperties": false
                        }
                      }
                    },
                    "required": [
                      "events"
                    ],
                    "additionalProperties": false
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "results": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "evaluated"
                            ]
                          },
                          "receipt_url": {
                            "type": "string"
                          },
                          "effects": {
                            "type": "object",
                            "properties": {
                              "mechanic_changes": {
                                "maxItems": 128,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "type": {
                                      "type": "string",
                                      "enum": [
                                        "streak.progressed",
                                        "streak.extended",
                                        "streak.at_risk",
                                        "streak.broken",
                                        "streak.freeze_consumed",
                                        "streak.restored",
                                        "streak.milestone_reached",
                                        "tier.changed",
                                        "achievement.progressed",
                                        "badge.granted",
                                        "badge.revoked",
                                        "leaderboard.score_changed",
                                        "leaderboard.prize_settled",
                                        "referral.qualified",
                                        "referral.completed",
                                        "referral.reversed"
                                      ]
                                    },
                                    "program_id": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "program_id"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "coupons": {
                                "maxItems": 128,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "entitlement_id": {
                                      "type": "string"
                                    },
                                    "offer_version_id": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "entitlement_id",
                                    "offer_version_id"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "discounts": {
                                "maxItems": 128,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "quote_id": {
                                      "type": "string"
                                    },
                                    "offer_version_id": {
                                      "type": "string"
                                    },
                                    "currency": {
                                      "type": "string"
                                    },
                                    "subtotal_minor": {
                                      "type": "string",
                                      "pattern": "^(0|[1-9][0-9]*)$"
                                    },
                                    "discount_minor": {
                                      "type": "string",
                                      "pattern": "^(0|[1-9][0-9]*)$"
                                    },
                                    "total_minor": {
                                      "type": "string",
                                      "pattern": "^(0|[1-9][0-9]*)$"
                                    }
                                  },
                                  "required": [
                                    "quote_id",
                                    "offer_version_id",
                                    "currency",
                                    "subtotal_minor",
                                    "discount_minor",
                                    "total_minor"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "graph_quest_progress": {
                                "maxItems": 128,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "program_id": {
                                      "type": "string"
                                    },
                                    "participation_id": {
                                      "type": "string"
                                    },
                                    "run_id": {
                                      "type": "string"
                                    },
                                    "status": {
                                      "type": "string",
                                      "enum": [
                                        "enrolled",
                                        "active",
                                        "qualified",
                                        "claimable",
                                        "completed",
                                        "claimed",
                                        "expired",
                                        "corrected"
                                      ]
                                    },
                                    "steps": {
                                      "maxItems": 32,
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "key": {
                                            "type": "string"
                                          },
                                          "progress": {
                                            "type": "string",
                                            "pattern": "^(0|[1-9][0-9]*)$"
                                          },
                                          "completed": {
                                            "type": "boolean"
                                          }
                                        },
                                        "required": [
                                          "key",
                                          "progress",
                                          "completed"
                                        ],
                                        "additionalProperties": false
                                      }
                                    }
                                  },
                                  "required": [
                                    "program_id",
                                    "participation_id",
                                    "run_id",
                                    "status",
                                    "steps"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "currency_deltas": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "currency_id": {
                                      "type": "string"
                                    },
                                    "amount": {
                                      "type": "string",
                                      "pattern": "^-?\\d+$"
                                    }
                                  },
                                  "required": [
                                    "currency_id",
                                    "amount"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "quest_progress": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "program_id": {
                                      "type": "string"
                                    },
                                    "participation_id": {
                                      "type": "string"
                                    },
                                    "progress": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    "target": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    },
                                    "completed": {
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "program_id",
                                    "participation_id",
                                    "progress",
                                    "target",
                                    "completed"
                                  ],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "currency_deltas",
                              "quest_progress"
                            ],
                            "additionalProperties": false
                          },
                          "pending_followups": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "receipt_url",
                          "effects",
                          "pending_followups"
                        ],
                        "additionalProperties": false
                      }
                    }
                  },
                  "required": [
                    "results"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/program_enrollments": {
      "post": {
        "summary": "Enroll in an available customer quest",
        "tags": [
          "customer surface"
        ],
        "operationId": "post_customer_program_enrollments",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "required",
            "responseEtag": true
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "usage_allowance_exhausted",
            "free_allowance_exhausted",
            "live_requires_claim",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "capability_unavailable",
            "reward_unavailable",
            "insufficient_balance"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "create",
          "examples": {
            "request": {
              "program_id": "pg_example"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "pc_example",
                "program_id": "pg_example",
                "participation_id": "pp_example",
                "program_version_id": "pv_example",
                "program_revision": 1,
                "participation_revision": "1",
                "status": "enrolled"
              },
              "headers": {
                "ETag": "\"1\""
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "pc_example",
                "program_id": "pg_example",
                "participation_id": "pp_example",
                "program_version_id": "pv_example",
                "program_revision": 1,
                "participation_revision": "1",
                "status": "enrolled"
              },
              "headers": {
                "ETag": "\"1\"",
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": [
              "customer_commands"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:write"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Required revision, checked in the owning transaction."
            },
            "required": true,
            "description": "Required revision, checked in the owning transaction."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "program_id": "pg_example"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "program_id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "program_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "program_id": {
                      "type": "string"
                    },
                    "participation_id": {
                      "type": "string"
                    },
                    "program_version_id": {
                      "type": "string"
                    },
                    "program_revision": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "participation_revision": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "const": "enrolled"
                    }
                  },
                  "required": [
                    "id",
                    "program_id",
                    "participation_id",
                    "program_version_id",
                    "program_revision",
                    "participation_revision",
                    "status"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/redemptions": {
      "post": {
        "summary": "Redeem an owned reward issuance",
        "tags": [
          "customer surface"
        ],
        "operationId": "post_customer_redemptions",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "usage_allowance_exhausted",
            "free_allowance_exhausted",
            "live_requires_claim",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state",
            "concurrent_update",
            "capability_unavailable",
            "reward_unavailable",
            "insufficient_balance"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "create",
          "examples": {
            "request": {
              "reward_issuance_id": "ri_example"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "ri_example",
                "reward_issuance_id": "ri_example",
                "status": "redeemed",
                "redeemed_at": "2026-09-22T12:00:00.000Z",
                "cost": {
                  "currency_id": null,
                  "amount": "0"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "ri_example",
                "reward_issuance_id": "ri_example",
                "status": "redeemed",
                "redeemed_at": "2026-09-22T12:00:00.000Z",
                "cost": {
                  "currency_id": null,
                  "amount": "0"
                }
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": [
              "customer_commands"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:write"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "reward_issuance_id": "ri_example"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "reward_issuance_id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "reward_issuance_id"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "reward_issuance_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "const": "redeemed"
                    },
                    "redeemed_at": {
                      "type": "string"
                    },
                    "cost": {
                      "type": "object",
                      "properties": {
                        "currency_id": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "amount": {
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "currency_id",
                        "amount"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "reward_issuance_id",
                    "status",
                    "redeemed_at",
                    "cost"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "List customer redemptions",
        "tags": [
          "customer surface"
        ],
        "operationId": "get_customer_redemptions",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "resource_not_found",
            "invalid_cursor",
            "concurrent_update"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "state_revision": "1",
                "as_of": "2026-09-22T12:00:00.000Z",
                "availability": "available",
                "data": [],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:read"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string",
              "maxLength": 35,
              "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
            }
          },
          {
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304.",
              "type": "string"
            },
            "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "state_revision": {
                      "type": "string",
                      "pattern": "^\\d+$"
                    },
                    "as_of": {
                      "type": "string"
                    },
                    "availability": {
                      "type": "string",
                      "enum": [
                        "available",
                        "hidden",
                        "off"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "reward_issuance_id": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "const": "redeemed"
                          },
                          "redeemed_at": {
                            "type": "string"
                          },
                          "cost": {
                            "type": "object",
                            "properties": {
                              "currency_id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "amount": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "currency_id",
                              "amount"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "id",
                          "reward_issuance_id",
                          "status",
                          "redeemed_at",
                          "cost"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "state_revision",
                    "as_of",
                    "availability",
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "304": {
            "description": "No content",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/state": {
      "get": {
        "summary": "Read current customer state",
        "tags": [
          "customer surface"
        ],
        "operationId": "get_customer_state",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "resource_not_found",
            "invalid_cursor",
            "concurrent_update"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "state_revision": "1",
                "as_of": "2026-09-22T12:00:00.000Z",
                "pending_events": "0",
                "mechanics": {
                  "points": "available",
                  "quests": "available",
                  "rewards": "available"
                },
                "links": {
                  "balances": "/v1/customer/balances"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:read"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string",
              "maxLength": 35,
              "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
            }
          },
          {
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304.",
              "type": "string"
            },
            "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "state_revision": {
                      "type": "string",
                      "pattern": "^\\d+$"
                    },
                    "as_of": {
                      "type": "string"
                    },
                    "pending_events": {
                      "type": "string",
                      "pattern": "^\\d+$"
                    },
                    "mechanics": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string",
                        "enum": [
                          "available",
                          "hidden",
                          "off",
                          "unavailable"
                        ]
                      }
                    },
                    "links": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "state_revision",
                    "as_of",
                    "pending_events",
                    "mechanics",
                    "links"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "304": {
            "description": "No content",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/balances": {
      "get": {
        "summary": "List customer balances",
        "tags": [
          "customer surface"
        ],
        "operationId": "get_customer_balances",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "resource_not_found",
            "invalid_cursor",
            "concurrent_update"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "state_revision": "1",
                "as_of": "2026-09-22T12:00:00.000Z",
                "availability": "available",
                "data": [],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:read"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string",
              "maxLength": 35,
              "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
            }
          },
          {
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304.",
              "type": "string"
            },
            "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "state_revision": {
                      "type": "string",
                      "pattern": "^\\d+$"
                    },
                    "as_of": {
                      "type": "string"
                    },
                    "availability": {
                      "type": "string",
                      "enum": [
                        "available",
                        "hidden",
                        "off"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "currency": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "code": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "precision": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "id",
                              "code",
                              "name",
                              "precision"
                            ],
                            "additionalProperties": false
                          },
                          "available": {
                            "type": "string"
                          },
                          "pending": {
                            "type": "string"
                          },
                          "lifetime_earned": {
                            "type": "string"
                          },
                          "next_expiry": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "at": {
                                    "type": "string"
                                  },
                                  "amount": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "at",
                                  "amount"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "currency",
                          "available",
                          "pending",
                          "lifetime_earned",
                          "next_expiry"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "state_revision",
                    "as_of",
                    "availability",
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "304": {
            "description": "No content",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/tiers": {
      "get": {
        "summary": "List customer tiers",
        "tags": [
          "customer surface"
        ],
        "operationId": "get_customer_tiers",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "resource_not_found",
            "invalid_cursor",
            "concurrent_update"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "state_revision": "1",
                "as_of": "2026-09-22T12:00:00.000Z",
                "availability": "available",
                "data": [],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:read"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string",
              "maxLength": 35,
              "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
            }
          },
          {
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304.",
              "type": "string"
            },
            "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "state_revision": {
                      "type": "string",
                      "pattern": "^\\d+$"
                    },
                    "as_of": {
                      "type": "string"
                    },
                    "availability": {
                      "type": "string",
                      "enum": [
                        "available",
                        "hidden",
                        "off"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "program_id": {
                            "type": "string"
                          },
                          "program_name": {
                            "type": "string"
                          },
                          "level": {
                            "type": "string"
                          },
                          "since": {
                            "type": "string"
                          },
                          "qualifies_until": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "grace_until": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "benefits": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "key": {
                                  "type": "string"
                                },
                                "title": {
                                  "type": "string"
                                },
                                "description": {
                                  "type": "string"
                                },
                                "icon": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "key",
                                "title"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "next_level": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "threshold": {
                                    "type": "string",
                                    "pattern": "^\\d+$"
                                  },
                                  "benefits": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string"
                                        },
                                        "title": {
                                          "type": "string"
                                        },
                                        "description": {
                                          "type": "string"
                                        },
                                        "icon": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "title"
                                      ],
                                      "additionalProperties": false
                                    }
                                  }
                                },
                                "required": [
                                  "name",
                                  "threshold",
                                  "benefits"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "program_id",
                          "program_name",
                          "level",
                          "since",
                          "qualifies_until",
                          "grace_until",
                          "benefits",
                          "next_level"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "state_revision",
                    "as_of",
                    "availability",
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "304": {
            "description": "No content",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/quests": {
      "get": {
        "summary": "List customer quests",
        "tags": [
          "customer surface"
        ],
        "operationId": "get_customer_quests",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "resource_not_found",
            "invalid_cursor",
            "concurrent_update"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "state_revision": "1",
                "as_of": "2026-09-22T12:00:00.000Z",
                "availability": "available",
                "data": [],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:read"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string",
              "maxLength": 35,
              "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
            }
          },
          {
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304.",
              "type": "string"
            },
            "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "state_revision": {
                      "type": "string",
                      "pattern": "^\\d+$"
                    },
                    "as_of": {
                      "type": "string"
                    },
                    "availability": {
                      "type": "string",
                      "enum": [
                        "available",
                        "hidden",
                        "off"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "run",
                                  "available"
                                ]
                              },
                              "program": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "mechanic": {
                                    "type": "string"
                                  },
                                  "title": {
                                    "type": "string"
                                  },
                                  "description": {
                                    "type": "string"
                                  },
                                  "image_url": {
                                    "type": "string"
                                  },
                                  "icon": {
                                    "type": "string"
                                  },
                                  "color": {
                                    "type": "string"
                                  },
                                  "terminology": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "singular": {
                                            "type": "string"
                                          },
                                          "plural": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "singular",
                                          "plural"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "mechanic",
                                  "terminology"
                                ],
                                "additionalProperties": false
                              },
                              "program_key": {
                                "type": "string",
                                "description": "The immutable program key, the same in every environment the program is promoted to."
                              },
                              "program_version_id": {
                                "type": "string"
                              },
                              "program_revision": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "participation_revision": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "status": {
                                "type": "string"
                              },
                              "progress": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "target": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "enrollable": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "kind",
                              "program",
                              "program_key",
                              "program_version_id",
                              "program_revision",
                              "participation_revision",
                              "status",
                              "progress",
                              "target",
                              "enrollable"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "kind": {
                                "type": "string",
                                "const": "graph"
                              },
                              "program": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "mechanic": {
                                    "type": "string"
                                  },
                                  "title": {
                                    "type": "string"
                                  },
                                  "description": {
                                    "type": "string"
                                  },
                                  "image_url": {
                                    "type": "string"
                                  },
                                  "icon": {
                                    "type": "string"
                                  },
                                  "color": {
                                    "type": "string"
                                  },
                                  "terminology": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "singular": {
                                            "type": "string"
                                          },
                                          "plural": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "singular",
                                          "plural"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "mechanic",
                                  "terminology"
                                ],
                                "additionalProperties": false
                              },
                              "program_key": {
                                "type": "string",
                                "description": "The immutable program key, the same in every environment the program is promoted to."
                              },
                              "program_version_id": {
                                "type": "string"
                              },
                              "program_revision": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "participation_revision": {
                                "type": "string"
                              },
                              "enrollable": {
                                "type": "boolean",
                                "const": false
                              },
                              "run": {
                                "type": "string"
                              },
                              "run_id": {
                                "type": "string"
                              },
                              "participation_id": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "enrolled",
                                  "active",
                                  "qualified",
                                  "claimable",
                                  "completed",
                                  "claimed",
                                  "expired",
                                  "corrected"
                                ]
                              },
                              "revision": {
                                "type": "string",
                                "pattern": "^(0|[1-9][0-9]*)$"
                              },
                              "steps": {
                                "maxItems": 32,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "key": {
                                      "type": "string"
                                    },
                                    "display": {
                                      "type": "object",
                                      "properties": {
                                        "title": {
                                          "type": "string"
                                        },
                                        "description": {
                                          "type": "string"
                                        }
                                      },
                                      "additionalProperties": false
                                    },
                                    "target": {
                                      "type": "string",
                                      "pattern": "^[1-9][0-9]*$"
                                    },
                                    "available_from": {
                                      "type": [
                                        "string",
                                        "null"
                                      ]
                                    },
                                    "deadline": {
                                      "type": [
                                        "string",
                                        "null"
                                      ]
                                    },
                                    "progress": {
                                      "type": "string",
                                      "pattern": "^(0|[1-9][0-9]*)$"
                                    },
                                    "remaining": {
                                      "type": "string",
                                      "pattern": "^(0|[1-9][0-9]*)$"
                                    },
                                    "status": {
                                      "type": "string",
                                      "enum": [
                                        "locked",
                                        "active",
                                        "completed",
                                        "corrected",
                                        "blocked"
                                      ]
                                    },
                                    "activated_at": {
                                      "type": [
                                        "string",
                                        "null"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "key",
                                    "display",
                                    "target",
                                    "available_from",
                                    "deadline",
                                    "progress",
                                    "remaining",
                                    "status",
                                    "activated_at"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "claimable": {
                                "type": "boolean"
                              },
                              "claim_deadline": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "pending_completion": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "kind",
                              "program",
                              "program_key",
                              "program_version_id",
                              "program_revision",
                              "participation_revision",
                              "enrollable",
                              "run",
                              "run_id",
                              "participation_id",
                              "status",
                              "revision",
                              "steps",
                              "claimable",
                              "claim_deadline",
                              "pending_completion"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "kind": {
                                "type": "string",
                                "const": "graph_available"
                              },
                              "program": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "mechanic": {
                                    "type": "string"
                                  },
                                  "title": {
                                    "type": "string"
                                  },
                                  "description": {
                                    "type": "string"
                                  },
                                  "image_url": {
                                    "type": "string"
                                  },
                                  "icon": {
                                    "type": "string"
                                  },
                                  "color": {
                                    "type": "string"
                                  },
                                  "terminology": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "singular": {
                                            "type": "string"
                                          },
                                          "plural": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "singular",
                                          "plural"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "mechanic",
                                  "terminology"
                                ],
                                "additionalProperties": false
                              },
                              "program_key": {
                                "type": "string",
                                "description": "The immutable program key, the same in every environment the program is promoted to."
                              },
                              "program_version_id": {
                                "type": "string"
                              },
                              "program_revision": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "participation_revision": {
                                "type": "null"
                              },
                              "enrollable": {
                                "type": "boolean",
                                "const": true
                              },
                              "steps": {
                                "maxItems": 32,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "key": {
                                      "type": "string"
                                    },
                                    "display": {
                                      "type": "object",
                                      "properties": {
                                        "title": {
                                          "type": "string"
                                        },
                                        "description": {
                                          "type": "string"
                                        }
                                      },
                                      "additionalProperties": false
                                    },
                                    "target": {
                                      "type": "string",
                                      "pattern": "^[1-9][0-9]*$"
                                    },
                                    "available_from": {
                                      "type": [
                                        "string",
                                        "null"
                                      ]
                                    },
                                    "deadline": {
                                      "type": [
                                        "string",
                                        "null"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "key",
                                    "display",
                                    "target",
                                    "available_from",
                                    "deadline"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "collection": {
                                "type": "string",
                                "enum": [
                                  "auto_collect",
                                  "claim"
                                ]
                              },
                              "claim_deadline": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "kind",
                              "program",
                              "program_key",
                              "program_version_id",
                              "program_revision",
                              "participation_revision",
                              "enrollable",
                              "steps",
                              "collection",
                              "claim_deadline"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "state_revision",
                    "as_of",
                    "availability",
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "304": {
            "description": "No content",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/activity": {
      "get": {
        "summary": "List customer activity",
        "tags": [
          "customer surface"
        ],
        "operationId": "get_customer_activity",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "resource_not_found",
            "invalid_cursor",
            "concurrent_update"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "state_revision": "1",
                "as_of": "2026-09-22T12:00:00.000Z",
                "availability": "available",
                "data": [],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:read"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string",
              "maxLength": 35,
              "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
            }
          },
          {
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304.",
              "type": "string"
            },
            "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "state_revision": {
                      "type": "string",
                      "pattern": "^\\d+$"
                    },
                    "as_of": {
                      "type": "string"
                    },
                    "availability": {
                      "type": "string",
                      "enum": [
                        "available",
                        "hidden",
                        "off"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "streak.progressed",
                              "streak.extended",
                              "streak.at_risk",
                              "streak.broken",
                              "streak.freeze_consumed",
                              "streak.restored",
                              "streak.milestone_reached",
                              "tier.changed",
                              "achievement.progressed",
                              "badge.granted",
                              "badge.revoked",
                              "leaderboard.score_changed",
                              "leaderboard.prize_settled",
                              "referral.qualified",
                              "referral.completed",
                              "referral.reversed",
                              "commerce.redemption_created",
                              "commerce.fulfilled",
                              "commerce.reconciliation_required",
                              "commerce.cancelled",
                              "currency_change",
                              "quest.enrolled",
                              "quest.step_unlocked",
                              "quest.step_completed",
                              "quest.qualified",
                              "quest.claimable",
                              "quest.claimed",
                              "quest.expired",
                              "quest.corrected",
                              "quest.progressed",
                              "quest.completed"
                            ]
                          },
                          "at": {
                            "type": "string"
                          },
                          "currency_id": {
                            "type": "string"
                          },
                          "amount": {
                            "type": "string"
                          },
                          "program": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "mechanic": {
                                "type": "string"
                              },
                              "title": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string"
                              },
                              "image_url": {
                                "type": "string"
                              },
                              "icon": {
                                "type": "string"
                              },
                              "color": {
                                "type": "string"
                              },
                              "terminology": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "singular": {
                                        "type": "string"
                                      },
                                      "plural": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "singular",
                                      "plural"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "mechanic",
                              "terminology"
                            ],
                            "additionalProperties": false
                          },
                          "program_key": {
                            "type": "string",
                            "description": "The immutable program key, the same in every environment the program is promoted to."
                          }
                        },
                        "required": [
                          "id",
                          "type",
                          "at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "state_revision",
                    "as_of",
                    "availability",
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "304": {
            "description": "No content",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/reward_offers": {
      "get": {
        "summary": "List customer reward offers",
        "tags": [
          "customer surface"
        ],
        "operationId": "get_customer_reward_offers",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "resource_not_found",
            "invalid_cursor",
            "concurrent_update",
            "invalid_state",
            "capability_unavailable"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "state_revision": "1",
                "as_of": "2026-09-22T12:00:00.000Z",
                "availability": "available",
                "data": [
                  {
                    "id": "ri_example",
                    "kind": "issued_reward",
                    "program": {
                      "id": "reward_example",
                      "mechanic": "reward",
                      "title": "Reward",
                      "terminology": null
                    },
                    "cost": {
                      "currency_id": "cur_points",
                      "amount": "100"
                    },
                    "expires_at": null,
                    "status": "issued",
                    "redeemable": true,
                    "reason": null
                  },
                  {
                    "id": "roff_example",
                    "kind": "catalogue_offer",
                    "catalogue_id": "rcat_example",
                    "catalogue_key": "rewards",
                    "key": "book",
                    "version": 1,
                    "display": {
                      "title": "Book"
                    },
                    "cost": {
                      "currency_id": "cur_points",
                      "amount": "100"
                    },
                    "delivery": "manual",
                    "eligibility": {
                      "eligible": true,
                      "reason": null
                    }
                  }
                ],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:read"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string",
              "maxLength": 35,
              "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
            }
          },
          {
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304.",
              "type": "string"
            },
            "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "state_revision": {
                      "type": "string",
                      "pattern": "^\\d+$"
                    },
                    "as_of": {
                      "type": "string"
                    },
                    "availability": {
                      "type": "string",
                      "enum": [
                        "available",
                        "hidden",
                        "off"
                      ]
                    },
                    "data": {
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "kind": {
                                "type": "string",
                                "const": "issued_reward"
                              },
                              "program": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "mechanic": {
                                    "type": "string"
                                  },
                                  "title": {
                                    "type": "string"
                                  },
                                  "description": {
                                    "type": "string"
                                  },
                                  "image_url": {
                                    "type": "string"
                                  },
                                  "icon": {
                                    "type": "string"
                                  },
                                  "color": {
                                    "type": "string"
                                  },
                                  "terminology": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "singular": {
                                            "type": "string"
                                          },
                                          "plural": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "singular",
                                          "plural"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "mechanic",
                                  "terminology"
                                ],
                                "additionalProperties": false
                              },
                              "cost": {
                                "type": "object",
                                "properties": {
                                  "currency_id": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "amount": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  }
                                },
                                "required": [
                                  "currency_id",
                                  "amount"
                                ],
                                "additionalProperties": false
                              },
                              "expires_at": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "issued",
                                  "redeemed",
                                  "cancelled",
                                  "expired"
                                ]
                              },
                              "redeemable": {
                                "type": "boolean"
                              },
                              "reason": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "insufficient_points",
                                      "expired",
                                      "already_redeemed",
                                      "cancelled",
                                      "terms_unavailable"
                                    ]
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "kind",
                              "program",
                              "cost",
                              "expires_at",
                              "status",
                              "redeemable",
                              "reason"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 255
                              },
                              "kind": {
                                "type": "string",
                                "const": "catalogue_offer"
                              },
                              "catalogue_id": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 255
                              },
                              "catalogue_key": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                              },
                              "key": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                              },
                              "version": {
                                "type": "integer",
                                "exclusiveMinimum": 0,
                                "maximum": 9007199254740991
                              },
                              "display": {
                                "type": "object",
                                "properties": {
                                  "title": {
                                    "type": "string"
                                  },
                                  "description": {
                                    "type": "string"
                                  }
                                },
                                "additionalProperties": false
                              },
                              "cost": {
                                "type": "object",
                                "properties": {
                                  "currency_id": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 255
                                  },
                                  "amount": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]{0,18})$"
                                  }
                                },
                                "required": [
                                  "currency_id",
                                  "amount"
                                ],
                                "additionalProperties": false
                              },
                              "delivery": {
                                "type": "string",
                                "enum": [
                                  "manual",
                                  "webhook",
                                  "code"
                                ]
                              },
                              "eligibility": {
                                "type": "object",
                                "properties": {
                                  "eligible": {
                                    "type": "boolean"
                                  },
                                  "reason": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "enum": [
                                          "authentication_required",
                                          "audience_required",
                                          "eligibility_unavailable",
                                          "stock_unavailable"
                                        ]
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "eligible",
                                  "reason"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "id",
                              "kind",
                              "catalogue_id",
                              "catalogue_key",
                              "key",
                              "version",
                              "display",
                              "cost",
                              "delivery",
                              "eligibility"
                            ],
                            "additionalProperties": false
                          }
                        ],
                        "type": "object"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "state_revision",
                    "as_of",
                    "availability",
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "304": {
            "description": "No content",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/event_receipts/{id}": {
      "get": {
        "summary": "Read a customer event receipt",
        "tags": [
          "customer surface"
        ],
        "operationId": "get_customer_event_receipts_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "resource_not_found",
            "invalid_cursor",
            "concurrent_update"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "state_revision": "1",
                "as_of": "2026-09-22T12:00:00.000Z",
                "id": "event_example",
                "status": "pending",
                "receipt_url": "/v1/customer/event_receipts/event_example",
                "effects": {
                  "currency_deltas": [],
                  "quest_progress": []
                },
                "pending_followups": true
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:read"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string",
              "maxLength": 35,
              "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
            }
          },
          {
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304.",
              "type": "string"
            },
            "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "state_revision": {
                      "type": "string",
                      "pattern": "^\\d+$"
                    },
                    "as_of": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "evaluated"
                      ]
                    },
                    "receipt_url": {
                      "type": "string"
                    },
                    "effects": {
                      "type": "object",
                      "properties": {
                        "mechanic_changes": {
                          "maxItems": 128,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "streak.progressed",
                                  "streak.extended",
                                  "streak.at_risk",
                                  "streak.broken",
                                  "streak.freeze_consumed",
                                  "streak.restored",
                                  "streak.milestone_reached",
                                  "tier.changed",
                                  "achievement.progressed",
                                  "badge.granted",
                                  "badge.revoked",
                                  "leaderboard.score_changed",
                                  "leaderboard.prize_settled",
                                  "referral.qualified",
                                  "referral.completed",
                                  "referral.reversed"
                                ]
                              },
                              "program_id": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "type",
                              "program_id"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "coupons": {
                          "maxItems": 128,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "entitlement_id": {
                                "type": "string"
                              },
                              "offer_version_id": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "entitlement_id",
                              "offer_version_id"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "discounts": {
                          "maxItems": 128,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "quote_id": {
                                "type": "string"
                              },
                              "offer_version_id": {
                                "type": "string"
                              },
                              "currency": {
                                "type": "string"
                              },
                              "subtotal_minor": {
                                "type": "string",
                                "pattern": "^(0|[1-9][0-9]*)$"
                              },
                              "discount_minor": {
                                "type": "string",
                                "pattern": "^(0|[1-9][0-9]*)$"
                              },
                              "total_minor": {
                                "type": "string",
                                "pattern": "^(0|[1-9][0-9]*)$"
                              }
                            },
                            "required": [
                              "quote_id",
                              "offer_version_id",
                              "currency",
                              "subtotal_minor",
                              "discount_minor",
                              "total_minor"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "graph_quest_progress": {
                          "maxItems": 128,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "program_id": {
                                "type": "string"
                              },
                              "participation_id": {
                                "type": "string"
                              },
                              "run_id": {
                                "type": "string"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "enrolled",
                                  "active",
                                  "qualified",
                                  "claimable",
                                  "completed",
                                  "claimed",
                                  "expired",
                                  "corrected"
                                ]
                              },
                              "steps": {
                                "maxItems": 32,
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "key": {
                                      "type": "string"
                                    },
                                    "progress": {
                                      "type": "string",
                                      "pattern": "^(0|[1-9][0-9]*)$"
                                    },
                                    "completed": {
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "key",
                                    "progress",
                                    "completed"
                                  ],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "program_id",
                              "participation_id",
                              "run_id",
                              "status",
                              "steps"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "currency_deltas": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "currency_id": {
                                "type": "string"
                              },
                              "amount": {
                                "type": "string",
                                "pattern": "^-?\\d+$"
                              }
                            },
                            "required": [
                              "currency_id",
                              "amount"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "quest_progress": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "program_id": {
                                "type": "string"
                              },
                              "participation_id": {
                                "type": "string"
                              },
                              "progress": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "target": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "completed": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "program_id",
                              "participation_id",
                              "progress",
                              "target",
                              "completed"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "currency_deltas",
                        "quest_progress"
                      ],
                      "additionalProperties": false
                    },
                    "pending_followups": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "state_revision",
                    "as_of",
                    "id",
                    "status",
                    "receipt_url",
                    "effects",
                    "pending_followups"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "304": {
            "description": "No content",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/program_enrollments/{id}": {
      "get": {
        "summary": "Read a customer program enrollment",
        "tags": [
          "customer surface"
        ],
        "operationId": "get_customer_program_enrollments_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "resource_not_found",
            "invalid_cursor",
            "concurrent_update"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "state_revision": "1",
                "as_of": "2026-09-22T12:00:00.000Z",
                "id": "pc_example",
                "program_id": "pg_example",
                "participation_id": "pp_example",
                "program_version_id": "pv_example",
                "program_revision": 1,
                "participation_revision": "1",
                "status": "enrolled"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:read"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string",
              "maxLength": 35,
              "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
            }
          },
          {
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304.",
              "type": "string"
            },
            "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "state_revision": {
                      "type": "string",
                      "pattern": "^\\d+$"
                    },
                    "as_of": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "program_id": {
                      "type": "string"
                    },
                    "participation_id": {
                      "type": "string"
                    },
                    "program_version_id": {
                      "type": "string"
                    },
                    "program_revision": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "participation_revision": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "const": "enrolled"
                    }
                  },
                  "required": [
                    "state_revision",
                    "as_of",
                    "id",
                    "program_id",
                    "participation_id",
                    "program_version_id",
                    "program_revision",
                    "participation_revision",
                    "status"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "304": {
            "description": "No content",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/levels": {
      "get": {
        "summary": "Read customer levels",
        "tags": [
          "customer surface"
        ],
        "operationId": "get_customer_levels",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "resource_not_found",
            "invalid_cursor",
            "concurrent_update",
            "invalid_state"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 100
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "state_revision": "1",
                "as_of": "2026-09-22T12:00:00.000Z",
                "availability": "unavailable",
                "data": [],
                "next_cursor": null,
                "has_more": false,
                "reason": "mechanic_not_implemented"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:read"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string",
              "maxLength": 35,
              "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
            }
          },
          {
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304.",
              "type": "string"
            },
            "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "state_revision": {
                          "type": "string",
                          "pattern": "^\\d+$"
                        },
                        "as_of": {
                          "type": "string"
                        },
                        "availability": {
                          "type": "string",
                          "enum": [
                            "available",
                            "hidden",
                            "off"
                          ]
                        },
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "program": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "mechanic": {
                                    "type": "string"
                                  },
                                  "title": {
                                    "type": "string"
                                  },
                                  "description": {
                                    "type": "string"
                                  },
                                  "image_url": {
                                    "type": "string"
                                  },
                                  "icon": {
                                    "type": "string"
                                  },
                                  "color": {
                                    "type": "string"
                                  },
                                  "terminology": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "singular": {
                                            "type": "string"
                                          },
                                          "plural": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "singular",
                                          "plural"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "mechanic",
                                  "terminology"
                                ],
                                "additionalProperties": false
                              },
                              "program_key": {
                                "type": "string",
                                "description": "The immutable program key, the same in every environment the program is promoted to."
                              },
                              "program_version_id": {
                                "type": "string"
                              },
                              "participation_id": {
                                "type": "string"
                              },
                              "run_id": {
                                "type": "string"
                              },
                              "revision": {
                                "type": "string",
                                "pattern": "^(0|[1-9][0-9]*)$"
                              },
                              "occurrence": {
                                "type": "string"
                              },
                              "currency": {
                                "type": "string"
                              },
                              "basis": {
                                "type": "string",
                                "pattern": "^(0|[1-9][0-9]*)$"
                              },
                              "current_level": {
                                "type": "object",
                                "properties": {
                                  "key": {
                                    "type": "string"
                                  },
                                  "threshold": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)$"
                                  },
                                  "display": {
                                    "type": "object",
                                    "properties": {
                                      "title": {
                                        "type": "string"
                                      },
                                      "description": {
                                        "type": "string"
                                      }
                                    },
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "key",
                                  "threshold",
                                  "display"
                                ],
                                "additionalProperties": false
                              },
                              "best_level": {
                                "type": "object",
                                "properties": {
                                  "key": {
                                    "type": "string"
                                  },
                                  "threshold": {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)$"
                                  },
                                  "display": {
                                    "type": "object",
                                    "properties": {
                                      "title": {
                                        "type": "string"
                                      },
                                      "description": {
                                        "type": "string"
                                      }
                                    },
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "key",
                                  "threshold",
                                  "display"
                                ],
                                "additionalProperties": false
                              },
                              "next_threshold": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "remaining": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "pattern": "^(0|[1-9][0-9]*)$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "qualification_window": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "starts_at": {
                                        "type": "string"
                                      },
                                      "ends_at": {
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "starts_at",
                                      "ends_at"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "pending_qualification": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "id",
                              "program",
                              "program_key",
                              "program_version_id",
                              "participation_id",
                              "run_id",
                              "revision",
                              "occurrence",
                              "currency",
                              "basis",
                              "current_level",
                              "best_level",
                              "next_threshold",
                              "remaining",
                              "qualification_window",
                              "pending_qualification"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "next_cursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "has_more": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "state_revision",
                        "as_of",
                        "availability",
                        "data",
                        "next_cursor",
                        "has_more"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "state_revision": {
                          "type": "string",
                          "pattern": "^\\d+$"
                        },
                        "as_of": {
                          "type": "string"
                        },
                        "availability": {
                          "type": "string",
                          "const": "unavailable"
                        },
                        "reason": {
                          "type": "string",
                          "const": "mechanic_not_implemented"
                        },
                        "data": {
                          "minItems": 0,
                          "maxItems": 0,
                          "type": "array",
                          "items": {
                            "not": {}
                          }
                        },
                        "next_cursor": {
                          "type": "null"
                        },
                        "has_more": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "state_revision",
                        "as_of",
                        "availability",
                        "reason",
                        "data",
                        "next_cursor",
                        "has_more"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "304": {
            "description": "No content",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/streaks": {
      "get": {
        "summary": "Read customer streaks",
        "tags": [
          "customer surface"
        ],
        "operationId": "get_customer_streaks",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "resource_not_found",
            "invalid_cursor",
            "concurrent_update"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 100
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "state_revision": "1",
                "as_of": "2026-09-22T12:00:00.000Z",
                "availability": "unavailable",
                "data": [],
                "next_cursor": null,
                "has_more": false,
                "reason": "mechanic_not_implemented"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:read"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string",
              "maxLength": 35,
              "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
            }
          },
          {
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304.",
              "type": "string"
            },
            "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "state_revision": {
                          "type": "string",
                          "pattern": "^\\d+$"
                        },
                        "as_of": {
                          "type": "string"
                        },
                        "availability": {
                          "type": "string",
                          "enum": [
                            "available",
                            "hidden",
                            "off"
                          ]
                        },
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "program": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "mechanic": {
                                    "type": "string"
                                  },
                                  "title": {
                                    "type": "string"
                                  },
                                  "description": {
                                    "type": "string"
                                  },
                                  "image_url": {
                                    "type": "string"
                                  },
                                  "icon": {
                                    "type": "string"
                                  },
                                  "color": {
                                    "type": "string"
                                  },
                                  "terminology": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "singular": {
                                            "type": "string"
                                          },
                                          "plural": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "singular",
                                          "plural"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "mechanic",
                                  "terminology"
                                ],
                                "additionalProperties": false
                              },
                              "program_key": {
                                "type": "string",
                                "description": "The immutable program key, the same in every environment the program is promoted to."
                              },
                              "participation_id": {
                                "type": "string"
                              },
                              "current": {
                                "type": "string",
                                "pattern": "^\\d+$"
                              },
                              "best": {
                                "type": "string",
                                "pattern": "^\\d+$"
                              },
                              "freezes": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 1000
                              },
                              "current_period": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "key": {
                                        "type": "string"
                                      },
                                      "progress": {
                                        "type": "string",
                                        "pattern": "^\\d+$"
                                      },
                                      "status": {
                                        "type": "string",
                                        "enum": [
                                          "open",
                                          "qualified",
                                          "provisional",
                                          "frozen",
                                          "missed",
                                          "finalized"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "key",
                                      "progress",
                                      "status"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "at_risk_at": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "next_deadline_at": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "pending_finalization": {
                                "type": "boolean"
                              },
                              "paused": {
                                "type": "boolean"
                              },
                              "program_version_id": {
                                "type": "string"
                              },
                              "freeze_purchase": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "available": {
                                        "type": "boolean"
                                      },
                                      "currency_id": {
                                        "type": "string"
                                      },
                                      "unit_cost_minor": {
                                        "type": "string",
                                        "pattern": "^(0|[1-9][0-9]*)$"
                                      },
                                      "max_quantity": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 1000
                                      }
                                    },
                                    "required": [
                                      "available",
                                      "currency_id",
                                      "unit_cost_minor",
                                      "max_quantity"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "repair": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "available": {
                                        "type": "boolean"
                                      },
                                      "price": {
                                        "type": "object",
                                        "properties": {
                                          "currency": {
                                            "type": "string"
                                          },
                                          "amount_minor": {
                                            "type": "string",
                                            "pattern": "^[1-9][0-9]*$"
                                          }
                                        },
                                        "required": [
                                          "currency",
                                          "amount_minor"
                                        ],
                                        "additionalProperties": false
                                      },
                                      "currency_id": {
                                        "type": [
                                          "string",
                                          "null"
                                        ]
                                      },
                                      "expires_at": {
                                        "type": "string"
                                      },
                                      "broken_length": {
                                        "type": "string",
                                        "pattern": "^\\d+$"
                                      }
                                    },
                                    "required": [
                                      "available",
                                      "price",
                                      "currency_id",
                                      "expires_at",
                                      "broken_length"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "program",
                              "program_key",
                              "participation_id",
                              "current",
                              "best",
                              "freezes",
                              "current_period",
                              "at_risk_at",
                              "next_deadline_at",
                              "pending_finalization",
                              "paused",
                              "program_version_id",
                              "freeze_purchase",
                              "repair"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "next_cursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "has_more": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "state_revision",
                        "as_of",
                        "availability",
                        "data",
                        "next_cursor",
                        "has_more"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "state_revision": {
                          "type": "string",
                          "pattern": "^\\d+$"
                        },
                        "as_of": {
                          "type": "string"
                        },
                        "availability": {
                          "type": "string",
                          "const": "unavailable"
                        },
                        "reason": {
                          "type": "string",
                          "const": "mechanic_not_implemented"
                        },
                        "data": {
                          "minItems": 0,
                          "maxItems": 0,
                          "type": "array",
                          "items": {
                            "not": {}
                          }
                        },
                        "next_cursor": {
                          "type": "null"
                        },
                        "has_more": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "state_revision",
                        "as_of",
                        "availability",
                        "reason",
                        "data",
                        "next_cursor",
                        "has_more"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "304": {
            "description": "No content",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/streaks/{participation_id}/freeze_purchases": {
      "get": {
        "summary": "List the freeze purchases of a streak participation and its predecessors",
        "tags": [
          "customer surface"
        ],
        "operationId": "get_customer_streaks_participation_id_freeze_purchases",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "resource_not_found",
            "invalid_cursor",
            "concurrent_update"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 100
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "state_revision": "1",
                "as_of": "2026-09-22T12:00:00.000Z",
                "availability": "unavailable",
                "data": [],
                "next_cursor": null,
                "has_more": false,
                "reason": "mechanic_not_implemented"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:read"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "participation_id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string",
              "maxLength": 35,
              "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
            }
          },
          {
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304.",
              "type": "string"
            },
            "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "state_revision": {
                          "type": "string",
                          "pattern": "^\\d+$"
                        },
                        "as_of": {
                          "type": "string"
                        },
                        "availability": {
                          "type": "string",
                          "enum": [
                            "available",
                            "hidden",
                            "off"
                          ]
                        },
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "purchase_id": {
                                "type": "string"
                              },
                              "program_version_id": {
                                "type": "string"
                              },
                              "participation_id": {
                                "type": "string"
                              },
                              "quantity": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 9007199254740991
                              },
                              "cancelled": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "consumed": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "cancellable_quantity": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "active",
                                  "partially_used",
                                  "used",
                                  "cancelled"
                                ]
                              },
                              "created_at": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "purchase_id",
                              "program_version_id",
                              "participation_id",
                              "quantity",
                              "cancelled",
                              "consumed",
                              "cancellable_quantity",
                              "status",
                              "created_at"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "next_cursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "has_more": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "state_revision",
                        "as_of",
                        "availability",
                        "data",
                        "next_cursor",
                        "has_more"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "state_revision": {
                          "type": "string",
                          "pattern": "^\\d+$"
                        },
                        "as_of": {
                          "type": "string"
                        },
                        "availability": {
                          "type": "string",
                          "const": "unavailable"
                        },
                        "reason": {
                          "type": "string",
                          "const": "mechanic_not_implemented"
                        },
                        "data": {
                          "minItems": 0,
                          "maxItems": 0,
                          "type": "array",
                          "items": {
                            "not": {}
                          }
                        },
                        "next_cursor": {
                          "type": "null"
                        },
                        "has_more": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "state_revision",
                        "as_of",
                        "availability",
                        "reason",
                        "data",
                        "next_cursor",
                        "has_more"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "304": {
            "description": "No content",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/badges": {
      "get": {
        "summary": "Read customer badges",
        "tags": [
          "customer surface"
        ],
        "operationId": "get_customer_badges",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "resource_not_found",
            "invalid_cursor",
            "concurrent_update"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 100
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "state_revision": "1",
                "as_of": "2026-09-22T12:00:00.000Z",
                "availability": "unavailable",
                "data": [],
                "next_cursor": null,
                "has_more": false,
                "reason": "mechanic_not_implemented"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:read"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string",
              "maxLength": 35,
              "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
            }
          },
          {
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304.",
              "type": "string"
            },
            "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "state_revision": {
                          "type": "string",
                          "pattern": "^\\d+$"
                        },
                        "as_of": {
                          "type": "string"
                        },
                        "availability": {
                          "type": "string",
                          "enum": [
                            "available",
                            "hidden",
                            "off"
                          ]
                        },
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "program": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "mechanic": {
                                    "type": "string"
                                  },
                                  "title": {
                                    "type": "string"
                                  },
                                  "description": {
                                    "type": "string"
                                  },
                                  "image_url": {
                                    "type": "string"
                                  },
                                  "icon": {
                                    "type": "string"
                                  },
                                  "color": {
                                    "type": "string"
                                  },
                                  "terminology": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "singular": {
                                            "type": "string"
                                          },
                                          "plural": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "singular",
                                          "plural"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "mechanic",
                                  "terminology"
                                ],
                                "additionalProperties": false
                              },
                              "program_key": {
                                "type": "string",
                                "description": "The immutable program key, the same in every environment the program is promoted to."
                              },
                              "participation_id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "occurrence": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "progress": {
                                "type": "string",
                                "pattern": "^(0|[1-9][0-9]*)$"
                              },
                              "highest_rank": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "owned": {
                                "type": "boolean"
                              },
                              "status": {
                                "type": "string",
                                "enum": [
                                  "locked",
                                  "earned",
                                  "revoked"
                                ]
                              },
                              "earned_at": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "format": "date-time",
                                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              },
                              "criteria": {
                                "type": "object",
                                "properties": {
                                  "ranks": {
                                    "minItems": 1,
                                    "maxItems": 64,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string"
                                        },
                                        "threshold": {
                                          "type": "string",
                                          "pattern": "^[1-9][0-9]*$"
                                        },
                                        "title": {
                                          "type": "string"
                                        },
                                        "description": {
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "threshold"
                                      ],
                                      "additionalProperties": false
                                    }
                                  }
                                },
                                "required": [
                                  "ranks"
                                ],
                                "additionalProperties": false
                              },
                              "rarity": {
                                "anyOf": [
                                  {
                                    "maxItems": 64,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "rank_key": {
                                          "type": "string"
                                        },
                                        "rarity_percent": {
                                          "type": "string",
                                          "pattern": "^(100\\.0|[1-9]?[0-9]\\.[0-9])$"
                                        },
                                        "rarity_tier": {
                                          "type": "string",
                                          "enum": [
                                            "common",
                                            "uncommon",
                                            "rare",
                                            "epic",
                                            "legendary"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "rank_key",
                                        "rarity_percent",
                                        "rarity_tier"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "program",
                              "program_key",
                              "participation_id",
                              "occurrence",
                              "progress",
                              "highest_rank",
                              "owned",
                              "status",
                              "earned_at",
                              "criteria"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "next_cursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "has_more": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "state_revision",
                        "as_of",
                        "availability",
                        "data",
                        "next_cursor",
                        "has_more"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "state_revision": {
                          "type": "string",
                          "pattern": "^\\d+$"
                        },
                        "as_of": {
                          "type": "string"
                        },
                        "availability": {
                          "type": "string",
                          "const": "unavailable"
                        },
                        "reason": {
                          "type": "string",
                          "const": "mechanic_not_implemented"
                        },
                        "data": {
                          "minItems": 0,
                          "maxItems": 0,
                          "type": "array",
                          "items": {
                            "not": {}
                          }
                        },
                        "next_cursor": {
                          "type": "null"
                        },
                        "has_more": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "state_revision",
                        "as_of",
                        "availability",
                        "reason",
                        "data",
                        "next_cursor",
                        "has_more"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "304": {
            "description": "No content",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/leaderboard_positions": {
      "get": {
        "summary": "Read customer leaderboard positions",
        "tags": [
          "customer surface"
        ],
        "operationId": "get_customer_leaderboard_positions",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "resource_not_found",
            "invalid_cursor",
            "concurrent_update",
            "invalid_state",
            "capability_unavailable"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 100
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "state_revision": "1",
                "as_of": "2026-09-22T12:00:00.000Z",
                "availability": "unavailable",
                "data": [],
                "next_cursor": null,
                "has_more": false,
                "reason": "mechanic_not_implemented"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:read"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string",
              "maxLength": 35,
              "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
            }
          },
          {
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304.",
              "type": "string"
            },
            "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "state_revision": {
                          "type": "string",
                          "pattern": "^\\d+$"
                        },
                        "as_of": {
                          "type": "string"
                        },
                        "availability": {
                          "type": "string",
                          "enum": [
                            "available",
                            "hidden",
                            "off"
                          ]
                        },
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "board_id": {
                                "type": "string"
                              },
                              "program": {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "mechanic": {
                                    "type": "string"
                                  },
                                  "title": {
                                    "type": "string"
                                  },
                                  "description": {
                                    "type": "string"
                                  },
                                  "image_url": {
                                    "type": "string"
                                  },
                                  "icon": {
                                    "type": "string"
                                  },
                                  "color": {
                                    "type": "string"
                                  },
                                  "terminology": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "singular": {
                                            "type": "string"
                                          },
                                          "plural": {
                                            "type": "string"
                                          }
                                        },
                                        "required": [
                                          "singular",
                                          "plural"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "null"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "id",
                                  "mechanic",
                                  "terminology"
                                ],
                                "additionalProperties": false
                              },
                              "program_key": {
                                "type": "string",
                                "description": "The immutable program key, the same in every environment the program is promoted to."
                              },
                              "season_occurrence_id": {
                                "type": "string"
                              },
                              "entry_id": {
                                "type": "string"
                              },
                              "ordinal": {
                                "type": "string",
                                "pattern": "^[1-9][0-9]*$"
                              },
                              "score": {
                                "type": "string"
                              },
                              "revision_id": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "profile_revision": {
                                "type": "string",
                                "pattern": "^(0|[1-9][0-9]*)$"
                              },
                              "pseudonym": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "visible": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "board_id",
                              "program",
                              "program_key",
                              "season_occurrence_id",
                              "entry_id",
                              "ordinal",
                              "score",
                              "revision_id",
                              "profile_revision",
                              "pseudonym",
                              "visible"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "next_cursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "has_more": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "state_revision",
                        "as_of",
                        "availability",
                        "data",
                        "next_cursor",
                        "has_more"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "state_revision": {
                          "type": "string",
                          "pattern": "^\\d+$"
                        },
                        "as_of": {
                          "type": "string"
                        },
                        "availability": {
                          "type": "string",
                          "const": "unavailable"
                        },
                        "reason": {
                          "type": "string",
                          "const": "mechanic_not_implemented"
                        },
                        "data": {
                          "minItems": 0,
                          "maxItems": 0,
                          "type": "array",
                          "items": {
                            "not": {}
                          }
                        },
                        "next_cursor": {
                          "type": "null"
                        },
                        "has_more": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "state_revision",
                        "as_of",
                        "availability",
                        "reason",
                        "data",
                        "next_cursor",
                        "has_more"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "304": {
            "description": "No content",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/referrals": {
      "get": {
        "summary": "Read customer referrals",
        "tags": [
          "customer surface"
        ],
        "operationId": "get_customer_referrals",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed",
            "resource_not_found",
            "invalid_cursor",
            "concurrent_update"
          ],
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 100
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "state_revision": "1",
                "as_of": "2026-09-22T12:00:00.000Z",
                "availability": "unavailable",
                "data": [],
                "next_cursor": null,
                "has_more": false,
                "reason": "mechanic_not_implemented"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:read"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "locale",
            "schema": {
              "type": "string",
              "maxLength": 35,
              "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
            }
          },
          {
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304.",
              "type": "string"
            },
            "description": "Private weak validator from this customer snapshot. Live authorization precedes every 304."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "state_revision": {
                          "type": "string",
                          "pattern": "^\\d+$"
                        },
                        "as_of": {
                          "type": "string"
                        },
                        "availability": {
                          "type": "string",
                          "enum": [
                            "available",
                            "hidden",
                            "off"
                          ]
                        },
                        "data": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "program_id": {
                                "type": "string"
                              },
                              "program_key": {
                                "type": "string",
                                "description": "The immutable program key, the same in every environment the program is promoted to."
                              },
                              "role": {
                                "type": "string",
                                "enum": [
                                  "referrer",
                                  "referred"
                                ]
                              },
                              "status": {
                                "type": "string"
                              },
                              "claimed_at": {
                                "type": "string"
                              },
                              "offered_rewards": {
                                "maxItems": 16,
                                "type": "array",
                                "items": {
                                  "oneOf": [
                                    {
                                      "type": "object",
                                      "properties": {
                                        "currency": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "amount_minor": {
                                          "type": "string"
                                        },
                                        "type": {
                                          "type": "string",
                                          "const": "currency"
                                        }
                                      },
                                      "required": [
                                        "currency",
                                        "amount_minor",
                                        "type"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "reward"
                                        },
                                        "reward": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "quantity": {
                                          "type": "number",
                                          "const": 1
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "reward",
                                        "quantity"
                                      ],
                                      "additionalProperties": false
                                    },
                                    {
                                      "type": "object",
                                      "properties": {
                                        "type": {
                                          "type": "string",
                                          "const": "item"
                                        },
                                        "item": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                        },
                                        "quantity": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 1000
                                        }
                                      },
                                      "required": [
                                        "type",
                                        "item",
                                        "quantity"
                                      ],
                                      "additionalProperties": false
                                    }
                                  ],
                                  "type": "object"
                                }
                              },
                              "settlement": {
                                "anyOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "id": {
                                        "type": "string"
                                      },
                                      "status": {
                                        "type": "string"
                                      },
                                      "revision": {
                                        "type": "string"
                                      },
                                      "vests_at": {
                                        "type": "string"
                                      },
                                      "review_pending": {
                                        "type": "boolean"
                                      }
                                    },
                                    "required": [
                                      "id",
                                      "status",
                                      "revision",
                                      "vests_at",
                                      "review_pending"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "null"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "id",
                              "program_id",
                              "program_key",
                              "role",
                              "status",
                              "claimed_at",
                              "offered_rewards",
                              "settlement"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "next_cursor": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "has_more": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "state_revision",
                        "as_of",
                        "availability",
                        "data",
                        "next_cursor",
                        "has_more"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "object",
                      "properties": {
                        "state_revision": {
                          "type": "string",
                          "pattern": "^\\d+$"
                        },
                        "as_of": {
                          "type": "string"
                        },
                        "availability": {
                          "type": "string",
                          "const": "unavailable"
                        },
                        "reason": {
                          "type": "string",
                          "const": "mechanic_not_implemented"
                        },
                        "data": {
                          "minItems": 0,
                          "maxItems": 0,
                          "type": "array",
                          "items": {
                            "not": {}
                          }
                        },
                        "next_cursor": {
                          "type": "null"
                        },
                        "has_more": {
                          "type": "boolean",
                          "const": false
                        }
                      },
                      "required": [
                        "state_revision",
                        "as_of",
                        "availability",
                        "reason",
                        "data",
                        "next_cursor",
                        "has_more"
                      ],
                      "additionalProperties": false
                    }
                  ]
                }
              }
            }
          },
          "304": {
            "description": "No content",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Customer-bound weak representation validator."
              },
              "Cache-Control": {
                "schema": {
                  "type": "string",
                  "const": "private, max-age=0, must-revalidate"
                },
                "description": "Private storage with revalidation on every use."
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/client_configuration": {
      "get": {
        "summary": "Read client origins, grant policy and admission limits",
        "tags": [
          "client configurations"
        ],
        "operationId": "get_client_configuration",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "concurrent_update",
            "stale_write",
            "customer_admission_unavailable"
          ],
          "resource": "client_configuration",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "environment_id": "env_example",
                "version": 1,
                "enabled": false,
                "allowed_origins": [
                  "https://app.example"
                ],
                "admission_limits": {},
                "customer_grant_policy": [
                  "customer:read",
                  "customer:write",
                  "events:write_client"
                ],
                "created_at": "2026-09-22T12:00:00.000Z",
                "updated_at": "2026-09-22T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"1\""
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "client_configurations:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "client_configurations:read"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "environment_id": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "allowed_origins": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "admission_limits": {
                      "type": "object",
                      "properties": {
                        "customer": {
                          "type": "object",
                          "properties": {
                            "environment": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 6000
                                },
                                "items": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 6000
                                },
                                "body_bytes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 16777216
                                }
                              },
                              "additionalProperties": false
                            },
                            "customer": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 240
                                },
                                "items": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 120
                                },
                                "body_bytes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1048576
                                }
                              },
                              "additionalProperties": false
                            },
                            "session": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 120
                                },
                                "items": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 120
                                },
                                "body_bytes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 524288
                                }
                              },
                              "additionalProperties": false
                            },
                            "ip": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 600
                                },
                                "items": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 600
                                },
                                "body_bytes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 4194304
                                }
                              },
                              "additionalProperties": false
                            },
                            "event_name": {
                              "type": "object",
                              "properties": {
                                "items": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 60
                                }
                              },
                              "additionalProperties": false
                            }
                          },
                          "additionalProperties": false
                        },
                        "exchange": {
                          "type": "object",
                          "properties": {
                            "environment": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 600
                                }
                              },
                              "additionalProperties": false
                            },
                            "ip": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 30
                                }
                              },
                              "additionalProperties": false
                            }
                          },
                          "additionalProperties": false
                        },
                        "anonymous_exchange": {
                          "type": "object",
                          "properties": {
                            "ip": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 10
                                }
                              },
                              "additionalProperties": false
                            }
                          },
                          "additionalProperties": false
                        },
                        "stream": {
                          "type": "object",
                          "properties": {
                            "environment": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 6000
                                },
                                "body_bytes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 16777216
                                }
                              },
                              "additionalProperties": false
                            },
                            "customer": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 240
                                },
                                "body_bytes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1048576
                                }
                              },
                              "additionalProperties": false
                            },
                            "session": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 120
                                },
                                "body_bytes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 524288
                                }
                              },
                              "additionalProperties": false
                            },
                            "ip": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 600
                                },
                                "body_bytes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 4194304
                                }
                              },
                              "additionalProperties": false
                            }
                          },
                          "additionalProperties": false
                        },
                        "backend_exchange": {
                          "type": "object",
                          "properties": {
                            "environment": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 60000
                                }
                              },
                              "additionalProperties": false
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "additionalProperties": false
                    },
                    "customer_grant_policy": {
                      "maxItems": 3,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "customer:read",
                          "customer:write",
                          "events:write_client"
                        ]
                      }
                    },
                    "created_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "updated_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "environment_id",
                    "version",
                    "enabled",
                    "allowed_origins",
                    "admission_limits",
                    "customer_grant_policy",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Configure client origins and lower admission limits",
        "tags": [
          "client configurations"
        ],
        "operationId": "patch_client_configuration",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "required",
            "responseEtag": true
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "concurrent_update",
            "customer_admission_unavailable"
          ],
          "resource": "client_configuration",
          "action": "update",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "environment_id": "env_example",
                "version": 1,
                "enabled": false,
                "allowed_origins": [
                  "https://app.example"
                ],
                "admission_limits": {},
                "customer_grant_policy": [
                  "customer:read",
                  "customer:write",
                  "events:write_client"
                ],
                "created_at": "2026-09-22T12:00:00.000Z",
                "updated_at": "2026-09-22T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"1\""
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "request": {
              "allowed_origins": [
                "https://app.example"
              ]
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 200,
              "body": {
                "environment_id": "env_example",
                "version": 1,
                "enabled": false,
                "allowed_origins": [
                  "https://app.example"
                ],
                "admission_limits": {},
                "customer_grant_policy": [
                  "customer:read",
                  "customer:write",
                  "events:write_client"
                ],
                "created_at": "2026-09-22T12:00:00.000Z",
                "updated_at": "2026-09-22T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"1\"",
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "client_configuration"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "client_configurations:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "client_configurations:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Required revision, checked in the owning transaction."
            },
            "required": true,
            "description": "Required revision, checked in the owning transaction."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "allowed_origins": [
                  "https://app.example"
                ]
              },
              "schema": {
                "type": "object",
                "properties": {
                  "allowed_origins": {
                    "maxItems": 100,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "maxLength": 2048
                    }
                  },
                  "admission_limits": {
                    "type": "object",
                    "properties": {
                      "customer": {
                        "type": "object",
                        "properties": {
                          "environment": {
                            "type": "object",
                            "properties": {
                              "requests": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 6000
                              },
                              "items": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 6000
                              },
                              "body_bytes": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 16777216
                              }
                            },
                            "additionalProperties": false
                          },
                          "customer": {
                            "type": "object",
                            "properties": {
                              "requests": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 240
                              },
                              "items": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 120
                              },
                              "body_bytes": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 1048576
                              }
                            },
                            "additionalProperties": false
                          },
                          "session": {
                            "type": "object",
                            "properties": {
                              "requests": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 120
                              },
                              "items": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 120
                              },
                              "body_bytes": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 524288
                              }
                            },
                            "additionalProperties": false
                          },
                          "ip": {
                            "type": "object",
                            "properties": {
                              "requests": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 600
                              },
                              "items": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 600
                              },
                              "body_bytes": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 4194304
                              }
                            },
                            "additionalProperties": false
                          },
                          "event_name": {
                            "type": "object",
                            "properties": {
                              "items": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 60
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "additionalProperties": false
                      },
                      "exchange": {
                        "type": "object",
                        "properties": {
                          "environment": {
                            "type": "object",
                            "properties": {
                              "requests": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 600
                              }
                            },
                            "additionalProperties": false
                          },
                          "ip": {
                            "type": "object",
                            "properties": {
                              "requests": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 30
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "additionalProperties": false
                      },
                      "anonymous_exchange": {
                        "type": "object",
                        "properties": {
                          "ip": {
                            "type": "object",
                            "properties": {
                              "requests": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 10
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "additionalProperties": false
                      },
                      "stream": {
                        "type": "object",
                        "properties": {
                          "environment": {
                            "type": "object",
                            "properties": {
                              "requests": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 6000
                              },
                              "body_bytes": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 16777216
                              }
                            },
                            "additionalProperties": false
                          },
                          "customer": {
                            "type": "object",
                            "properties": {
                              "requests": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 240
                              },
                              "body_bytes": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 1048576
                              }
                            },
                            "additionalProperties": false
                          },
                          "session": {
                            "type": "object",
                            "properties": {
                              "requests": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 120
                              },
                              "body_bytes": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 524288
                              }
                            },
                            "additionalProperties": false
                          },
                          "ip": {
                            "type": "object",
                            "properties": {
                              "requests": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 600
                              },
                              "body_bytes": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 4194304
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "additionalProperties": false
                      },
                      "backend_exchange": {
                        "type": "object",
                        "properties": {
                          "environment": {
                            "type": "object",
                            "properties": {
                              "requests": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 60000
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "additionalProperties": false
                      }
                    },
                    "additionalProperties": false
                  },
                  "customer_grant_policy": {
                    "maxItems": 3,
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "customer:read",
                        "customer:write",
                        "events:write_client"
                      ]
                    }
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "environment_id": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "enabled": {
                      "type": "boolean"
                    },
                    "allowed_origins": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "admission_limits": {
                      "type": "object",
                      "properties": {
                        "customer": {
                          "type": "object",
                          "properties": {
                            "environment": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 6000
                                },
                                "items": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 6000
                                },
                                "body_bytes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 16777216
                                }
                              },
                              "additionalProperties": false
                            },
                            "customer": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 240
                                },
                                "items": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 120
                                },
                                "body_bytes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1048576
                                }
                              },
                              "additionalProperties": false
                            },
                            "session": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 120
                                },
                                "items": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 120
                                },
                                "body_bytes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 524288
                                }
                              },
                              "additionalProperties": false
                            },
                            "ip": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 600
                                },
                                "items": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 600
                                },
                                "body_bytes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 4194304
                                }
                              },
                              "additionalProperties": false
                            },
                            "event_name": {
                              "type": "object",
                              "properties": {
                                "items": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 60
                                }
                              },
                              "additionalProperties": false
                            }
                          },
                          "additionalProperties": false
                        },
                        "exchange": {
                          "type": "object",
                          "properties": {
                            "environment": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 600
                                }
                              },
                              "additionalProperties": false
                            },
                            "ip": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 30
                                }
                              },
                              "additionalProperties": false
                            }
                          },
                          "additionalProperties": false
                        },
                        "anonymous_exchange": {
                          "type": "object",
                          "properties": {
                            "ip": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 10
                                }
                              },
                              "additionalProperties": false
                            }
                          },
                          "additionalProperties": false
                        },
                        "stream": {
                          "type": "object",
                          "properties": {
                            "environment": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 6000
                                },
                                "body_bytes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 16777216
                                }
                              },
                              "additionalProperties": false
                            },
                            "customer": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 240
                                },
                                "body_bytes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 1048576
                                }
                              },
                              "additionalProperties": false
                            },
                            "session": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 120
                                },
                                "body_bytes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 524288
                                }
                              },
                              "additionalProperties": false
                            },
                            "ip": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 600
                                },
                                "body_bytes": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 4194304
                                }
                              },
                              "additionalProperties": false
                            }
                          },
                          "additionalProperties": false
                        },
                        "backend_exchange": {
                          "type": "object",
                          "properties": {
                            "environment": {
                              "type": "object",
                              "properties": {
                                "requests": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 60000
                                }
                              },
                              "additionalProperties": false
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "additionalProperties": false
                    },
                    "customer_grant_policy": {
                      "maxItems": 3,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "customer:read",
                          "customer:write",
                          "events:write_client"
                        ]
                      }
                    },
                    "created_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "updated_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "environment_id",
                    "version",
                    "enabled",
                    "allowed_origins",
                    "admission_limits",
                    "customer_grant_policy",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/portal_configurations": {
      "get": {
        "summary": "List the portal configurations of the environment",
        "tags": [
          "portal configurations"
        ],
        "operationId": "list_portal_configurations",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "portal_configuration",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 100
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [
                  {
                    "id": "ptl_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                    "key": "rewards",
                    "name": "Rewards widget",
                    "status": "active",
                    "draft": {
                      "schema": "portal/v1",
                      "allowed_parent_origins": [
                        "https://shop.example"
                      ],
                      "surfaces": [
                        {
                          "surface": "activity"
                        }
                      ],
                      "layout": {
                        "mode": "inline"
                      },
                      "brand": {
                        "name": "Rewards",
                        "theme": "light",
                        "light": {
                          "accent": "#1d4ed8",
                          "accent_ink": "#ffffff",
                          "canvas": "#ffffff",
                          "ink": "#111111"
                        },
                        "radius": "medium",
                        "font": "system"
                      },
                      "locale": {
                        "default": "en",
                        "supported": [
                          "en"
                        ],
                        "follow_parent": true
                      }
                    },
                    "revision": 3,
                    "session_generation": 1,
                    "active_version": {
                      "id": "ptv_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                      "number": 1,
                      "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                      "created_by": "key_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                      "created_at": "2026-10-01T12:00:00.000Z"
                    },
                    "created_at": "2026-10-01T12:00:00.000Z",
                    "updated_at": "2026-10-01T12:00:00.000Z"
                  }
                ],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "portal_configurations:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "portal_configurations:read"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PortalConfiguration"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a portal configuration (at most 10 per environment)",
        "tags": [
          "portal configurations"
        ],
        "operationId": "create_portal_configuration",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "stale_write",
            "concurrent_update",
            "already_exists",
            "invalid_state"
          ],
          "resource": "portal_configuration",
          "action": "create",
          "examples": {
            "request": {
              "key": "rewards",
              "name": "Rewards widget",
              "draft": {
                "schema": "portal/v1",
                "allowed_parent_origins": [
                  "https://shop.example"
                ],
                "surfaces": [
                  {
                    "surface": "activity"
                  }
                ],
                "layout": {
                  "mode": "inline"
                },
                "brand": {
                  "name": "Rewards",
                  "theme": "light",
                  "light": {
                    "accent": "#1d4ed8",
                    "accent_ink": "#ffffff",
                    "canvas": "#ffffff",
                    "ink": "#111111"
                  },
                  "radius": "medium",
                  "font": "system"
                },
                "locale": {
                  "default": "en",
                  "supported": [
                    "en"
                  ],
                  "follow_parent": true
                }
              }
            },
            "success": {
              "status": 201,
              "body": {
                "id": "ptl_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                "key": "rewards",
                "name": "Rewards widget",
                "status": "active",
                "draft": {
                  "schema": "portal/v1",
                  "allowed_parent_origins": [
                    "https://shop.example"
                  ],
                  "surfaces": [
                    {
                      "surface": "activity"
                    }
                  ],
                  "layout": {
                    "mode": "inline"
                  },
                  "brand": {
                    "name": "Rewards",
                    "theme": "light",
                    "light": {
                      "accent": "#1d4ed8",
                      "accent_ink": "#ffffff",
                      "canvas": "#ffffff",
                      "ink": "#111111"
                    },
                    "radius": "medium",
                    "font": "system"
                  },
                  "locale": {
                    "default": "en",
                    "supported": [
                      "en"
                    ],
                    "follow_parent": true
                  }
                },
                "revision": 1,
                "session_generation": 1,
                "active_version": null,
                "created_at": "2026-10-01T12:00:00.000Z",
                "updated_at": "2026-10-01T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"3\""
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "ptl_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                "key": "rewards",
                "name": "Rewards widget",
                "status": "active",
                "draft": {
                  "schema": "portal/v1",
                  "allowed_parent_origins": [
                    "https://shop.example"
                  ],
                  "surfaces": [
                    {
                      "surface": "activity"
                    }
                  ],
                  "layout": {
                    "mode": "inline"
                  },
                  "brand": {
                    "name": "Rewards",
                    "theme": "light",
                    "light": {
                      "accent": "#1d4ed8",
                      "accent_ink": "#ffffff",
                      "canvas": "#ffffff",
                      "ink": "#111111"
                    },
                    "radius": "medium",
                    "font": "system"
                  },
                  "locale": {
                    "default": "en",
                    "supported": [
                      "en"
                    ],
                    "follow_parent": true
                  }
                },
                "revision": 1,
                "session_generation": 1,
                "active_version": null,
                "created_at": "2026-10-01T12:00:00.000Z",
                "updated_at": "2026-10-01T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"3\"",
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "portal_configuration"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "portal_configurations:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "portal_configurations:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "key": "rewards",
                "name": "Rewards widget",
                "draft": {
                  "schema": "portal/v1",
                  "allowed_parent_origins": [
                    "https://shop.example"
                  ],
                  "surfaces": [
                    {
                      "surface": "activity"
                    }
                  ],
                  "layout": {
                    "mode": "inline"
                  },
                  "brand": {
                    "name": "Rewards",
                    "theme": "light",
                    "light": {
                      "accent": "#1d4ed8",
                      "accent_ink": "#ffffff",
                      "canvas": "#ffffff",
                      "ink": "#111111"
                    },
                    "radius": "medium",
                    "font": "system"
                  },
                  "locale": {
                    "default": "en",
                    "supported": [
                      "en"
                    ],
                    "follow_parent": true
                  }
                }
              },
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string",
                    "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "draft": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/PortalDocument"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "key",
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortalConfiguration"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/portal_configurations/{id}": {
      "get": {
        "summary": "Read a portal configuration with its draft, active version and readiness",
        "tags": [
          "portal configurations"
        ],
        "operationId": "get_portal_configuration",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "portal_configuration",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "ptl_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                "key": "rewards",
                "name": "Rewards widget",
                "status": "active",
                "draft": {
                  "schema": "portal/v1",
                  "allowed_parent_origins": [
                    "https://shop.example"
                  ],
                  "surfaces": [
                    {
                      "surface": "activity"
                    }
                  ],
                  "layout": {
                    "mode": "inline"
                  },
                  "brand": {
                    "name": "Rewards",
                    "theme": "light",
                    "light": {
                      "accent": "#1d4ed8",
                      "accent_ink": "#ffffff",
                      "canvas": "#ffffff",
                      "ink": "#111111"
                    },
                    "radius": "medium",
                    "font": "system"
                  },
                  "locale": {
                    "default": "en",
                    "supported": [
                      "en"
                    ],
                    "follow_parent": true
                  }
                },
                "revision": 3,
                "session_generation": 1,
                "active_version": {
                  "id": "ptv_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "number": 1,
                  "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "created_by": "key_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "created_at": "2026-10-01T12:00:00.000Z"
                },
                "created_at": "2026-10-01T12:00:00.000Z",
                "updated_at": "2026-10-01T12:00:00.000Z",
                "readiness": {
                  "portal_origin_configured": true,
                  "customer_surface_active": true,
                  "parent_origins_missing_from_client_configuration": [],
                  "surfaces_not_shown": [],
                  "widget_origin": "https://widget.orishare.example",
                  "loopback_origins_allowed": false
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "portal_configurations:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "portal_configurations:read"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortalConfigurationDetail"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Save the name or the draft (If-Match: the revision)",
        "tags": [
          "portal configurations"
        ],
        "operationId": "update_portal_configuration",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "required",
            "responseEtag": true
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "resource_not_found",
            "concurrent_update"
          ],
          "resource": "portal_configuration",
          "action": "update",
          "examples": {
            "request": {
              "name": "Rewards widget",
              "draft": {
                "schema": "portal/v1",
                "allowed_parent_origins": [
                  "https://shop.example"
                ],
                "surfaces": [
                  {
                    "surface": "activity"
                  }
                ],
                "layout": {
                  "mode": "inline"
                },
                "brand": {
                  "name": "Rewards",
                  "theme": "light",
                  "light": {
                    "accent": "#1d4ed8",
                    "accent_ink": "#ffffff",
                    "canvas": "#ffffff",
                    "ink": "#111111"
                  },
                  "radius": "medium",
                  "font": "system"
                },
                "locale": {
                  "default": "en",
                  "supported": [
                    "en"
                  ],
                  "follow_parent": true
                }
              }
            },
            "success": {
              "status": 200,
              "body": {
                "id": "ptl_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                "key": "rewards",
                "name": "Rewards widget",
                "status": "active",
                "draft": {
                  "schema": "portal/v1",
                  "allowed_parent_origins": [
                    "https://shop.example"
                  ],
                  "surfaces": [
                    {
                      "surface": "activity"
                    }
                  ],
                  "layout": {
                    "mode": "inline"
                  },
                  "brand": {
                    "name": "Rewards",
                    "theme": "light",
                    "light": {
                      "accent": "#1d4ed8",
                      "accent_ink": "#ffffff",
                      "canvas": "#ffffff",
                      "ink": "#111111"
                    },
                    "radius": "medium",
                    "font": "system"
                  },
                  "locale": {
                    "default": "en",
                    "supported": [
                      "en"
                    ],
                    "follow_parent": true
                  }
                },
                "revision": 3,
                "session_generation": 1,
                "active_version": {
                  "id": "ptv_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "number": 1,
                  "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "created_by": "key_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "created_at": "2026-10-01T12:00:00.000Z"
                },
                "created_at": "2026-10-01T12:00:00.000Z",
                "updated_at": "2026-10-01T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"3\""
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 200,
              "body": {
                "id": "ptl_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                "key": "rewards",
                "name": "Rewards widget",
                "status": "active",
                "draft": {
                  "schema": "portal/v1",
                  "allowed_parent_origins": [
                    "https://shop.example"
                  ],
                  "surfaces": [
                    {
                      "surface": "activity"
                    }
                  ],
                  "layout": {
                    "mode": "inline"
                  },
                  "brand": {
                    "name": "Rewards",
                    "theme": "light",
                    "light": {
                      "accent": "#1d4ed8",
                      "accent_ink": "#ffffff",
                      "canvas": "#ffffff",
                      "ink": "#111111"
                    },
                    "radius": "medium",
                    "font": "system"
                  },
                  "locale": {
                    "default": "en",
                    "supported": [
                      "en"
                    ],
                    "follow_parent": true
                  }
                },
                "revision": 3,
                "session_generation": 1,
                "active_version": {
                  "id": "ptv_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "number": 1,
                  "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "created_by": "key_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "created_at": "2026-10-01T12:00:00.000Z"
                },
                "created_at": "2026-10-01T12:00:00.000Z",
                "updated_at": "2026-10-01T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"3\"",
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "portal_configuration"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "portal_configurations:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "portal_configurations:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Required revision, checked in the owning transaction."
            },
            "required": true,
            "description": "Required revision, checked in the owning transaction."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "Rewards widget",
                "draft": {
                  "schema": "portal/v1",
                  "allowed_parent_origins": [
                    "https://shop.example"
                  ],
                  "surfaces": [
                    {
                      "surface": "activity"
                    }
                  ],
                  "layout": {
                    "mode": "inline"
                  },
                  "brand": {
                    "name": "Rewards",
                    "theme": "light",
                    "light": {
                      "accent": "#1d4ed8",
                      "accent_ink": "#ffffff",
                      "canvas": "#ffffff",
                      "ink": "#111111"
                    },
                    "radius": "medium",
                    "font": "system"
                  },
                  "locale": {
                    "default": "en",
                    "supported": [
                      "en"
                    ],
                    "follow_parent": true
                  }
                }
              },
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "draft": {
                    "anyOf": [
                      {
                        "$ref": "#/components/schemas/PortalDocument"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortalConfiguration"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/portal_configurations/{id}/versions": {
      "get": {
        "summary": "List the immutable versions of a portal configuration, newest first",
        "tags": [
          "portal configurations"
        ],
        "operationId": "list_portal_configuration_versions",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "portal_configuration",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 100
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [
                  {
                    "id": "ptv_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                    "number": 1,
                    "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                    "created_by": "key_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                    "created_at": "2026-10-01T12:00:00.000Z",
                    "portal_id": "ptl_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                    "document": {
                      "schema": "portal/v1",
                      "allowed_parent_origins": [
                        "https://shop.example"
                      ],
                      "surfaces": [
                        {
                          "surface": "activity"
                        }
                      ],
                      "layout": {
                        "mode": "inline"
                      },
                      "brand": {
                        "name": "Rewards",
                        "theme": "light",
                        "light": {
                          "accent": "#1d4ed8",
                          "accent_ink": "#ffffff",
                          "canvas": "#ffffff",
                          "ink": "#111111"
                        },
                        "radius": "medium",
                        "font": "system"
                      },
                      "locale": {
                        "default": "en",
                        "supported": [
                          "en"
                        ],
                        "follow_parent": true
                      }
                    }
                  }
                ],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "portal_configurations:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "portal_configurations:read"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 100
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PortalConfigurationVersion"
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Publish the draft as the next immutable version and make it active",
        "tags": [
          "portal configurations"
        ],
        "operationId": "publish_portal_configuration",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "stale_write",
            "concurrent_update"
          ],
          "resource": "portal_configuration",
          "action": "create",
          "examples": {
            "request": {
              "expected_revision": 2
            },
            "success": {
              "status": 201,
              "body": {
                "id": "ptl_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                "key": "rewards",
                "name": "Rewards widget",
                "status": "active",
                "draft": {
                  "schema": "portal/v1",
                  "allowed_parent_origins": [
                    "https://shop.example"
                  ],
                  "surfaces": [
                    {
                      "surface": "activity"
                    }
                  ],
                  "layout": {
                    "mode": "inline"
                  },
                  "brand": {
                    "name": "Rewards",
                    "theme": "light",
                    "light": {
                      "accent": "#1d4ed8",
                      "accent_ink": "#ffffff",
                      "canvas": "#ffffff",
                      "ink": "#111111"
                    },
                    "radius": "medium",
                    "font": "system"
                  },
                  "locale": {
                    "default": "en",
                    "supported": [
                      "en"
                    ],
                    "follow_parent": true
                  }
                },
                "revision": 3,
                "session_generation": 1,
                "active_version": {
                  "id": "ptv_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "number": 1,
                  "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "created_by": "key_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "created_at": "2026-10-01T12:00:00.000Z"
                },
                "created_at": "2026-10-01T12:00:00.000Z",
                "updated_at": "2026-10-01T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"3\""
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "ptl_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                "key": "rewards",
                "name": "Rewards widget",
                "status": "active",
                "draft": {
                  "schema": "portal/v1",
                  "allowed_parent_origins": [
                    "https://shop.example"
                  ],
                  "surfaces": [
                    {
                      "surface": "activity"
                    }
                  ],
                  "layout": {
                    "mode": "inline"
                  },
                  "brand": {
                    "name": "Rewards",
                    "theme": "light",
                    "light": {
                      "accent": "#1d4ed8",
                      "accent_ink": "#ffffff",
                      "canvas": "#ffffff",
                      "ink": "#111111"
                    },
                    "radius": "medium",
                    "font": "system"
                  },
                  "locale": {
                    "default": "en",
                    "supported": [
                      "en"
                    ],
                    "follow_parent": true
                  }
                },
                "revision": 3,
                "session_generation": 1,
                "active_version": {
                  "id": "ptv_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "number": 1,
                  "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "created_by": "key_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "created_at": "2026-10-01T12:00:00.000Z"
                },
                "created_at": "2026-10-01T12:00:00.000Z",
                "updated_at": "2026-10-01T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"3\"",
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "portal_configuration"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "portal_configurations:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "portal_configurations:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "expected_revision": 2
              },
              "schema": {
                "type": "object",
                "properties": {
                  "expected_revision": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "expected_revision"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortalConfiguration"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/portal_configurations/{id}/activations": {
      "post": {
        "summary": "Make an existing version active (rollback or roll forward)",
        "tags": [
          "portal configurations"
        ],
        "operationId": "activate_portal_configuration_version",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "stale_write",
            "concurrent_update"
          ],
          "resource": "portal_configuration",
          "action": "transition",
          "examples": {
            "request": {
              "version_id": "ptv_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
              "expected_revision": 3
            },
            "success": {
              "status": 201,
              "body": {
                "id": "ptl_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                "key": "rewards",
                "name": "Rewards widget",
                "status": "active",
                "draft": {
                  "schema": "portal/v1",
                  "allowed_parent_origins": [
                    "https://shop.example"
                  ],
                  "surfaces": [
                    {
                      "surface": "activity"
                    }
                  ],
                  "layout": {
                    "mode": "inline"
                  },
                  "brand": {
                    "name": "Rewards",
                    "theme": "light",
                    "light": {
                      "accent": "#1d4ed8",
                      "accent_ink": "#ffffff",
                      "canvas": "#ffffff",
                      "ink": "#111111"
                    },
                    "radius": "medium",
                    "font": "system"
                  },
                  "locale": {
                    "default": "en",
                    "supported": [
                      "en"
                    ],
                    "follow_parent": true
                  }
                },
                "revision": 3,
                "session_generation": 1,
                "active_version": {
                  "id": "ptv_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "number": 1,
                  "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "created_by": "key_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "created_at": "2026-10-01T12:00:00.000Z"
                },
                "created_at": "2026-10-01T12:00:00.000Z",
                "updated_at": "2026-10-01T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"3\""
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "ptl_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                "key": "rewards",
                "name": "Rewards widget",
                "status": "active",
                "draft": {
                  "schema": "portal/v1",
                  "allowed_parent_origins": [
                    "https://shop.example"
                  ],
                  "surfaces": [
                    {
                      "surface": "activity"
                    }
                  ],
                  "layout": {
                    "mode": "inline"
                  },
                  "brand": {
                    "name": "Rewards",
                    "theme": "light",
                    "light": {
                      "accent": "#1d4ed8",
                      "accent_ink": "#ffffff",
                      "canvas": "#ffffff",
                      "ink": "#111111"
                    },
                    "radius": "medium",
                    "font": "system"
                  },
                  "locale": {
                    "default": "en",
                    "supported": [
                      "en"
                    ],
                    "follow_parent": true
                  }
                },
                "revision": 3,
                "session_generation": 1,
                "active_version": {
                  "id": "ptv_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "number": 1,
                  "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "created_by": "key_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "created_at": "2026-10-01T12:00:00.000Z"
                },
                "created_at": "2026-10-01T12:00:00.000Z",
                "updated_at": "2026-10-01T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"3\"",
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "portal_configuration"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "portal_configurations:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "portal_configurations:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "version_id": "ptv_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                "expected_revision": 3
              },
              "schema": {
                "type": "object",
                "properties": {
                  "version_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  },
                  "expected_revision": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "version_id",
                  "expected_revision"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortalConfiguration"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/portal_configurations/{id}/disable": {
      "post": {
        "summary": "Disable a portal: new loads and every embed token end",
        "tags": [
          "portal configurations"
        ],
        "operationId": "disable_portal_configuration",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "stale_write",
            "concurrent_update"
          ],
          "resource": "portal_configuration",
          "action": "transition",
          "examples": {
            "request": {
              "expected_revision": 3
            },
            "success": {
              "status": 201,
              "body": {
                "id": "ptl_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                "key": "rewards",
                "name": "Rewards widget",
                "status": "disabled",
                "draft": {
                  "schema": "portal/v1",
                  "allowed_parent_origins": [
                    "https://shop.example"
                  ],
                  "surfaces": [
                    {
                      "surface": "activity"
                    }
                  ],
                  "layout": {
                    "mode": "inline"
                  },
                  "brand": {
                    "name": "Rewards",
                    "theme": "light",
                    "light": {
                      "accent": "#1d4ed8",
                      "accent_ink": "#ffffff",
                      "canvas": "#ffffff",
                      "ink": "#111111"
                    },
                    "radius": "medium",
                    "font": "system"
                  },
                  "locale": {
                    "default": "en",
                    "supported": [
                      "en"
                    ],
                    "follow_parent": true
                  }
                },
                "revision": 3,
                "session_generation": 1,
                "active_version": {
                  "id": "ptv_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "number": 1,
                  "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "created_by": "key_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "created_at": "2026-10-01T12:00:00.000Z"
                },
                "created_at": "2026-10-01T12:00:00.000Z",
                "updated_at": "2026-10-01T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"3\""
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "ptl_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                "key": "rewards",
                "name": "Rewards widget",
                "status": "disabled",
                "draft": {
                  "schema": "portal/v1",
                  "allowed_parent_origins": [
                    "https://shop.example"
                  ],
                  "surfaces": [
                    {
                      "surface": "activity"
                    }
                  ],
                  "layout": {
                    "mode": "inline"
                  },
                  "brand": {
                    "name": "Rewards",
                    "theme": "light",
                    "light": {
                      "accent": "#1d4ed8",
                      "accent_ink": "#ffffff",
                      "canvas": "#ffffff",
                      "ink": "#111111"
                    },
                    "radius": "medium",
                    "font": "system"
                  },
                  "locale": {
                    "default": "en",
                    "supported": [
                      "en"
                    ],
                    "follow_parent": true
                  }
                },
                "revision": 3,
                "session_generation": 1,
                "active_version": {
                  "id": "ptv_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "number": 1,
                  "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "created_by": "key_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "created_at": "2026-10-01T12:00:00.000Z"
                },
                "created_at": "2026-10-01T12:00:00.000Z",
                "updated_at": "2026-10-01T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"3\"",
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "portal_configuration"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "portal_configurations:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "portal_configurations:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "expected_revision": 3
              },
              "schema": {
                "type": "object",
                "properties": {
                  "expected_revision": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "expected_revision"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortalConfiguration"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/portal_configurations/{id}/enable": {
      "post": {
        "summary": "Enable a disabled portal (earlier embed tokens stay refused)",
        "tags": [
          "portal configurations"
        ],
        "operationId": "enable_portal_configuration",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "stale_write",
            "concurrent_update"
          ],
          "resource": "portal_configuration",
          "action": "transition",
          "examples": {
            "request": {
              "expected_revision": 3
            },
            "success": {
              "status": 201,
              "body": {
                "id": "ptl_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                "key": "rewards",
                "name": "Rewards widget",
                "status": "active",
                "draft": {
                  "schema": "portal/v1",
                  "allowed_parent_origins": [
                    "https://shop.example"
                  ],
                  "surfaces": [
                    {
                      "surface": "activity"
                    }
                  ],
                  "layout": {
                    "mode": "inline"
                  },
                  "brand": {
                    "name": "Rewards",
                    "theme": "light",
                    "light": {
                      "accent": "#1d4ed8",
                      "accent_ink": "#ffffff",
                      "canvas": "#ffffff",
                      "ink": "#111111"
                    },
                    "radius": "medium",
                    "font": "system"
                  },
                  "locale": {
                    "default": "en",
                    "supported": [
                      "en"
                    ],
                    "follow_parent": true
                  }
                },
                "revision": 3,
                "session_generation": 1,
                "active_version": {
                  "id": "ptv_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "number": 1,
                  "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "created_by": "key_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "created_at": "2026-10-01T12:00:00.000Z"
                },
                "created_at": "2026-10-01T12:00:00.000Z",
                "updated_at": "2026-10-01T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"3\""
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "ptl_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                "key": "rewards",
                "name": "Rewards widget",
                "status": "active",
                "draft": {
                  "schema": "portal/v1",
                  "allowed_parent_origins": [
                    "https://shop.example"
                  ],
                  "surfaces": [
                    {
                      "surface": "activity"
                    }
                  ],
                  "layout": {
                    "mode": "inline"
                  },
                  "brand": {
                    "name": "Rewards",
                    "theme": "light",
                    "light": {
                      "accent": "#1d4ed8",
                      "accent_ink": "#ffffff",
                      "canvas": "#ffffff",
                      "ink": "#111111"
                    },
                    "radius": "medium",
                    "font": "system"
                  },
                  "locale": {
                    "default": "en",
                    "supported": [
                      "en"
                    ],
                    "follow_parent": true
                  }
                },
                "revision": 3,
                "session_generation": 1,
                "active_version": {
                  "id": "ptv_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "number": 1,
                  "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "created_by": "key_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                  "created_at": "2026-10-01T12:00:00.000Z"
                },
                "created_at": "2026-10-01T12:00:00.000Z",
                "updated_at": "2026-10-01T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"3\"",
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "portal_configuration"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "portal_configurations:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "portal_configurations:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "expected_revision": 3
              },
              "schema": {
                "type": "object",
                "properties": {
                  "expected_revision": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "expected_revision"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortalConfiguration"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/public/portals/{portal_id}": {
      "get": {
        "summary": "The render configuration of a portal's active version, for the portal server",
        "tags": [
          "portal configurations"
        ],
        "operationId": "get_public_portal",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "resource_not_found"
          ],
          "resource": "public_portals",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "portal_id": "ptl_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                "version_id": "ptv_0192f0c0a0b07c3d8e9f0a1b2c3d4e5f",
                "version_number": 1,
                "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "document": {
                  "schema": "portal/v1",
                  "allowed_parent_origins": [
                    "https://shop.example"
                  ],
                  "surfaces": [
                    {
                      "surface": "activity"
                    }
                  ],
                  "layout": {
                    "mode": "inline"
                  },
                  "brand": {
                    "name": "Rewards",
                    "theme": "light",
                    "light": {
                      "accent": "#1d4ed8",
                      "accent_ink": "#ffffff",
                      "canvas": "#ffffff",
                      "ink": "#111111"
                    },
                    "radius": "medium",
                    "font": "system"
                  },
                  "locale": {
                    "default": "en",
                    "supported": [
                      "en"
                    ],
                    "follow_parent": true
                  },
                  "terminology": {
                    "en": {
                      "points": {
                        "singular": "point",
                        "plural": "points"
                      }
                    }
                  },
                  "mechanics": {
                    "quests": "enabled"
                  }
                },
                "widget_origin": "https://widget.orishare.example"
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [],
        "security": [],
        "parameters": [
          {
            "in": "path",
            "name": "portal_id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 64
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicPortal"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/assets": {
      "post": {
        "summary": "Upload an immutable normalized image",
        "tags": [
          "assets"
        ],
        "operationId": "post_assets",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_cursor",
            "body_too_large",
            "asset_processing_unavailable",
            "asset_quota_exceeded"
          ],
          "resource": "asset",
          "action": "create",
          "examples": {
            "success": {
              "status": 201,
              "body": {
                "id": "ast_example",
                "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "byte_length": 83,
                "width": 1,
                "height": 1,
                "content_type": "image/png",
                "created_at": "2026-09-22T12:00:00.000Z",
                "public_url": "/v1/public_assets/ast_example/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "request": {
              "content_type": "image/png",
              "bytes_base64": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg=="
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "ast_example",
                "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "byte_length": 83,
                "width": 1,
                "height": 1,
                "content_type": "image/png",
                "created_at": "2026-09-22T12:00:00.000Z",
                "public_url": "/v1/public_assets/ast_example/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "asset_quota_exceeded",
                  "message": "asset quota exceeded",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#asset_quota_exceeded",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 503,
              "body": {
                "error": {
                  "type": "api_error",
                  "code": "asset_processing_unavailable",
                  "message": "asset processing unavailable",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#asset_processing_unavailable",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "assets"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "assets:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session",
              "staff"
            ],
            "environment": "selected",
            "scopes": [
              "assets:write"
            ]
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "content_type": "image/png",
                "bytes_base64": "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg=="
              },
              "schema": {
                "type": "object",
                "properties": {
                  "content_type": {
                    "type": "string",
                    "enum": [
                      "image/png",
                      "image/jpeg",
                      "image/webp"
                    ]
                  },
                  "bytes_base64": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 349528
                  }
                },
                "required": [
                  "content_type",
                  "bytes_base64"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "digest": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "byte_length": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 524288
                    },
                    "width": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 4096
                    },
                    "height": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 4096
                    },
                    "content_type": {
                      "type": "string",
                      "const": "image/png"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "public_url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "digest",
                    "byte_length",
                    "width",
                    "height",
                    "content_type",
                    "created_at",
                    "public_url"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "List immutable asset metadata",
        "tags": [
          "assets"
        ],
        "operationId": "get_assets",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "asset",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [
                  {
                    "id": "ast_example",
                    "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                    "byte_length": 83,
                    "width": 1,
                    "height": 1,
                    "content_type": "image/png",
                    "created_at": "2026-09-22T12:00:00.000Z",
                    "public_url": "/v1/public_assets/ast_example/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
                  }
                ],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "assets:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session",
              "staff"
            ],
            "environment": "selected",
            "scopes": [
              "assets:read"
            ]
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "digest": {
                            "type": "string",
                            "pattern": "^[a-f0-9]{64}$"
                          },
                          "byte_length": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 524288
                          },
                          "width": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 4096
                          },
                          "height": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 4096
                          },
                          "content_type": {
                            "type": "string",
                            "const": "image/png"
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "public_url": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "digest",
                          "byte_length",
                          "width",
                          "height",
                          "content_type",
                          "created_at",
                          "public_url"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/assets/{id}": {
      "get": {
        "summary": "Read immutable asset metadata",
        "tags": [
          "assets"
        ],
        "operationId": "get_assets_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "asset",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "ast_example",
                "digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                "byte_length": 83,
                "width": 1,
                "height": 1,
                "content_type": "image/png",
                "created_at": "2026-09-22T12:00:00.000Z",
                "public_url": "/v1/public_assets/ast_example/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "assets:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session",
              "staff"
            ],
            "environment": "selected",
            "scopes": [
              "assets:read"
            ]
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "digest": {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    "byte_length": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 524288
                    },
                    "width": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 4096
                    },
                    "height": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 4096
                    },
                    "content_type": {
                      "type": "string",
                      "const": "image/png"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "public_url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "digest",
                    "byte_length",
                    "width",
                    "height",
                    "content_type",
                    "created_at",
                    "public_url"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/public_assets/{id}/{digest}": {
      "get": {
        "summary": "Read immutable normalized image bytes",
        "tags": [
          "assets"
        ],
        "operationId": "get_public_asset",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "resource_not_found",
            "invalid_cursor"
          ],
          "transport": {
            "kind": "binary",
            "contentType": "image/png",
            "maxBytes": 524288
          },
          "resource": "asset",
          "action": "read",
          "examples": {
            "success": {
              "status": 200
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [],
        "security": [],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "required": true
          },
          {
            "in": "path",
            "name": "digest",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "required": true
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "image/png": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "304": {
            "description": "No content"
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customer/state_changes": {
      "get": {
        "summary": "Receive bounded customer state invalidations",
        "tags": [
          "customer surface"
        ],
        "operationId": "get_customer_state_changes",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "environment_required",
            "environment_served_elsewhere",
            "invalid_customer_session",
            "insufficient_customer_scope",
            "customer_surface_inactive",
            "rate_limited",
            "customer_admission_unavailable",
            "origin_not_allowed"
          ],
          "transport": {
            "kind": "stream",
            "contentType": "text/event-stream"
          },
          "customerSurface": true,
          "resource": "customer_surface",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "headers": {
                "Content-Type": "text/event-stream"
              }
            },
            "permissionFailure": {
              "status": 401,
              "body": {
                "error": {
                  "type": "authentication",
                  "code": "invalid_customer_session",
                  "message": "invalid customer session",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#invalid_customer_session",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "none",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "customer_session"
            ],
            "environment": "credential_bound",
            "scopes": [
              "customer:read"
            ]
          }
        ],
        "security": [
          {
            "publishableKey": [],
            "customerToken": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Last-Event-ID",
            "schema": {
              "description": "Signed customer-bound invalidation cursor; an invalid cursor requests a fresh snapshot.",
              "type": "string",
              "maxLength": 2048
            },
            "description": "Signed customer-bound invalidation cursor; an invalid cursor requests a fresh snapshot."
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/currencies": {
      "get": {
        "summary": "List currencies",
        "tags": [
          "ledger"
        ],
        "operationId": "get_currencies",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "currencies",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [
                  {
                    "id": "cur_0123456789abcdef0123456789abcdef",
                    "code": "points",
                    "name": "Points",
                    "precision": 0,
                    "expiration_policy": {
                      "type": "never"
                    },
                    "negative_balance": "forbid",
                    "version": 1,
                    "created_at": "2026-09-20T12:00:00.000Z",
                    "updated_at": "2026-09-20T12:00:00.000Z"
                  }
                ],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads configuration of the selected environment through its environment-scoped resolution."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "currencies:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "currencies:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "code": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "precision": {
                            "type": "number"
                          },
                          "expiration_policy": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "enum": [
                                  "never",
                                  "days"
                                ]
                              },
                              "days": {
                                "type": "number",
                                "exclusiveMinimum": 0
                              }
                            },
                            "required": [
                              "type"
                            ],
                            "additionalProperties": false
                          },
                          "negative_balance": {
                            "type": "string",
                            "enum": [
                              "forbid",
                              "allow"
                            ]
                          },
                          "capabilities": {
                            "type": "object",
                            "properties": {
                              "schema": {
                                "type": "string",
                                "const": "orishare.currency-capabilities/v1"
                              },
                              "spendable": {
                                "type": "boolean"
                              },
                              "transferable": {
                                "type": "boolean"
                              },
                              "qualification": {
                                "type": "string",
                                "enum": [
                                  "none",
                                  "earned",
                                  "xp"
                                ]
                              },
                              "expiry": {
                                "oneOf": [
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "none"
                                      }
                                    },
                                    "required": [
                                      "type"
                                    ],
                                    "additionalProperties": false
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "type": {
                                        "type": "string",
                                        "const": "after"
                                      },
                                      "seconds": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 3153600000
                                      }
                                    },
                                    "required": [
                                      "type",
                                      "seconds"
                                    ],
                                    "additionalProperties": false
                                  }
                                ],
                                "type": "object"
                              }
                            },
                            "required": [
                              "schema",
                              "spendable",
                              "transferable",
                              "qualification",
                              "expiry"
                            ],
                            "additionalProperties": false
                          },
                          "version": {
                            "type": "number"
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "id",
                          "code",
                          "name",
                          "precision",
                          "expiration_policy",
                          "negative_balance",
                          "version",
                          "created_at",
                          "updated_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a currency",
        "tags": [
          "ledger"
        ],
        "operationId": "post_currencies",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "already_exists",
            "capability_unavailable"
          ],
          "resource": "currencies",
          "action": "create",
          "examples": {
            "request": {
              "code": "points",
              "name": "Points"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "cur_0123456789abcdef0123456789abcdef",
                "code": "points",
                "name": "Points",
                "precision": 0,
                "expiration_policy": {
                  "type": "never"
                },
                "negative_balance": "forbid",
                "version": 1,
                "created_at": "2026-09-20T12:00:00.000Z",
                "updated_at": "2026-09-20T12:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "already_exists",
                  "message": "already exists",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#already_exists",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "cur_0123456789abcdef0123456789abcdef",
                "code": "points",
                "name": "Points",
                "precision": 0,
                "expiration_policy": {
                  "type": "never"
                },
                "negative_balance": "forbid",
                "version": 1,
                "created_at": "2026-09-20T12:00:00.000Z",
                "updated_at": "2026-09-20T12:00:00.000Z"
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "currencies"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "currencies:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "currencies:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "code": "points",
                "name": "Points"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9_]{0,31}$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "precision": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 6
                  },
                  "expiration_policy": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "never",
                          "days"
                        ]
                      },
                      "days": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "type"
                    ]
                  },
                  "negative_balance": {
                    "type": "string",
                    "enum": [
                      "forbid",
                      "allow"
                    ]
                  },
                  "capabilities": {
                    "type": "object",
                    "properties": {
                      "schema": {
                        "type": "string",
                        "const": "orishare.currency-capabilities/v1"
                      },
                      "spendable": {
                        "type": "boolean"
                      },
                      "transferable": {
                        "type": "boolean"
                      },
                      "qualification": {
                        "type": "string",
                        "enum": [
                          "none",
                          "earned",
                          "xp"
                        ]
                      },
                      "expiry": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "const": "none"
                              }
                            },
                            "required": [
                              "type"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "const": "after"
                              },
                              "seconds": {
                                "type": "integer",
                                "minimum": 1,
                                "maximum": 3153600000
                              }
                            },
                            "required": [
                              "type",
                              "seconds"
                            ],
                            "additionalProperties": false
                          }
                        ],
                        "type": "object"
                      }
                    },
                    "required": [
                      "schema",
                      "spendable",
                      "transferable",
                      "qualification",
                      "expiry"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "code",
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "precision": {
                      "type": "number"
                    },
                    "expiration_policy": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "never",
                            "days"
                          ]
                        },
                        "days": {
                          "type": "number",
                          "exclusiveMinimum": 0
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    "negative_balance": {
                      "type": "string",
                      "enum": [
                        "forbid",
                        "allow"
                      ]
                    },
                    "capabilities": {
                      "type": "object",
                      "properties": {
                        "schema": {
                          "type": "string",
                          "const": "orishare.currency-capabilities/v1"
                        },
                        "spendable": {
                          "type": "boolean"
                        },
                        "transferable": {
                          "type": "boolean"
                        },
                        "qualification": {
                          "type": "string",
                          "enum": [
                            "none",
                            "earned",
                            "xp"
                          ]
                        },
                        "expiry": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "const": "none"
                                }
                              },
                              "required": [
                                "type"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "const": "after"
                                },
                                "seconds": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 3153600000
                                }
                              },
                              "required": [
                                "type",
                                "seconds"
                              ],
                              "additionalProperties": false
                            }
                          ],
                          "type": "object"
                        }
                      },
                      "required": [
                        "schema",
                        "spendable",
                        "transferable",
                        "qualification",
                        "expiry"
                      ],
                      "additionalProperties": false
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "code",
                    "name",
                    "precision",
                    "expiration_policy",
                    "negative_balance",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "501": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/currencies/{id}": {
      "get": {
        "summary": "One currency by id or code",
        "tags": [
          "ledger"
        ],
        "operationId": "get_currencies_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found"
          ],
          "resource": "currencies",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "cur_0123456789abcdef0123456789abcdef",
                "code": "points",
                "name": "Points",
                "precision": 0,
                "expiration_policy": {
                  "type": "never"
                },
                "negative_balance": "forbid",
                "version": 1,
                "created_at": "2026-09-20T12:00:00.000Z",
                "updated_at": "2026-09-20T12:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads configuration of the selected environment through its environment-scoped resolution."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "currencies:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "currencies:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "precision": {
                      "type": "number"
                    },
                    "expiration_policy": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "never",
                            "days"
                          ]
                        },
                        "days": {
                          "type": "number",
                          "exclusiveMinimum": 0
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    "negative_balance": {
                      "type": "string",
                      "enum": [
                        "forbid",
                        "allow"
                      ]
                    },
                    "capabilities": {
                      "type": "object",
                      "properties": {
                        "schema": {
                          "type": "string",
                          "const": "orishare.currency-capabilities/v1"
                        },
                        "spendable": {
                          "type": "boolean"
                        },
                        "transferable": {
                          "type": "boolean"
                        },
                        "qualification": {
                          "type": "string",
                          "enum": [
                            "none",
                            "earned",
                            "xp"
                          ]
                        },
                        "expiry": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "const": "none"
                                }
                              },
                              "required": [
                                "type"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "const": "after"
                                },
                                "seconds": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 3153600000
                                }
                              },
                              "required": [
                                "type",
                                "seconds"
                              ],
                              "additionalProperties": false
                            }
                          ],
                          "type": "object"
                        }
                      },
                      "required": [
                        "schema",
                        "spendable",
                        "transferable",
                        "qualification",
                        "expiry"
                      ],
                      "additionalProperties": false
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "code",
                    "name",
                    "precision",
                    "expiration_policy",
                    "negative_balance",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Rename, change expiration policy or negative-balance policy",
        "tags": [
          "ledger"
        ],
        "operationId": "patch_currencies_id",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "optional",
            "responseEtag": true
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "resource_not_found",
            "concurrent_update"
          ],
          "resource": "currencies",
          "action": "update",
          "examples": {
            "request": {
              "name": "Updated"
            },
            "success": {
              "status": 200,
              "body": {
                "id": "cur_0123456789abcdef0123456789abcdef",
                "code": "points",
                "name": "Points",
                "precision": 0,
                "expiration_policy": {
                  "type": "never"
                },
                "negative_balance": "forbid",
                "version": 1,
                "created_at": "2026-09-20T12:00:00.000Z",
                "updated_at": "2026-09-20T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"1\""
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "currencies"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "currencies:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "currencies:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Optional legacy revision. Missing or malformed values follow the existing route parser."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "Updated"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "expiration_policy": {
                    "type": "object",
                    "properties": {
                      "type": {
                        "type": "string",
                        "enum": [
                          "never",
                          "days"
                        ]
                      },
                      "days": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "type"
                    ]
                  },
                  "negative_balance": {
                    "type": "string",
                    "enum": [
                      "forbid",
                      "allow"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "code": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "precision": {
                      "type": "number"
                    },
                    "expiration_policy": {
                      "type": "object",
                      "properties": {
                        "type": {
                          "type": "string",
                          "enum": [
                            "never",
                            "days"
                          ]
                        },
                        "days": {
                          "type": "number",
                          "exclusiveMinimum": 0
                        }
                      },
                      "required": [
                        "type"
                      ],
                      "additionalProperties": false
                    },
                    "negative_balance": {
                      "type": "string",
                      "enum": [
                        "forbid",
                        "allow"
                      ]
                    },
                    "capabilities": {
                      "type": "object",
                      "properties": {
                        "schema": {
                          "type": "string",
                          "const": "orishare.currency-capabilities/v1"
                        },
                        "spendable": {
                          "type": "boolean"
                        },
                        "transferable": {
                          "type": "boolean"
                        },
                        "qualification": {
                          "type": "string",
                          "enum": [
                            "none",
                            "earned",
                            "xp"
                          ]
                        },
                        "expiry": {
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "const": "none"
                                }
                              },
                              "required": [
                                "type"
                              ],
                              "additionalProperties": false
                            },
                            {
                              "type": "object",
                              "properties": {
                                "type": {
                                  "type": "string",
                                  "const": "after"
                                },
                                "seconds": {
                                  "type": "integer",
                                  "minimum": 1,
                                  "maximum": 3153600000
                                }
                              },
                              "required": [
                                "type",
                                "seconds"
                              ],
                              "additionalProperties": false
                            }
                          ],
                          "type": "object"
                        }
                      },
                      "required": [
                        "schema",
                        "spendable",
                        "transferable",
                        "qualification",
                        "expiry"
                      ],
                      "additionalProperties": false
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "code",
                    "name",
                    "precision",
                    "expiration_policy",
                    "negative_balance",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete an unused currency (409 when referenced)",
        "tags": [
          "ledger"
        ],
        "operationId": "delete_currencies_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "resource_in_use"
          ],
          "resource": "currencies",
          "action": "delete",
          "examples": {
            "success": {
              "status": 204
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "resource_in_use",
                  "message": "resource in use",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#resource_in_use",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": true,
            "effectFamilies": [
              "currencies"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "currencies:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "currencies:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/ledger_entries": {
      "post": {
        "summary": "Manual adjustment (positive credits a lot, negative spends FIFO)",
        "tags": [
          "ledger"
        ],
        "operationId": "post_ledger_entries",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "usage_allowance_exhausted",
            "free_allowance_exhausted",
            "live_requires_claim",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "invalid_state",
            "insufficient_balance"
          ],
          "resource": "ledger_entries",
          "action": "create",
          "examples": {
            "request": {
              "customer_id": "cust_0123456789abcdef0123456789abcdef",
              "currency": "points",
              "amount": 10,
              "reason": "Manual credit"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "le_0123456789abcdef0123456789abcdef",
                "customer_id": "cust_0123456789abcdef0123456789abcdef",
                "currency": "points",
                "type": "adjust",
                "status": "confirmed",
                "amount": 10,
                "remaining": 10,
                "confirm_at": null,
                "expires_at": null,
                "reversal_of": null,
                "source_type": "adjustment",
                "source_id": null,
                "idempotency_key": "adjust:example-credit",
                "reason": "Manual credit",
                "created_at": "2026-09-20T12:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "insufficient_balance",
                  "message": "insufficient balance",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_balance",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "le_0123456789abcdef0123456789abcdef",
                "customer_id": "cust_0123456789abcdef0123456789abcdef",
                "currency": "points",
                "type": "adjust",
                "status": "confirmed",
                "amount": 10,
                "remaining": 10,
                "confirm_at": null,
                "expires_at": null,
                "reversal_of": null,
                "source_type": "adjustment",
                "source_id": null,
                "idempotency_key": "adjust:example-credit",
                "reason": "Manual credit",
                "created_at": "2026-09-20T12:00:00.000Z"
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "ledger_entries"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "ledger:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "ledger:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "customer_id": "cust_0123456789abcdef0123456789abcdef",
                "currency": "points",
                "amount": 10,
                "reason": "Manual credit"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "customer_id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "currency": {
                    "type": "string",
                    "minLength": 1
                  },
                  "amount": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "reason": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 500
                  },
                  "expires_after_days": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "customer_id",
                  "currency",
                  "amount",
                  "reason"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "customer_id": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "earn",
                        "spend",
                        "expire",
                        "reverse",
                        "adjust"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "confirmed",
                        "voided"
                      ]
                    },
                    "amount": {
                      "type": "number"
                    },
                    "remaining": {
                      "type": "number"
                    },
                    "confirm_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "expires_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "reversal_of": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source_type": {
                      "type": "string"
                    },
                    "source_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "idempotency_key": {
                      "type": "string"
                    },
                    "reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "wallet_command": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "parts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "entry_id": {
                                "type": "string"
                              },
                              "customer_id": {
                                "type": "string"
                              },
                              "amount": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "entry_id",
                              "customer_id",
                              "amount"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "key",
                        "amount",
                        "parts"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "customer_id",
                    "currency",
                    "type",
                    "status",
                    "amount",
                    "remaining",
                    "confirm_at",
                    "expires_at",
                    "reversal_of",
                    "source_type",
                    "source_id",
                    "idempotency_key",
                    "reason",
                    "created_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "customer_id": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "earn",
                        "spend",
                        "expire",
                        "reverse",
                        "adjust"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "confirmed",
                        "voided"
                      ]
                    },
                    "amount": {
                      "type": "number"
                    },
                    "remaining": {
                      "type": "number"
                    },
                    "confirm_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "expires_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "reversal_of": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source_type": {
                      "type": "string"
                    },
                    "source_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "idempotency_key": {
                      "type": "string"
                    },
                    "reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "wallet_command": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "parts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "entry_id": {
                                "type": "string"
                              },
                              "customer_id": {
                                "type": "string"
                              },
                              "amount": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "entry_id",
                              "customer_id",
                              "amount"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "key",
                        "amount",
                        "parts"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "customer_id",
                    "currency",
                    "type",
                    "status",
                    "amount",
                    "remaining",
                    "confirm_at",
                    "expires_at",
                    "reversal_of",
                    "source_type",
                    "source_id",
                    "idempotency_key",
                    "reason",
                    "created_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "get": {
        "summary": "List entries (newest first)",
        "tags": [
          "ledger"
        ],
        "operationId": "get_ledger_entries",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "ledger_entries",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [
                  {
                    "id": "le_0123456789abcdef0123456789abcdef",
                    "customer_id": "cust_0123456789abcdef0123456789abcdef",
                    "currency": "points",
                    "type": "adjust",
                    "status": "confirmed",
                    "amount": 10,
                    "remaining": 10,
                    "confirm_at": null,
                    "expires_at": null,
                    "reversal_of": null,
                    "source_type": "adjustment",
                    "source_id": null,
                    "idempotency_key": "adjust:example-credit",
                    "reason": "Manual credit",
                    "created_at": "2026-09-20T12:00:00.000Z"
                  }
                ],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads customer data of the selected environment; identities are replaced by conversation references before the model or storage sees them."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "ledger:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "ledger:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "customer_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "currency",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string",
              "enum": [
                "earn",
                "spend",
                "expire",
                "reverse",
                "adjust"
              ]
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "customer_id": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "earn",
                              "spend",
                              "expire",
                              "reverse",
                              "adjust"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "pending",
                              "confirmed",
                              "voided"
                            ]
                          },
                          "amount": {
                            "type": "number"
                          },
                          "remaining": {
                            "type": "number"
                          },
                          "confirm_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "expires_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "reversal_of": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "source_type": {
                            "type": "string"
                          },
                          "source_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "idempotency_key": {
                            "type": "string"
                          },
                          "reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "wallet_command": {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string"
                              },
                              "amount": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "parts": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "entry_id": {
                                      "type": "string"
                                    },
                                    "customer_id": {
                                      "type": "string"
                                    },
                                    "amount": {
                                      "type": "integer",
                                      "minimum": -9007199254740991,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "entry_id",
                                    "customer_id",
                                    "amount"
                                  ],
                                  "additionalProperties": false
                                }
                              }
                            },
                            "required": [
                              "key",
                              "amount",
                              "parts"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "id",
                          "customer_id",
                          "currency",
                          "type",
                          "status",
                          "amount",
                          "remaining",
                          "confirm_at",
                          "expires_at",
                          "reversal_of",
                          "source_type",
                          "source_id",
                          "idempotency_key",
                          "reason",
                          "created_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/ledger_entries/{id}": {
      "get": {
        "summary": "One entry",
        "tags": [
          "ledger"
        ],
        "operationId": "get_ledger_entries_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found"
          ],
          "resource": "ledger_entries",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "le_0123456789abcdef0123456789abcdef",
                "customer_id": "cust_0123456789abcdef0123456789abcdef",
                "currency": "points",
                "type": "adjust",
                "status": "confirmed",
                "amount": 10,
                "remaining": 10,
                "confirm_at": null,
                "expires_at": null,
                "reversal_of": null,
                "source_type": "adjustment",
                "source_id": null,
                "idempotency_key": "adjust:example-credit",
                "reason": "Manual credit",
                "created_at": "2026-09-20T12:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads customer data of the selected environment; identities are replaced by conversation references before the model or storage sees them."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "ledger:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "ledger:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "customer_id": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "earn",
                        "spend",
                        "expire",
                        "reverse",
                        "adjust"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "confirmed",
                        "voided"
                      ]
                    },
                    "amount": {
                      "type": "number"
                    },
                    "remaining": {
                      "type": "number"
                    },
                    "confirm_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "expires_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "reversal_of": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source_type": {
                      "type": "string"
                    },
                    "source_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "idempotency_key": {
                      "type": "string"
                    },
                    "reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "wallet_command": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string"
                        },
                        "amount": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "parts": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "entry_id": {
                                "type": "string"
                              },
                              "customer_id": {
                                "type": "string"
                              },
                              "amount": {
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "entry_id",
                              "customer_id",
                              "amount"
                            ],
                            "additionalProperties": false
                          }
                        }
                      },
                      "required": [
                        "key",
                        "amount",
                        "parts"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "id",
                    "customer_id",
                    "currency",
                    "type",
                    "status",
                    "amount",
                    "remaining",
                    "confirm_at",
                    "expires_at",
                    "reversal_of",
                    "source_type",
                    "source_id",
                    "idempotency_key",
                    "reason",
                    "created_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{id}/balances": {
      "get": {
        "summary": "Balances per currency",
        "tags": [
          "ledger"
        ],
        "operationId": "get_customers_id_balances",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "balances",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [
                  {
                    "customer_id": "cust_0123456789abcdef0123456789abcdef",
                    "currency": "points",
                    "available": 10,
                    "pending": 0,
                    "lifetime_earned": 10,
                    "updated_at": "2026-09-20T12:00:00.000Z"
                  }
                ],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads customer data of the selected environment; identities are replaced by conversation references before the model or storage sees them."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "ledger:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "ledger:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "customer_id": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "available": {
                            "type": "number"
                          },
                          "pending": {
                            "type": "number"
                          },
                          "lifetime_earned": {
                            "type": "number"
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "customer_id",
                          "currency",
                          "available",
                          "pending",
                          "lifetime_earned",
                          "updated_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/capabilities": {
      "get": {
        "summary": "Read recognized rule actions and installed execution capabilities",
        "tags": [
          "rules"
        ],
        "operationId": "get_capabilities",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found"
          ],
          "resource": "capabilities",
          "action": "read",
          "examples": {
            "request": {},
            "success": {
              "status": 200,
              "body": {
                "schema_supported": [
                  "points.award",
                  "points.deduct",
                  "points.reverse",
                  "reward.issue",
                  "tier.evaluate",
                  "attribute.set",
                  "webhook.emit",
                  "counter.release",
                  "badge.grant",
                  "badge.contribute",
                  "streak.contribute",
                  "streak.freeze_grant",
                  "quest.contribute",
                  "quest.enroll",
                  "leaderboard.contribute",
                  "program.reverse_contribution",
                  "coupon.issue",
                  "discount.quote",
                  "friend_streak.activity",
                  "friend_quest.contribute",
                  "team_quest.contribute",
                  "item.grant"
                ],
                "execution_supported": [
                  "points.award",
                  "points.deduct",
                  "points.reverse",
                  "reward.issue",
                  "tier.evaluate",
                  "attribute.set",
                  "webhook.emit",
                  "counter.release",
                  "item.grant",
                  "quest.contribute",
                  "quest.enroll",
                  "program.reverse_contribution",
                  "friend_streak.activity",
                  "friend_quest.contribute",
                  "team_quest.contribute"
                ],
                "program_schemas": [
                  "orishare.program/v1",
                  "orishare.program/v2"
                ],
                "state_schemas": [
                  "orishare.mechanic-state/v1"
                ],
                "feature_versions": {}
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient_scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads what the selected environment supports."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "rules:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "rules:read"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schema_supported": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "execution_supported": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "program_schemas": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "state_schemas": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "feature_versions": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "schema_supported",
                    "execution_supported",
                    "program_schemas",
                    "state_schemas",
                    "feature_versions"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/rules": {
      "get": {
        "summary": "List rules",
        "tags": [
          "rules"
        ],
        "operationId": "get_rules",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "rules",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "request": {},
            "success": {
              "status": 200,
              "body": {
                "data": [],
                "has_more": false,
                "next_cursor": null
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient_scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads configuration of the selected environment through its environment-scoped resolution."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "rules:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "rules:read"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "published",
                "paused",
                "archived"
              ]
            }
          },
          {
            "in": "query",
            "name": "campaign_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "key": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "campaign_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "draft",
                              "published",
                              "paused",
                              "archived"
                            ]
                          },
                          "priority": {
                            "type": "number"
                          },
                          "active_version": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "id": {
                                    "type": "string"
                                  },
                                  "number": {
                                    "type": "number"
                                  },
                                  "definition": {
                                    "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                                  },
                                  "created_at": {
                                    "type": "string",
                                    "format": "date-time",
                                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                                  }
                                },
                                "required": [
                                  "id",
                                  "number",
                                  "definition",
                                  "created_at"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "draft_definition": {
                            "anyOf": [
                              {
                                "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "version": {
                            "type": "number"
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "id",
                          "key",
                          "name",
                          "campaign_id",
                          "status",
                          "priority",
                          "active_version",
                          "draft_definition",
                          "version",
                          "created_at",
                          "updated_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a draft rule (validated, not yet published)",
        "tags": [
          "rules"
        ],
        "operationId": "post_rules",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "rule_invalid"
          ],
          "resource": "rules",
          "action": "create",
          "examples": {
            "request": {
              "name": "Purchase points",
              "definition": {
                "schema": "orishare.rule/v1",
                "trigger": {
                  "event": "purchase"
                },
                "actions": [
                  {
                    "type": "points.award",
                    "currency": "points",
                    "amount": 10
                  }
                ]
              }
            },
            "success": {
              "status": 201,
              "body": {
                "id": "rule_00000000000000000000000000000042",
                "key": "rule_473b6b67293caa43ab044dbaa7f712c5fff3fe365b22846d",
                "name": "Purchase points",
                "campaign_id": null,
                "status": "draft",
                "priority": 0,
                "active_version": null,
                "draft_definition": {
                  "schema": "orishare.rule/v1",
                  "trigger": {
                    "event": "purchase"
                  },
                  "actions": [
                    {
                      "type": "points.award",
                      "currency": "points",
                      "amount": 10
                    }
                  ]
                },
                "version": 1,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient_scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent_update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "rule_00000000000000000000000000000042",
                "key": "rule_473b6b67293caa43ab044dbaa7f712c5fff3fe365b22846d",
                "name": "Purchase points",
                "campaign_id": null,
                "status": "draft",
                "priority": 0,
                "active_version": null,
                "draft_definition": {
                  "schema": "orishare.rule/v1",
                  "trigger": {
                    "event": "purchase"
                  },
                  "actions": [
                    {
                      "type": "points.award",
                      "currency": "points",
                      "amount": 10
                    }
                  ]
                },
                "version": 1,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z"
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency_key_reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "rules"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "rules:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "rules:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "Purchase points",
                "definition": {
                  "schema": "orishare.rule/v1",
                  "trigger": {
                    "event": "purchase"
                  },
                  "actions": [
                    {
                      "type": "points.award",
                      "currency": "points",
                      "amount": 10
                    }
                  ]
                }
              },
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "definition": {
                    "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                  },
                  "campaign_id": {
                    "type": "string"
                  },
                  "priority": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "ai_generation_id": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "definition"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "key": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "campaign_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "published",
                        "paused",
                        "archived"
                      ]
                    },
                    "priority": {
                      "type": "number"
                    },
                    "active_version": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "number": {
                              "type": "number"
                            },
                            "definition": {
                              "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            }
                          },
                          "required": [
                            "id",
                            "number",
                            "definition",
                            "created_at"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "draft_definition": {
                      "anyOf": [
                        {
                          "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "key",
                    "name",
                    "campaign_id",
                    "status",
                    "priority",
                    "active_version",
                    "draft_definition",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/rules/{id}": {
      "get": {
        "summary": "One rule with its active version and draft",
        "tags": [
          "rules"
        ],
        "operationId": "get_rules_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found"
          ],
          "resource": "rules",
          "action": "read",
          "examples": {
            "request": {},
            "success": {
              "status": 200,
              "body": {
                "id": "rule_00000000000000000000000000000042",
                "key": "rule_473b6b67293caa43ab044dbaa7f712c5fff3fe365b22846d",
                "name": "Purchase points",
                "campaign_id": null,
                "status": "draft",
                "priority": 0,
                "active_version": null,
                "draft_definition": {
                  "schema": "orishare.rule/v1",
                  "trigger": {
                    "event": "purchase"
                  },
                  "actions": [
                    {
                      "type": "points.award",
                      "currency": "points",
                      "amount": 10
                    }
                  ]
                },
                "version": 1,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient_scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads configuration of the selected environment through its environment-scoped resolution."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "rules:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "rules:read"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "key": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "campaign_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "published",
                        "paused",
                        "archived"
                      ]
                    },
                    "priority": {
                      "type": "number"
                    },
                    "active_version": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "number": {
                              "type": "number"
                            },
                            "definition": {
                              "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            }
                          },
                          "required": [
                            "id",
                            "number",
                            "definition",
                            "created_at"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "draft_definition": {
                      "anyOf": [
                        {
                          "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "key",
                    "name",
                    "campaign_id",
                    "status",
                    "priority",
                    "active_version",
                    "draft_definition",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Edit the draft, name, priority or campaign",
        "tags": [
          "rules"
        ],
        "operationId": "patch_rules_id",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "optional",
            "responseEtag": true
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "resource_not_found",
            "concurrent_update",
            "rule_invalid",
            "invalid_state"
          ],
          "resource": "rules",
          "action": "update",
          "examples": {
            "request": {
              "name": "Updated rule"
            },
            "success": {
              "status": 200,
              "body": {
                "id": "rule_00000000000000000000000000000042",
                "key": "rule_473b6b67293caa43ab044dbaa7f712c5fff3fe365b22846d",
                "name": "Updated rule",
                "campaign_id": null,
                "status": "draft",
                "priority": 0,
                "active_version": null,
                "draft_definition": {
                  "schema": "orishare.rule/v1",
                  "trigger": {
                    "event": "purchase"
                  },
                  "actions": [
                    {
                      "type": "points.award",
                      "currency": "points",
                      "amount": 10
                    }
                  ]
                },
                "version": 2,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient_scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent_update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale_write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "rules"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "rules:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "rules:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Optional legacy revision. Missing or malformed values follow the existing route parser."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "Updated rule"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "definition": {
                    "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                  },
                  "campaign_id": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "priority": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "key": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "campaign_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "published",
                        "paused",
                        "archived"
                      ]
                    },
                    "priority": {
                      "type": "number"
                    },
                    "active_version": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "number": {
                              "type": "number"
                            },
                            "definition": {
                              "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            }
                          },
                          "required": [
                            "id",
                            "number",
                            "definition",
                            "created_at"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "draft_definition": {
                      "anyOf": [
                        {
                          "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "key",
                    "name",
                    "campaign_id",
                    "status",
                    "priority",
                    "active_version",
                    "draft_definition",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/rules/{id}/publish": {
      "post": {
        "summary": "Publish the draft as a new immutable version",
        "tags": [
          "rules"
        ],
        "operationId": "post_rules_id_publish",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "optional",
            "responseEtag": true
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "resource_not_found",
            "concurrent_update",
            "rule_invalid",
            "invalid_state"
          ],
          "resource": "rules",
          "action": "transition",
          "examples": {
            "request": {},
            "success": {
              "status": 200,
              "body": {
                "id": "rule_00000000000000000000000000000042",
                "key": "rule_473b6b67293caa43ab044dbaa7f712c5fff3fe365b22846d",
                "name": "Purchase points",
                "campaign_id": null,
                "status": "published",
                "priority": 0,
                "active_version": {
                  "id": "rv_00000000000000000000000000000042",
                  "number": 1,
                  "definition": {
                    "schema": "orishare.rule/v1",
                    "trigger": {
                      "event": "purchase"
                    },
                    "actions": [
                      {
                        "type": "points.award",
                        "currency": "points",
                        "amount": 10
                      }
                    ]
                  },
                  "created_at": "2026-09-20T00:00:00.000Z"
                },
                "draft_definition": null,
                "version": 2,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient_scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent_update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale_write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            }
          },
          "transition": {
            "from": [
              "draft",
              "published",
              "paused"
            ],
            "to": "published"
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "rules"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "rules:publish_sandbox"
            ],
            "runtimeClass": "sandbox"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "rules:publish_sandbox",
              "rules:read"
            ],
            "runtimeClass": "sandbox"
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": [],
            "runtimeClass": "sandbox"
          },
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "rules:publish"
            ],
            "runtimeClass": "production"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "rules:publish",
              "rules:read"
            ],
            "runtimeClass": "production"
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": [],
            "runtimeClass": "production"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Optional legacy revision. Missing or malformed values follow the existing route parser."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "key": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "campaign_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "published",
                        "paused",
                        "archived"
                      ]
                    },
                    "priority": {
                      "type": "number"
                    },
                    "active_version": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "number": {
                              "type": "number"
                            },
                            "definition": {
                              "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            }
                          },
                          "required": [
                            "id",
                            "number",
                            "definition",
                            "created_at"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "draft_definition": {
                      "anyOf": [
                        {
                          "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "key",
                    "name",
                    "campaign_id",
                    "status",
                    "priority",
                    "active_version",
                    "draft_definition",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/rules/{id}/pause": {
      "post": {
        "summary": "Pause a published rule",
        "tags": [
          "rules"
        ],
        "operationId": "post_rules_id_pause",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "optional",
            "responseEtag": true
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "resource_not_found",
            "concurrent_update",
            "invalid_state"
          ],
          "resource": "rules",
          "action": "transition",
          "examples": {
            "request": {},
            "success": {
              "status": 200,
              "body": {
                "id": "rule_00000000000000000000000000000042",
                "key": "rule_473b6b67293caa43ab044dbaa7f712c5fff3fe365b22846d",
                "name": "Purchase points",
                "campaign_id": null,
                "status": "paused",
                "priority": 0,
                "active_version": {
                  "id": "rv_00000000000000000000000000000042",
                  "number": 1,
                  "definition": {
                    "schema": "orishare.rule/v1",
                    "trigger": {
                      "event": "purchase"
                    },
                    "actions": [
                      {
                        "type": "points.award",
                        "currency": "points",
                        "amount": 10
                      }
                    ]
                  },
                  "created_at": "2026-09-20T00:00:00.000Z"
                },
                "draft_definition": null,
                "version": 3,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient_scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent_update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale_write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            }
          },
          "transition": {
            "from": [
              "published"
            ],
            "to": "paused"
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "rules"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "rules:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "rules:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Optional legacy revision. Missing or malformed values follow the existing route parser."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "key": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "campaign_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "published",
                        "paused",
                        "archived"
                      ]
                    },
                    "priority": {
                      "type": "number"
                    },
                    "active_version": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "number": {
                              "type": "number"
                            },
                            "definition": {
                              "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            }
                          },
                          "required": [
                            "id",
                            "number",
                            "definition",
                            "created_at"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "draft_definition": {
                      "anyOf": [
                        {
                          "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "key",
                    "name",
                    "campaign_id",
                    "status",
                    "priority",
                    "active_version",
                    "draft_definition",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/rules/{id}/resume": {
      "post": {
        "summary": "Resume a paused rule",
        "tags": [
          "rules"
        ],
        "operationId": "post_rules_id_resume",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "optional",
            "responseEtag": true
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "resource_not_found",
            "concurrent_update",
            "invalid_state",
            "rule_invalid"
          ],
          "resource": "rules",
          "action": "transition",
          "examples": {
            "request": {},
            "success": {
              "status": 200,
              "body": {
                "id": "rule_00000000000000000000000000000042",
                "key": "rule_473b6b67293caa43ab044dbaa7f712c5fff3fe365b22846d",
                "name": "Purchase points",
                "campaign_id": null,
                "status": "published",
                "priority": 0,
                "active_version": {
                  "id": "rv_00000000000000000000000000000042",
                  "number": 1,
                  "definition": {
                    "schema": "orishare.rule/v1",
                    "trigger": {
                      "event": "purchase"
                    },
                    "actions": [
                      {
                        "type": "points.award",
                        "currency": "points",
                        "amount": 10
                      }
                    ]
                  },
                  "created_at": "2026-09-20T00:00:00.000Z"
                },
                "draft_definition": null,
                "version": 2,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient_scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent_update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale_write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            }
          },
          "transition": {
            "from": [
              "paused"
            ],
            "to": "published"
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "rules"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "rules:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "rules:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Optional legacy revision. Missing or malformed values follow the existing route parser."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "key": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "campaign_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "published",
                        "paused",
                        "archived"
                      ]
                    },
                    "priority": {
                      "type": "number"
                    },
                    "active_version": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "number": {
                              "type": "number"
                            },
                            "definition": {
                              "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            }
                          },
                          "required": [
                            "id",
                            "number",
                            "definition",
                            "created_at"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "draft_definition": {
                      "anyOf": [
                        {
                          "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "key",
                    "name",
                    "campaign_id",
                    "status",
                    "priority",
                    "active_version",
                    "draft_definition",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/rules/{id}/archive": {
      "post": {
        "summary": "Archive a rule (history stays readable)",
        "tags": [
          "rules"
        ],
        "operationId": "post_rules_id_archive",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "optional",
            "responseEtag": true
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "resource_not_found",
            "concurrent_update",
            "invalid_state"
          ],
          "resource": "rules",
          "action": "transition",
          "examples": {
            "request": {},
            "success": {
              "status": 200,
              "body": {
                "id": "rule_00000000000000000000000000000042",
                "key": "rule_473b6b67293caa43ab044dbaa7f712c5fff3fe365b22846d",
                "name": "Purchase points",
                "campaign_id": null,
                "status": "archived",
                "priority": 0,
                "active_version": null,
                "draft_definition": {
                  "schema": "orishare.rule/v1",
                  "trigger": {
                    "event": "purchase"
                  },
                  "actions": [
                    {
                      "type": "points.award",
                      "currency": "points",
                      "amount": 10
                    }
                  ]
                },
                "version": 1,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient_scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent_update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale_write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            }
          },
          "transition": {
            "from": [
              "draft",
              "published",
              "paused"
            ],
            "to": "archived"
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "rules"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "rules:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "rules:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Optional legacy revision. Missing or malformed values follow the existing route parser."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "key": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "campaign_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "published",
                        "paused",
                        "archived"
                      ]
                    },
                    "priority": {
                      "type": "number"
                    },
                    "active_version": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "number": {
                              "type": "number"
                            },
                            "definition": {
                              "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            }
                          },
                          "required": [
                            "id",
                            "number",
                            "definition",
                            "created_at"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "draft_definition": {
                      "anyOf": [
                        {
                          "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "key",
                    "name",
                    "campaign_id",
                    "status",
                    "priority",
                    "active_version",
                    "draft_definition",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/rules/{id}/versions": {
      "get": {
        "summary": "Immutable versions, newest first",
        "tags": [
          "rules"
        ],
        "operationId": "get_rules_id_versions",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "rule_versions",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "request": {},
            "success": {
              "status": 200,
              "body": {
                "data": [],
                "has_more": false,
                "next_cursor": null
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient_scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads configuration of the selected environment through its environment-scoped resolution."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "rules:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "rules:read"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "rule_id": {
                            "type": "string"
                          },
                          "number": {
                            "type": "number"
                          },
                          "definition": {
                            "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                          },
                          "created_by": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "id",
                          "rule_id",
                          "number",
                          "definition",
                          "created_by",
                          "created_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/rules/{id}/rollback": {
      "post": {
        "summary": "Publish an older version's definition as a new version",
        "tags": [
          "rules"
        ],
        "operationId": "post_rules_id_rollback",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "invalid_state",
            "rule_invalid"
          ],
          "resource": "rules",
          "action": "transition",
          "examples": {
            "request": {
              "number": 1
            },
            "success": {
              "status": 200,
              "body": {
                "id": "rule_00000000000000000000000000000042",
                "key": "rule_473b6b67293caa43ab044dbaa7f712c5fff3fe365b22846d",
                "name": "Purchase points",
                "campaign_id": null,
                "status": "published",
                "priority": 0,
                "active_version": {
                  "id": "rv_00000000000000000000000000000042",
                  "number": 1,
                  "definition": {
                    "schema": "orishare.rule/v1",
                    "trigger": {
                      "event": "purchase"
                    },
                    "actions": [
                      {
                        "type": "points.award",
                        "currency": "points",
                        "amount": 10
                      }
                    ]
                  },
                  "created_at": "2026-09-20T00:00:00.000Z"
                },
                "draft_definition": null,
                "version": 2,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient_scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent_update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            },
            "sameKeyReplay": {
              "status": 200,
              "body": {
                "id": "rule_00000000000000000000000000000042",
                "key": "rule_473b6b67293caa43ab044dbaa7f712c5fff3fe365b22846d",
                "name": "Purchase points",
                "campaign_id": null,
                "status": "published",
                "priority": 0,
                "active_version": {
                  "id": "rv_00000000000000000000000000000042",
                  "number": 1,
                  "definition": {
                    "schema": "orishare.rule/v1",
                    "trigger": {
                      "event": "purchase"
                    },
                    "actions": [
                      {
                        "type": "points.award",
                        "currency": "points",
                        "amount": 10
                      }
                    ]
                  },
                  "created_at": "2026-09-20T00:00:00.000Z"
                },
                "draft_definition": null,
                "version": 2,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z"
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency_key_reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            }
          },
          "transition": {
            "from": [
              "draft",
              "published",
              "paused"
            ],
            "to": "published"
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "rules"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "rules:publish_sandbox"
            ],
            "runtimeClass": "sandbox"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "rules:publish_sandbox",
              "rules:read"
            ],
            "runtimeClass": "sandbox"
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": [],
            "runtimeClass": "sandbox"
          },
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "rules:publish"
            ],
            "runtimeClass": "production"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "rules:publish",
              "rules:read"
            ],
            "runtimeClass": "production"
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": [],
            "runtimeClass": "production"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "number": 1
              },
              "schema": {
                "type": "object",
                "properties": {
                  "number": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "number"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "key": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "campaign_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "published",
                        "paused",
                        "archived"
                      ]
                    },
                    "priority": {
                      "type": "number"
                    },
                    "active_version": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "id": {
                              "type": "string"
                            },
                            "number": {
                              "type": "number"
                            },
                            "definition": {
                              "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                            },
                            "created_at": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            }
                          },
                          "required": [
                            "id",
                            "number",
                            "definition",
                            "created_at"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "draft_definition": {
                      "anyOf": [
                        {
                          "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "key",
                    "name",
                    "campaign_id",
                    "status",
                    "priority",
                    "active_version",
                    "draft_definition",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/rules/{id}/simulate": {
      "post": {
        "summary": "Preview a rule using a synthetic input or an authenticated commerce event",
        "tags": [
          "rules"
        ],
        "operationId": "post_rules_id_simulate",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "invalid_state",
            "rule_invalid"
          ],
          "resource": "rule_simulations",
          "action": "create",
          "examples": {
            "request": {
              "event": {
                "name": "purchase"
              },
              "customer_id": "cust_00000000000000000000000000000042"
            },
            "success": {
              "status": 200,
              "body": {
                "simulated": true,
                "plan": [],
                "trace": {}
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient_scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent_update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "read",
            "safe_post": true,
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Dry-runs a rule of the selected environment in a rollback-only transaction."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "rules:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "rules:read"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "event": {
                  "name": "purchase"
                },
                "customer_id": "cust_00000000000000000000000000000042"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "event": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1
                      },
                      "properties": {
                        "type": "object",
                        "propertyNames": {
                          "type": "string"
                        },
                        "additionalProperties": {
                          "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                        }
                      },
                      "occurred_at": {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                      }
                    },
                    "required": [
                      "name"
                    ]
                  },
                  "fact": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "program_transition"
                          },
                          "source": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "publishable_event",
                                  "secret_key_event",
                                  "verified_connector",
                                  "operator_command",
                                  "customer_command",
                                  "import",
                                  "program_transition",
                                  "schedule"
                                ]
                              },
                              "trust": {
                                "type": "string",
                                "enum": [
                                  "anonymous_claim",
                                  "customer_claim",
                                  "merchant_asserted",
                                  "verified_evidence",
                                  "legacy_unknown"
                                ]
                              },
                              "effective_at": {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                              },
                              "accepted_at": {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                              }
                            },
                            "required": [
                              "kind",
                              "trust",
                              "effective_at",
                              "accepted_at"
                            ],
                            "additionalProperties": false
                          },
                          "transition": {
                            "type": "object",
                            "properties": {
                              "type": {
                                "type": "string",
                                "minLength": 1
                              },
                              "program_key": {
                                "type": "string",
                                "minLength": 1
                              },
                              "state_revision": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "before": {
                                "type": "object",
                                "properties": {
                                  "status": {
                                    "type": "string"
                                  },
                                  "tier": {
                                    "type": "string"
                                  },
                                  "progress": {
                                    "type": "number"
                                  },
                                  "current": {
                                    "type": "number"
                                  },
                                  "best": {
                                    "type": "number"
                                  },
                                  "freezes": {
                                    "type": "number"
                                  },
                                  "count": {
                                    "type": "number"
                                  },
                                  "owned": {
                                    "type": "boolean"
                                  },
                                  "steps": {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {
                                      "type": "object",
                                      "properties": {
                                        "progress": {
                                          "type": "number"
                                        },
                                        "completed": {
                                          "type": "boolean"
                                        }
                                      },
                                      "required": [
                                        "progress",
                                        "completed"
                                      ]
                                    }
                                  }
                                },
                                "additionalProperties": false
                              },
                              "after": {
                                "type": "object",
                                "properties": {
                                  "status": {
                                    "type": "string"
                                  },
                                  "tier": {
                                    "type": "string"
                                  },
                                  "progress": {
                                    "type": "number"
                                  },
                                  "current": {
                                    "type": "number"
                                  },
                                  "best": {
                                    "type": "number"
                                  },
                                  "freezes": {
                                    "type": "number"
                                  },
                                  "count": {
                                    "type": "number"
                                  },
                                  "owned": {
                                    "type": "boolean"
                                  },
                                  "steps": {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {
                                      "type": "object",
                                      "properties": {
                                        "progress": {
                                          "type": "number"
                                        },
                                        "completed": {
                                          "type": "boolean"
                                        }
                                      },
                                      "required": [
                                        "progress",
                                        "completed"
                                      ]
                                    }
                                  }
                                },
                                "additionalProperties": false
                              }
                            },
                            "required": [
                              "type",
                              "program_key",
                              "state_revision",
                              "before",
                              "after"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "kind",
                          "source",
                          "transition"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "const": "schedule"
                          },
                          "source": {
                            "type": "object",
                            "properties": {
                              "kind": {
                                "type": "string",
                                "enum": [
                                  "publishable_event",
                                  "secret_key_event",
                                  "verified_connector",
                                  "operator_command",
                                  "customer_command",
                                  "import",
                                  "program_transition",
                                  "schedule"
                                ]
                              },
                              "trust": {
                                "type": "string",
                                "enum": [
                                  "anonymous_claim",
                                  "customer_claim",
                                  "merchant_asserted",
                                  "verified_evidence",
                                  "legacy_unknown"
                                ]
                              },
                              "effective_at": {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                              },
                              "accepted_at": {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                              }
                            },
                            "required": [
                              "kind",
                              "trust",
                              "effective_at",
                              "accepted_at"
                            ],
                            "additionalProperties": false
                          },
                          "schedule": {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string",
                                "minLength": 1
                              },
                              "due_at": {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                              },
                              "eligibility_generation": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              }
                            },
                            "required": [
                              "key",
                              "due_at",
                              "eligibility_generation"
                            ],
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "kind",
                          "source",
                          "schedule"
                        ],
                        "additionalProperties": false
                      }
                    ],
                    "type": "object"
                  },
                  "commerce_event_id": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 255
                  },
                  "customer_id": {
                    "type": "string"
                  },
                  "use": {
                    "type": "string",
                    "enum": [
                      "draft",
                      "active"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "simulated": {
                      "type": "boolean",
                      "const": true
                    },
                    "plan": {
                      "type": "array",
                      "items": {
                        "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                      }
                    },
                    "trace": {
                      "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                    }
                  },
                  "required": [
                    "simulated",
                    "plan",
                    "trace"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/campaigns": {
      "get": {
        "summary": "List campaigns",
        "tags": [
          "campaigns"
        ],
        "operationId": "get_campaigns",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "campaigns",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "request": {},
            "success": {
              "status": 200,
              "body": {
                "data": [],
                "has_more": false,
                "next_cursor": null
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient_scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads configuration of the selected environment through its environment-scoped resolution."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "campaigns:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "campaigns:read"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "active",
                "paused",
                "ended"
              ]
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "draft",
                              "active",
                              "paused",
                              "ended"
                            ]
                          },
                          "starts_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "ends_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "priority": {
                            "type": "number"
                          },
                          "stacking_group": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "exclusive": {
                            "type": "boolean"
                          },
                          "budget": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "amount": {
                                    "type": "number"
                                  },
                                  "currency": {
                                    "type": "string"
                                  },
                                  "window": {
                                    "type": [
                                      "string",
                                      "null"
                                    ]
                                  },
                                  "used": {
                                    "type": "number"
                                  }
                                },
                                "required": [
                                  "amount",
                                  "currency",
                                  "window",
                                  "used"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "audience": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "segments": {
                                    "type": "array",
                                    "items": {
                                      "type": "string"
                                    }
                                  }
                                },
                                "required": [
                                  "segments"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "version": {
                            "type": "number"
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "status",
                          "starts_at",
                          "ends_at",
                          "priority",
                          "stacking_group",
                          "exclusive",
                          "budget",
                          "audience",
                          "version",
                          "created_at",
                          "updated_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a campaign",
        "tags": [
          "campaigns"
        ],
        "operationId": "post_campaigns",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update"
          ],
          "resource": "campaigns",
          "action": "create",
          "examples": {
            "request": {
              "name": "Member campaign"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "camp_00000000000000000000000000000042",
                "name": "Member campaign",
                "status": "draft",
                "starts_at": null,
                "ends_at": null,
                "priority": 0,
                "stacking_group": null,
                "exclusive": false,
                "budget": null,
                "audience": null,
                "version": 1,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient_scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent_update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "camp_00000000000000000000000000000042",
                "name": "Member campaign",
                "status": "draft",
                "starts_at": null,
                "ends_at": null,
                "priority": 0,
                "stacking_group": null,
                "exclusive": false,
                "budget": null,
                "audience": null,
                "version": 1,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z"
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency_key_reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "campaigns"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "campaigns:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "campaigns:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "Member campaign"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "draft",
                      "active",
                      "paused",
                      "ended"
                    ]
                  },
                  "starts_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ends_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "priority": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "stacking_group": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "exclusive": {
                    "type": "boolean"
                  },
                  "budget": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "amount": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "currency": {
                            "type": "string",
                            "minLength": 1
                          },
                          "window": {
                            "type": "string",
                            "enum": [
                              "none",
                              "day",
                              "week",
                              "month",
                              "year"
                            ]
                          }
                        },
                        "required": [
                          "amount",
                          "currency"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "audience": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "segments": {
                            "minItems": 1,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1
                            }
                          }
                        },
                        "required": [
                          "segments"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "active",
                        "paused",
                        "ended"
                      ]
                    },
                    "starts_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "ends_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "priority": {
                      "type": "number"
                    },
                    "stacking_group": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "exclusive": {
                      "type": "boolean"
                    },
                    "budget": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "amount": {
                              "type": "number"
                            },
                            "currency": {
                              "type": "string"
                            },
                            "window": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "used": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "amount",
                            "currency",
                            "window",
                            "used"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "audience": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "segments": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "segments"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "status",
                    "starts_at",
                    "ends_at",
                    "priority",
                    "stacking_group",
                    "exclusive",
                    "budget",
                    "audience",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/campaigns/{id}": {
      "get": {
        "summary": "One campaign with budget usage",
        "tags": [
          "campaigns"
        ],
        "operationId": "get_campaigns_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found"
          ],
          "resource": "campaigns",
          "action": "read",
          "examples": {
            "request": {},
            "success": {
              "status": 200,
              "body": {
                "id": "camp_00000000000000000000000000000042",
                "name": "Member campaign",
                "status": "draft",
                "starts_at": null,
                "ends_at": null,
                "priority": 0,
                "stacking_group": null,
                "exclusive": false,
                "budget": null,
                "audience": null,
                "version": 1,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient_scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads configuration of the selected environment through its environment-scoped resolution."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "campaigns:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "campaigns:read"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "active",
                        "paused",
                        "ended"
                      ]
                    },
                    "starts_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "ends_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "priority": {
                      "type": "number"
                    },
                    "stacking_group": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "exclusive": {
                      "type": "boolean"
                    },
                    "budget": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "amount": {
                              "type": "number"
                            },
                            "currency": {
                              "type": "string"
                            },
                            "window": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "used": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "amount",
                            "currency",
                            "window",
                            "used"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "audience": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "segments": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "segments"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "status",
                    "starts_at",
                    "ends_at",
                    "priority",
                    "stacking_group",
                    "exclusive",
                    "budget",
                    "audience",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Update schedule, priority, stacking, budget, audience or status",
        "tags": [
          "campaigns"
        ],
        "operationId": "patch_campaigns_id",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "optional",
            "responseEtag": true
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "resource_not_found",
            "concurrent_update"
          ],
          "resource": "campaigns",
          "action": "update",
          "examples": {
            "request": {
              "name": "Updated campaign"
            },
            "success": {
              "status": 200,
              "body": {
                "id": "camp_00000000000000000000000000000042",
                "name": "Updated campaign",
                "status": "draft",
                "starts_at": null,
                "ends_at": null,
                "priority": 0,
                "stacking_group": null,
                "exclusive": false,
                "budget": null,
                "audience": null,
                "version": 2,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient_scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent_update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale_write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "campaigns"
            ]
          },
          "compatibility": {
            "deprecatedSince": "2026-09-21"
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "campaigns:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "campaigns:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Optional legacy revision. Missing or malformed values follow the existing route parser."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "Updated campaign"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "draft",
                      "active",
                      "paused",
                      "ended"
                    ]
                  },
                  "starts_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "ends_at": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "priority": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "stacking_group": {
                    "anyOf": [
                      {
                        "type": "string",
                        "maxLength": 60
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "exclusive": {
                    "type": "boolean"
                  },
                  "budget": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "amount": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          },
                          "currency": {
                            "type": "string",
                            "minLength": 1
                          },
                          "window": {
                            "type": "string",
                            "enum": [
                              "none",
                              "day",
                              "week",
                              "month",
                              "year"
                            ]
                          }
                        },
                        "required": [
                          "amount",
                          "currency"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "audience": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "segments": {
                            "minItems": 1,
                            "type": "array",
                            "items": {
                              "type": "string",
                              "minLength": 1
                            }
                          }
                        },
                        "required": [
                          "segments"
                        ]
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "active",
                        "paused",
                        "ended"
                      ]
                    },
                    "starts_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "ends_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "priority": {
                      "type": "number"
                    },
                    "stacking_group": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "exclusive": {
                      "type": "boolean"
                    },
                    "budget": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "amount": {
                              "type": "number"
                            },
                            "currency": {
                              "type": "string"
                            },
                            "window": {
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "used": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "amount",
                            "currency",
                            "window",
                            "used"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "audience": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "segments": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "segments"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "status",
                    "starts_at",
                    "ends_at",
                    "priority",
                    "stacking_group",
                    "exclusive",
                    "budget",
                    "audience",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete a draft or ended campaign with no rules",
        "tags": [
          "campaigns"
        ],
        "operationId": "delete_campaigns_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "resource_in_use",
            "invalid_state"
          ],
          "resource": "campaigns",
          "action": "delete",
          "examples": {
            "request": {},
            "success": {
              "status": 204
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient_scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent_update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": true,
            "effectFamilies": [
              "campaigns"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "campaigns:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "campaigns:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/tier_programs": {
      "get": {
        "summary": "List tier programs with levels",
        "tags": [
          "tiers"
        ],
        "operationId": "get_tier_programs",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "tier_programs",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [
                  {
                    "id": "tp_0123456789abcdef0123456789abcdef",
                    "name": "Status",
                    "currency": "points",
                    "basis": {
                      "type": "lifetime_earned"
                    },
                    "downgrade_check": "never",
                    "retention": {
                      "mode": "none",
                      "grace_days": 0
                    },
                    "is_default": false,
                    "status": "active",
                    "levels": [
                      {
                        "id": "tl_0123456789abcdef0123456789abcdef",
                        "name": "bronze",
                        "threshold": 0,
                        "rank": 0,
                        "benefits": []
                      }
                    ],
                    "version": 1,
                    "reevaluation": null,
                    "created_at": "2026-09-20T12:00:00.000Z",
                    "updated_at": "2026-09-20T12:00:00.000Z"
                  }
                ],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads a program or mechanic of the selected environment; ids resolve inside it."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "basis": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "lifetime_earned"
                                  }
                                },
                                "required": [
                                  "type"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "earned_rolling_days"
                                  },
                                  "days": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "type",
                                  "days"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "balance"
                                  }
                                },
                                "required": [
                                  "type"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "earned_calendar_year"
                                  }
                                },
                                "required": [
                                  "type"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "const": "earned_anniversary_year"
                                  }
                                },
                                "required": [
                                  "type"
                                ],
                                "additionalProperties": false
                              }
                            ],
                            "type": "object"
                          },
                          "downgrade_check": {
                            "type": "string",
                            "enum": [
                              "daily",
                              "monthly",
                              "never"
                            ]
                          },
                          "retention": {
                            "type": "object",
                            "properties": {
                              "mode": {
                                "type": "string",
                                "enum": [
                                  "none",
                                  "through_next_period"
                                ]
                              },
                              "grace_days": {
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 366
                              }
                            },
                            "required": [
                              "mode",
                              "grace_days"
                            ],
                            "additionalProperties": false
                          },
                          "is_default": {
                            "type": "boolean"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "active",
                              "paused"
                            ]
                          },
                          "levels": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "id": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                },
                                "threshold": {
                                  "type": "number"
                                },
                                "rank": {
                                  "type": "number"
                                },
                                "benefits": {
                                  "type": "array",
                                  "items": {
                                    "type": "object",
                                    "properties": {
                                      "key": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                      },
                                      "title": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 120
                                      },
                                      "description": {
                                        "type": "string",
                                        "maxLength": 500
                                      },
                                      "icon": {
                                        "type": "string",
                                        "minLength": 1,
                                        "maxLength": 64
                                      }
                                    },
                                    "required": [
                                      "key",
                                      "title"
                                    ],
                                    "additionalProperties": false
                                  }
                                }
                              },
                              "required": [
                                "id",
                                "name",
                                "threshold",
                                "rank",
                                "benefits"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "version": {
                            "type": "number"
                          },
                          "reevaluation": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "version": {
                                    "type": "number"
                                  },
                                  "status": {
                                    "type": "string",
                                    "enum": [
                                      "pending",
                                      "completed"
                                    ]
                                  },
                                  "evaluated": {
                                    "type": "number"
                                  },
                                  "changed": {
                                    "type": "number"
                                  },
                                  "conflicts": {
                                    "type": "number"
                                  }
                                },
                                "required": [
                                  "version",
                                  "status",
                                  "evaluated",
                                  "changed",
                                  "conflicts"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "currency",
                          "basis",
                          "downgrade_check",
                          "retention",
                          "is_default",
                          "status",
                          "levels",
                          "version",
                          "reevaluation",
                          "created_at",
                          "updated_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a tier program (first level threshold 0, increasing thresholds)",
        "tags": [
          "tiers"
        ],
        "operationId": "post_tier_programs",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update"
          ],
          "resource": "tier_programs",
          "action": "create",
          "examples": {
            "request": {
              "name": "Status",
              "currency": "points",
              "basis": {
                "type": "lifetime_earned"
              },
              "levels": [
                {
                  "name": "bronze",
                  "threshold": 0
                }
              ]
            },
            "success": {
              "status": 201,
              "body": {
                "id": "tp_0123456789abcdef0123456789abcdef",
                "name": "Status",
                "currency": "points",
                "basis": {
                  "type": "lifetime_earned"
                },
                "downgrade_check": "never",
                "retention": {
                  "mode": "none",
                  "grace_days": 0
                },
                "is_default": false,
                "status": "active",
                "levels": [
                  {
                    "id": "tl_0123456789abcdef0123456789abcdef",
                    "name": "bronze",
                    "threshold": 0,
                    "rank": 0,
                    "benefits": []
                  }
                ],
                "version": 1,
                "reevaluation": null,
                "created_at": "2026-09-20T12:00:00.000Z",
                "updated_at": "2026-09-20T12:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "tp_0123456789abcdef0123456789abcdef",
                "name": "Status",
                "currency": "points",
                "basis": {
                  "type": "lifetime_earned"
                },
                "downgrade_check": "never",
                "retention": {
                  "mode": "none",
                  "grace_days": 0
                },
                "is_default": false,
                "status": "active",
                "levels": [
                  {
                    "id": "tl_0123456789abcdef0123456789abcdef",
                    "name": "bronze",
                    "threshold": 0,
                    "rank": 0,
                    "benefits": []
                  }
                ],
                "version": 1,
                "reevaluation": null,
                "created_at": "2026-09-20T12:00:00.000Z",
                "updated_at": "2026-09-20T12:00:00.000Z"
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "tier_programs"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "Status",
                "currency": "points",
                "basis": {
                  "type": "lifetime_earned"
                },
                "levels": [
                  {
                    "name": "bronze",
                    "threshold": 0
                  }
                ]
              },
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "currency": {
                    "type": "string",
                    "minLength": 1
                  },
                  "basis": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "lifetime_earned"
                          }
                        },
                        "required": [
                          "type"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "earned_rolling_days"
                          },
                          "days": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "type",
                          "days"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "balance"
                          }
                        },
                        "required": [
                          "type"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "earned_calendar_year"
                          }
                        },
                        "required": [
                          "type"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "earned_anniversary_year"
                          }
                        },
                        "required": [
                          "type"
                        ]
                      }
                    ],
                    "type": "object"
                  },
                  "levels": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 60
                        },
                        "threshold": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "benefits": {
                          "maxItems": 20,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,63}$"
                              },
                              "title": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "description": {
                                "type": "string",
                                "maxLength": 500
                              },
                              "icon": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              }
                            },
                            "required": [
                              "key",
                              "title"
                            ]
                          }
                        }
                      },
                      "required": [
                        "name",
                        "threshold"
                      ]
                    }
                  },
                  "downgrade_check": {
                    "type": "string",
                    "enum": [
                      "daily",
                      "monthly",
                      "never"
                    ]
                  },
                  "retention": {
                    "type": "object",
                    "properties": {
                      "mode": {
                        "type": "string",
                        "enum": [
                          "none",
                          "through_next_period"
                        ]
                      },
                      "grace_days": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 366
                      }
                    },
                    "required": [
                      "mode"
                    ]
                  },
                  "is_default": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "name",
                  "currency",
                  "basis",
                  "levels"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "basis": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "lifetime_earned"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "earned_rolling_days"
                            },
                            "days": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "type",
                            "days"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "balance"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "earned_calendar_year"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "earned_anniversary_year"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "additionalProperties": false
                        }
                      ],
                      "type": "object"
                    },
                    "downgrade_check": {
                      "type": "string",
                      "enum": [
                        "daily",
                        "monthly",
                        "never"
                      ]
                    },
                    "retention": {
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "enum": [
                            "none",
                            "through_next_period"
                          ]
                        },
                        "grace_days": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 366
                        }
                      },
                      "required": [
                        "mode",
                        "grace_days"
                      ],
                      "additionalProperties": false
                    },
                    "is_default": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "active",
                        "paused"
                      ]
                    },
                    "levels": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "threshold": {
                            "type": "number"
                          },
                          "rank": {
                            "type": "number"
                          },
                          "benefits": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "key": {
                                  "type": "string",
                                  "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                },
                                "title": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "description": {
                                  "type": "string",
                                  "maxLength": 500
                                },
                                "icon": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                }
                              },
                              "required": [
                                "key",
                                "title"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "threshold",
                          "rank",
                          "benefits"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "version": {
                      "type": "number"
                    },
                    "reevaluation": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "version": {
                              "type": "number"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "pending",
                                "completed"
                              ]
                            },
                            "evaluated": {
                              "type": "number"
                            },
                            "changed": {
                              "type": "number"
                            },
                            "conflicts": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "version",
                            "status",
                            "evaluated",
                            "changed",
                            "conflicts"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "currency",
                    "basis",
                    "downgrade_check",
                    "retention",
                    "is_default",
                    "status",
                    "levels",
                    "version",
                    "reevaluation",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/tier_programs/{id}": {
      "get": {
        "summary": "One tier program",
        "tags": [
          "tiers"
        ],
        "operationId": "get_tier_programs_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found"
          ],
          "resource": "tier_programs",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "tp_0123456789abcdef0123456789abcdef",
                "name": "Status",
                "currency": "points",
                "basis": {
                  "type": "lifetime_earned"
                },
                "downgrade_check": "never",
                "retention": {
                  "mode": "none",
                  "grace_days": 0
                },
                "is_default": false,
                "status": "active",
                "levels": [
                  {
                    "id": "tl_0123456789abcdef0123456789abcdef",
                    "name": "bronze",
                    "threshold": 0,
                    "rank": 0,
                    "benefits": []
                  }
                ],
                "version": 1,
                "reevaluation": null,
                "created_at": "2026-09-20T12:00:00.000Z",
                "updated_at": "2026-09-20T12:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads a program or mechanic of the selected environment; ids resolve inside it."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "basis": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "lifetime_earned"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "earned_rolling_days"
                            },
                            "days": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "type",
                            "days"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "balance"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "earned_calendar_year"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "earned_anniversary_year"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "additionalProperties": false
                        }
                      ],
                      "type": "object"
                    },
                    "downgrade_check": {
                      "type": "string",
                      "enum": [
                        "daily",
                        "monthly",
                        "never"
                      ]
                    },
                    "retention": {
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "enum": [
                            "none",
                            "through_next_period"
                          ]
                        },
                        "grace_days": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 366
                        }
                      },
                      "required": [
                        "mode",
                        "grace_days"
                      ],
                      "additionalProperties": false
                    },
                    "is_default": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "active",
                        "paused"
                      ]
                    },
                    "levels": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "threshold": {
                            "type": "number"
                          },
                          "rank": {
                            "type": "number"
                          },
                          "benefits": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "key": {
                                  "type": "string",
                                  "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                },
                                "title": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "description": {
                                  "type": "string",
                                  "maxLength": 500
                                },
                                "icon": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                }
                              },
                              "required": [
                                "key",
                                "title"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "threshold",
                          "rank",
                          "benefits"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "version": {
                      "type": "number"
                    },
                    "reevaluation": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "version": {
                              "type": "number"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "pending",
                                "completed"
                              ]
                            },
                            "evaluated": {
                              "type": "number"
                            },
                            "changed": {
                              "type": "number"
                            },
                            "conflicts": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "version",
                            "status",
                            "evaluated",
                            "changed",
                            "conflicts"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "currency",
                    "basis",
                    "downgrade_check",
                    "retention",
                    "is_default",
                    "status",
                    "levels",
                    "version",
                    "reevaluation",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Edit a program; removing a held level needs reassign_to, changing basis needs reevaluate",
        "tags": [
          "tiers"
        ],
        "operationId": "patch_tier_programs_id",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "optional",
            "responseEtag": true
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "resource_not_found",
            "concurrent_update",
            "resource_in_use"
          ],
          "resource": "tier_programs",
          "action": "update",
          "examples": {
            "request": {
              "name": "Updated"
            },
            "success": {
              "status": 200,
              "body": {
                "id": "tp_0123456789abcdef0123456789abcdef",
                "name": "Status",
                "currency": "points",
                "basis": {
                  "type": "lifetime_earned"
                },
                "downgrade_check": "never",
                "retention": {
                  "mode": "none",
                  "grace_days": 0
                },
                "is_default": false,
                "status": "active",
                "levels": [
                  {
                    "id": "tl_0123456789abcdef0123456789abcdef",
                    "name": "bronze",
                    "threshold": 0,
                    "rank": 0,
                    "benefits": []
                  }
                ],
                "version": 1,
                "reevaluation": null,
                "created_at": "2026-09-20T12:00:00.000Z",
                "updated_at": "2026-09-20T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"1\""
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "tier_programs"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Optional legacy revision. Missing or malformed values follow the existing route parser."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "Updated"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "basis": {
                    "oneOf": [
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "lifetime_earned"
                          }
                        },
                        "required": [
                          "type"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "earned_rolling_days"
                          },
                          "days": {
                            "type": "integer",
                            "exclusiveMinimum": 0,
                            "maximum": 9007199254740991
                          }
                        },
                        "required": [
                          "type",
                          "days"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "balance"
                          }
                        },
                        "required": [
                          "type"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "earned_calendar_year"
                          }
                        },
                        "required": [
                          "type"
                        ]
                      },
                      {
                        "type": "object",
                        "properties": {
                          "type": {
                            "type": "string",
                            "const": "earned_anniversary_year"
                          }
                        },
                        "required": [
                          "type"
                        ]
                      }
                    ],
                    "type": "object"
                  },
                  "levels": {
                    "minItems": 1,
                    "maxItems": 20,
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 60
                        },
                        "threshold": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 9007199254740991
                        },
                        "benefits": {
                          "maxItems": 20,
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,63}$"
                              },
                              "title": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 120
                              },
                              "description": {
                                "type": "string",
                                "maxLength": 500
                              },
                              "icon": {
                                "type": "string",
                                "minLength": 1,
                                "maxLength": 64
                              }
                            },
                            "required": [
                              "key",
                              "title"
                            ]
                          }
                        }
                      },
                      "required": [
                        "name",
                        "threshold"
                      ]
                    }
                  },
                  "downgrade_check": {
                    "type": "string",
                    "enum": [
                      "daily",
                      "monthly",
                      "never"
                    ]
                  },
                  "retention": {
                    "type": "object",
                    "properties": {
                      "mode": {
                        "type": "string",
                        "enum": [
                          "none",
                          "through_next_period"
                        ]
                      },
                      "grace_days": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 366
                      }
                    },
                    "required": [
                      "mode"
                    ]
                  },
                  "is_default": {
                    "type": "boolean"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "paused"
                    ]
                  },
                  "reassign_to": {
                    "type": "string"
                  },
                  "reevaluate": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "basis": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "lifetime_earned"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "earned_rolling_days"
                            },
                            "days": {
                              "type": "integer",
                              "exclusiveMinimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "type",
                            "days"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "balance"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "earned_calendar_year"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "const": "earned_anniversary_year"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "additionalProperties": false
                        }
                      ],
                      "type": "object"
                    },
                    "downgrade_check": {
                      "type": "string",
                      "enum": [
                        "daily",
                        "monthly",
                        "never"
                      ]
                    },
                    "retention": {
                      "type": "object",
                      "properties": {
                        "mode": {
                          "type": "string",
                          "enum": [
                            "none",
                            "through_next_period"
                          ]
                        },
                        "grace_days": {
                          "type": "integer",
                          "minimum": 0,
                          "maximum": 366
                        }
                      },
                      "required": [
                        "mode",
                        "grace_days"
                      ],
                      "additionalProperties": false
                    },
                    "is_default": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "active",
                        "paused"
                      ]
                    },
                    "levels": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "threshold": {
                            "type": "number"
                          },
                          "rank": {
                            "type": "number"
                          },
                          "benefits": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "key": {
                                  "type": "string",
                                  "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                },
                                "title": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "description": {
                                  "type": "string",
                                  "maxLength": 500
                                },
                                "icon": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                }
                              },
                              "required": [
                                "key",
                                "title"
                              ],
                              "additionalProperties": false
                            }
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "threshold",
                          "rank",
                          "benefits"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "version": {
                      "type": "number"
                    },
                    "reevaluation": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "version": {
                              "type": "number"
                            },
                            "status": {
                              "type": "string",
                              "enum": [
                                "pending",
                                "completed"
                              ]
                            },
                            "evaluated": {
                              "type": "number"
                            },
                            "changed": {
                              "type": "number"
                            },
                            "conflicts": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "version",
                            "status",
                            "evaluated",
                            "changed",
                            "conflicts"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "currency",
                    "basis",
                    "downgrade_check",
                    "retention",
                    "is_default",
                    "status",
                    "levels",
                    "version",
                    "reevaluation",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete an unreferenced program",
        "tags": [
          "tiers"
        ],
        "operationId": "delete_tier_programs_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "resource_in_use"
          ],
          "resource": "tier_programs",
          "action": "delete",
          "examples": {
            "success": {
              "status": 204
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "resource_in_use",
                  "message": "resource in use",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#resource_in_use",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": true,
            "effectFamilies": [
              "tier_programs"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/tier_programs/{id}/reevaluate": {
      "post": {
        "summary": "Finish the pending pass over customers, or start one at the current version; call again until completed",
        "tags": [
          "tiers"
        ],
        "operationId": "post_tier_programs_id_reevaluate",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update"
          ],
          "resource": "tier_programs",
          "action": "transition",
          "examples": {
            "request": {},
            "success": {
              "status": 200,
              "body": {
                "version": 1,
                "status": "completed",
                "evaluated": 1,
                "changed": 0,
                "conflicts": 0
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "tier_programs"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {},
              "schema": {
                "type": "object",
                "properties": {}
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "number"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "pending",
                        "completed"
                      ]
                    },
                    "evaluated": {
                      "type": "number"
                    },
                    "changed": {
                      "type": "number"
                    },
                    "conflicts": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "version",
                    "status",
                    "evaluated",
                    "changed",
                    "conflicts"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/tier_programs/{id}/evaluate": {
      "post": {
        "summary": "Run the upgrade-only tier evaluation for one customer now",
        "tags": [
          "tiers"
        ],
        "operationId": "post_tier_programs_id_evaluate",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_state",
            "concurrent_update"
          ],
          "resource": "tier_programs",
          "action": "transition",
          "examples": {
            "request": {
              "customer_id": "cust_0123456789abcdef0123456789abcdef"
            },
            "success": {
              "status": 200,
              "body": {
                "effects": [],
                "tier": {
                  "customer_id": "cust_0123456789abcdef0123456789abcdef",
                  "program_id": "tp_0123456789abcdef0123456789abcdef",
                  "level": "bronze",
                  "since": "2026-09-20T12:00:00.000Z",
                  "last_evaluated_at": "2026-09-20T12:00:00.000Z",
                  "source": "manual",
                  "qualifies_until": null,
                  "grace_until": null,
                  "benefits": [],
                  "next_level": null
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "tier_programs"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "customer_id": "cust_0123456789abcdef0123456789abcdef"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "customer_id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "customer_id"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "effects": {
                      "type": "array",
                      "items": {
                        "description": "Any JSON value (object, array, string, number, boolean or null). Kept non-recursive in the OpenAPI document."
                      }
                    },
                    "tier": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "customer_id": {
                              "type": "string"
                            },
                            "program_id": {
                              "type": "string"
                            },
                            "level": {
                              "type": "string"
                            },
                            "since": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            },
                            "last_evaluated_at": {
                              "type": "string",
                              "format": "date-time",
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                            },
                            "source": {
                              "type": "string",
                              "enum": [
                                "evaluate",
                                "job",
                                "manual"
                              ]
                            },
                            "qualifies_until": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "grace_until": {
                              "anyOf": [
                                {
                                  "type": "string",
                                  "format": "date-time",
                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "benefits": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "key": {
                                    "type": "string",
                                    "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                  },
                                  "title": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120
                                  },
                                  "description": {
                                    "type": "string",
                                    "maxLength": 500
                                  },
                                  "icon": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 64
                                  }
                                },
                                "required": [
                                  "key",
                                  "title"
                                ],
                                "additionalProperties": false
                              }
                            },
                            "next_level": {
                              "anyOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "name": {
                                      "type": "string"
                                    },
                                    "threshold": {
                                      "type": "number"
                                    },
                                    "benefits": {
                                      "type": "array",
                                      "items": {
                                        "type": "object",
                                        "properties": {
                                          "key": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                          },
                                          "title": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 120
                                          },
                                          "description": {
                                            "type": "string",
                                            "maxLength": 500
                                          },
                                          "icon": {
                                            "type": "string",
                                            "minLength": 1,
                                            "maxLength": 64
                                          }
                                        },
                                        "required": [
                                          "key",
                                          "title"
                                        ],
                                        "additionalProperties": false
                                      }
                                    }
                                  },
                                  "required": [
                                    "name",
                                    "threshold",
                                    "benefits"
                                  ],
                                  "additionalProperties": false
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            }
                          },
                          "required": [
                            "customer_id",
                            "program_id",
                            "level",
                            "since",
                            "last_evaluated_at",
                            "source",
                            "qualifies_until",
                            "grace_until",
                            "benefits",
                            "next_level"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "effects",
                    "tier"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/customers/{id}/tiers": {
      "get": {
        "summary": "Current tier per program",
        "tags": [
          "tiers"
        ],
        "operationId": "get_customers_id_tiers",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor",
            "invalid_state"
          ],
          "resource": "tiers",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [
                  {
                    "customer_id": "cust_0123456789abcdef0123456789abcdef",
                    "program_id": "tp_0123456789abcdef0123456789abcdef",
                    "level": "bronze",
                    "since": "2026-09-20T12:00:00.000Z",
                    "last_evaluated_at": "2026-09-20T12:00:00.000Z",
                    "source": "manual",
                    "qualifies_until": null,
                    "grace_until": null,
                    "benefits": [],
                    "next_level": null
                  }
                ],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads customer data of the selected environment; identities are replaced by conversation references before the model or storage sees them."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "customers:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "customers:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "customer_id": {
                            "type": "string"
                          },
                          "program_id": {
                            "type": "string"
                          },
                          "level": {
                            "type": "string"
                          },
                          "since": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "last_evaluated_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "evaluate",
                              "job",
                              "manual"
                            ]
                          },
                          "qualifies_until": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "grace_until": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "benefits": {
                            "type": "array",
                            "items": {
                              "type": "object",
                              "properties": {
                                "key": {
                                  "type": "string",
                                  "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                },
                                "title": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 120
                                },
                                "description": {
                                  "type": "string",
                                  "maxLength": 500
                                },
                                "icon": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 64
                                }
                              },
                              "required": [
                                "key",
                                "title"
                              ],
                              "additionalProperties": false
                            }
                          },
                          "next_level": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "name": {
                                    "type": "string"
                                  },
                                  "threshold": {
                                    "type": "number"
                                  },
                                  "benefits": {
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                        },
                                        "title": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 120
                                        },
                                        "description": {
                                          "type": "string",
                                          "maxLength": 500
                                        },
                                        "icon": {
                                          "type": "string",
                                          "minLength": 1,
                                          "maxLength": 64
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "title"
                                      ],
                                      "additionalProperties": false
                                    }
                                  }
                                },
                                "required": [
                                  "name",
                                  "threshold",
                                  "benefits"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "customer_id",
                          "program_id",
                          "level",
                          "since",
                          "last_evaluated_at",
                          "source",
                          "qualifies_until",
                          "grace_until",
                          "benefits",
                          "next_level"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Operator tier set (either direction, audited, source manual)",
        "tags": [
          "tiers"
        ],
        "operationId": "post_customers_id_tiers",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "invalid_state"
          ],
          "idempotency": "optional",
          "resource": "tiers",
          "action": "create",
          "examples": {
            "request": {
              "program_id": "tp_0123456789abcdef0123456789abcdef",
              "level": "bronze"
            },
            "success": {
              "status": 200,
              "body": {
                "customer_id": "cust_0123456789abcdef0123456789abcdef",
                "program_id": "tp_0123456789abcdef0123456789abcdef",
                "level": "bronze",
                "since": "2026-09-20T12:00:00.000Z",
                "last_evaluated_at": "2026-09-20T12:00:00.000Z",
                "source": "manual",
                "qualifies_until": null,
                "grace_until": null,
                "benefits": [],
                "next_level": null
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "tiers"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "description": "Optional. When sent, the stored response is replayed for 24 h.",
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Optional. When sent, the stored response is replayed for 24 h."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "program_id": "tp_0123456789abcdef0123456789abcdef",
                "level": "bronze"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "program_id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "level": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "program_id",
                  "level"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "customer_id": {
                      "type": "string"
                    },
                    "program_id": {
                      "type": "string"
                    },
                    "level": {
                      "type": "string"
                    },
                    "since": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "last_evaluated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "source": {
                      "type": "string",
                      "enum": [
                        "evaluate",
                        "job",
                        "manual"
                      ]
                    },
                    "qualifies_until": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "grace_until": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "benefits": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string",
                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                          },
                          "title": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 120
                          },
                          "description": {
                            "type": "string",
                            "maxLength": 500
                          },
                          "icon": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64
                          }
                        },
                        "required": [
                          "key",
                          "title"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_level": {
                      "anyOf": [
                        {
                          "type": "object",
                          "properties": {
                            "name": {
                              "type": "string"
                            },
                            "threshold": {
                              "type": "number"
                            },
                            "benefits": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "key": {
                                    "type": "string",
                                    "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                  },
                                  "title": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 120
                                  },
                                  "description": {
                                    "type": "string",
                                    "maxLength": 500
                                  },
                                  "icon": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 64
                                  }
                                },
                                "required": [
                                  "key",
                                  "title"
                                ],
                                "additionalProperties": false
                              }
                            }
                          },
                          "required": [
                            "name",
                            "threshold",
                            "benefits"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "customer_id",
                    "program_id",
                    "level",
                    "since",
                    "last_evaluated_at",
                    "source",
                    "qualifies_until",
                    "grace_until",
                    "benefits",
                    "next_level"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/rewards": {
      "get": {
        "summary": "List rewards with issued counts",
        "tags": [
          "rewards"
        ],
        "operationId": "get_rewards",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor"
          ],
          "resource": "rewards",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [
                  {
                    "id": "rw_0123456789abcdef0123456789abcdef",
                    "name": "Reward",
                    "cost": 0,
                    "currency": null,
                    "availability": null,
                    "issued": 0,
                    "expiry_after": null,
                    "status": "active",
                    "version": 1,
                    "created_at": "2026-09-20T12:00:00.000Z",
                    "updated_at": "2026-09-20T12:00:00.000Z"
                  }
                ],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads a program or mechanic of the selected environment; ids resolve inside it."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "active",
                "archived"
              ]
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "cost": {
                            "type": "number"
                          },
                          "currency": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "availability": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "issued": {
                            "type": "number"
                          },
                          "expiry_after": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "active",
                              "archived"
                            ]
                          },
                          "version": {
                            "type": "number"
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "cost",
                          "currency",
                          "availability",
                          "issued",
                          "expiry_after",
                          "status",
                          "version",
                          "created_at",
                          "updated_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a reward",
        "tags": [
          "rewards"
        ],
        "operationId": "post_rewards",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update"
          ],
          "resource": "rewards",
          "action": "create",
          "examples": {
            "request": {
              "name": "Reward",
              "cost": 0
            },
            "success": {
              "status": 201,
              "body": {
                "id": "rw_0123456789abcdef0123456789abcdef",
                "name": "Reward",
                "cost": 0,
                "currency": null,
                "availability": null,
                "issued": 0,
                "expiry_after": null,
                "status": "active",
                "version": 1,
                "created_at": "2026-09-20T12:00:00.000Z",
                "updated_at": "2026-09-20T12:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "rw_0123456789abcdef0123456789abcdef",
                "name": "Reward",
                "cost": 0,
                "currency": null,
                "availability": null,
                "issued": 0,
                "expiry_after": null,
                "status": "active",
                "version": 1,
                "created_at": "2026-09-20T12:00:00.000Z",
                "updated_at": "2026-09-20T12:00:00.000Z"
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "rewards"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "Reward",
                "cost": 0
              },
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "cost": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "currency": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "availability": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "expiry_after": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d+[smhdw]$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "name"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "cost": {
                      "type": "number"
                    },
                    "currency": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "availability": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "issued": {
                      "type": "number"
                    },
                    "expiry_after": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "active",
                        "archived"
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "cost",
                    "currency",
                    "availability",
                    "issued",
                    "expiry_after",
                    "status",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/rewards/{id}": {
      "get": {
        "summary": "One reward",
        "tags": [
          "rewards"
        ],
        "operationId": "get_rewards_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found"
          ],
          "resource": "rewards",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "rw_0123456789abcdef0123456789abcdef",
                "name": "Reward",
                "cost": 0,
                "currency": null,
                "availability": null,
                "issued": 0,
                "expiry_after": null,
                "status": "active",
                "version": 1,
                "created_at": "2026-09-20T12:00:00.000Z",
                "updated_at": "2026-09-20T12:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads a program or mechanic of the selected environment; ids resolve inside it."
            }
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "cost": {
                      "type": "number"
                    },
                    "currency": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "availability": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "issued": {
                      "type": "number"
                    },
                    "expiry_after": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "active",
                        "archived"
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "cost",
                    "currency",
                    "availability",
                    "issued",
                    "expiry_after",
                    "status",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "patch": {
        "summary": "Edit or archive a reward (availability cannot drop below issued)",
        "tags": [
          "rewards"
        ],
        "operationId": "patch_rewards_id",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "optional",
            "responseEtag": true
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "resource_not_found",
            "concurrent_update"
          ],
          "resource": "rewards",
          "action": "update",
          "examples": {
            "request": {
              "name": "Updated"
            },
            "success": {
              "status": 200,
              "body": {
                "id": "rw_0123456789abcdef0123456789abcdef",
                "name": "Reward",
                "cost": 0,
                "currency": null,
                "availability": null,
                "issued": 0,
                "expiry_after": null,
                "status": "active",
                "version": 1,
                "created_at": "2026-09-20T12:00:00.000Z",
                "updated_at": "2026-09-20T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"1\""
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "rewards"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Optional legacy revision. Missing or malformed values follow the existing route parser."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "name": "Updated"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  },
                  "cost": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "currency": {
                    "anyOf": [
                      {
                        "type": "string",
                        "minLength": 1
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "availability": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "expiry_after": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d+[smhdw]$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "active",
                      "archived"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "cost": {
                      "type": "number"
                    },
                    "currency": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "availability": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "issued": {
                      "type": "number"
                    },
                    "expiry_after": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "active",
                        "archived"
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "cost",
                    "currency",
                    "availability",
                    "issued",
                    "expiry_after",
                    "status",
                    "version",
                    "created_at",
                    "updated_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Delete a never-issued, unreferenced reward",
        "tags": [
          "rewards"
        ],
        "operationId": "delete_rewards_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "resource_in_use"
          ],
          "resource": "rewards",
          "action": "delete",
          "examples": {
            "success": {
              "status": 204
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "resource_in_use",
                  "message": "resource in use",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#resource_in_use",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": true,
            "effectFamilies": [
              "rewards"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "204": {
            "description": "No content"
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/reward_issuances": {
      "get": {
        "summary": "List issuances",
        "tags": [
          "rewards"
        ],
        "operationId": "get_reward_issuances",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor",
            "invalid_state"
          ],
          "resource": "reward_issuances",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [
                  {
                    "id": "iss_0123456789abcdef0123456789abcdef",
                    "reward_id": "rw_0123456789abcdef0123456789abcdef",
                    "customer_id": "cust_0123456789abcdef0123456789abcdef",
                    "status": "issued",
                    "source_type": "manual",
                    "source_id": null,
                    "cost": 0,
                    "currency": null,
                    "cost_entry_id": null,
                    "expires_at": null,
                    "redeemed_at": null,
                    "cancelled_at": null,
                    "version": 1,
                    "created_at": "2026-09-20T12:00:00.000Z"
                  }
                ],
                "next_cursor": null,
                "has_more": false
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "customer_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "reward_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "issued",
                "redeemed",
                "cancelled",
                "expired"
              ]
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "reward_id": {
                            "type": "string"
                          },
                          "customer_id": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "issued",
                              "redeemed",
                              "cancelled",
                              "expired"
                            ]
                          },
                          "source_type": {
                            "type": "string",
                            "enum": [
                              "rule_execution",
                              "challenge",
                              "manual"
                            ]
                          },
                          "source_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "cost": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "currency": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "cost_entry_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "expires_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "redeemed_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "cancelled_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          },
                          "version": {
                            "type": "number"
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "id",
                          "reward_id",
                          "customer_id",
                          "status",
                          "source_type",
                          "source_id",
                          "cost",
                          "currency",
                          "cost_entry_id",
                          "expires_at",
                          "redeemed_at",
                          "cancelled_at",
                          "version",
                          "created_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Issue a reward to a customer manually (counts against availability)",
        "tags": [
          "rewards"
        ],
        "operationId": "post_reward_issuances",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "usage_allowance_exhausted",
            "free_allowance_exhausted",
            "live_requires_claim",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "concurrent_update",
            "invalid_state",
            "reward_unavailable"
          ],
          "resource": "reward_issuances",
          "action": "create",
          "examples": {
            "request": {
              "reward_id": "rw_0123456789abcdef0123456789abcdef",
              "customer_id": "cust_0123456789abcdef0123456789abcdef"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "iss_0123456789abcdef0123456789abcdef",
                "reward_id": "rw_0123456789abcdef0123456789abcdef",
                "customer_id": "cust_0123456789abcdef0123456789abcdef",
                "status": "issued",
                "source_type": "manual",
                "source_id": null,
                "cost": 0,
                "currency": null,
                "cost_entry_id": null,
                "expires_at": null,
                "redeemed_at": null,
                "cancelled_at": null,
                "version": 1,
                "created_at": "2026-09-20T12:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "reward_unavailable",
                  "message": "reward unavailable",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#reward_unavailable",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "iss_0123456789abcdef0123456789abcdef",
                "reward_id": "rw_0123456789abcdef0123456789abcdef",
                "customer_id": "cust_0123456789abcdef0123456789abcdef",
                "status": "issued",
                "source_type": "manual",
                "source_id": null,
                "cost": 0,
                "currency": null,
                "cost_entry_id": null,
                "expires_at": null,
                "redeemed_at": null,
                "cancelled_at": null,
                "version": 1,
                "created_at": "2026-09-20T12:00:00.000Z"
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "reward_issuances"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "reward_id": "rw_0123456789abcdef0123456789abcdef",
                "customer_id": "cust_0123456789abcdef0123456789abcdef"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "reward_id": {
                    "type": "string",
                    "minLength": 1
                  },
                  "customer_id": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "reward_id",
                  "customer_id"
                ]
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "reward_id": {
                      "type": "string"
                    },
                    "customer_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "issued",
                        "redeemed",
                        "cancelled",
                        "expired"
                      ]
                    },
                    "source_type": {
                      "type": "string",
                      "enum": [
                        "rule_execution",
                        "challenge",
                        "manual"
                      ]
                    },
                    "source_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "cost": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "currency": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "cost_entry_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "expires_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "redeemed_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "cancelled_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "reward_id",
                    "customer_id",
                    "status",
                    "source_type",
                    "source_id",
                    "cost",
                    "currency",
                    "cost_entry_id",
                    "expires_at",
                    "redeemed_at",
                    "cancelled_at",
                    "version",
                    "created_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/reward_issuances/{id}": {
      "get": {
        "summary": "One issuance",
        "tags": [
          "rewards"
        ],
        "operationId": "get_reward_issuances_id",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_state"
          ],
          "resource": "reward_issuances",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "iss_0123456789abcdef0123456789abcdef",
                "reward_id": "rw_0123456789abcdef0123456789abcdef",
                "customer_id": "cust_0123456789abcdef0123456789abcdef",
                "status": "issued",
                "source_type": "manual",
                "source_id": null,
                "cost": 0,
                "currency": null,
                "cost_entry_id": null,
                "expires_at": null,
                "redeemed_at": null,
                "cancelled_at": null,
                "version": 1,
                "created_at": "2026-09-20T12:00:00.000Z"
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": []
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:read"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:read"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "reward_id": {
                      "type": "string"
                    },
                    "customer_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "issued",
                        "redeemed",
                        "cancelled",
                        "expired"
                      ]
                    },
                    "source_type": {
                      "type": "string",
                      "enum": [
                        "rule_execution",
                        "challenge",
                        "manual"
                      ]
                    },
                    "source_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "cost": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "currency": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "cost_entry_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "expires_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "redeemed_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "cancelled_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "reward_id",
                    "customer_id",
                    "status",
                    "source_type",
                    "source_id",
                    "cost",
                    "currency",
                    "cost_entry_id",
                    "expires_at",
                    "redeemed_at",
                    "cancelled_at",
                    "version",
                    "created_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/reward_issuances/{id}/redeem": {
      "post": {
        "summary": "Redeem: issued → redeemed, spending the reward cost in the same transaction",
        "tags": [
          "rewards"
        ],
        "operationId": "post_reward_issuances_id_redeem",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "optional",
            "responseEtag": true
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "usage_allowance_exhausted",
            "free_allowance_exhausted",
            "live_requires_claim",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "resource_not_found",
            "concurrent_update",
            "invalid_state",
            "insufficient_balance"
          ],
          "idempotency": "optional",
          "resource": "reward_issuances",
          "action": "transition",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "iss_0123456789abcdef0123456789abcdef",
                "reward_id": "rw_0123456789abcdef0123456789abcdef",
                "customer_id": "cust_0123456789abcdef0123456789abcdef",
                "status": "redeemed",
                "source_type": "manual",
                "source_id": null,
                "cost": 0,
                "currency": null,
                "cost_entry_id": null,
                "expires_at": null,
                "redeemed_at": null,
                "cancelled_at": null,
                "version": 1,
                "created_at": "2026-09-20T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"1\""
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "transition": {
            "from": [
              "issued"
            ],
            "to": "redeemed"
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "reward_issuances"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "description": "Optional. When sent, the stored response is replayed for 24 h.",
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Optional. When sent, the stored response is replayed for 24 h."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Optional legacy revision. Missing or malformed values follow the existing route parser."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "reward_id": {
                      "type": "string"
                    },
                    "customer_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "issued",
                        "redeemed",
                        "cancelled",
                        "expired"
                      ]
                    },
                    "source_type": {
                      "type": "string",
                      "enum": [
                        "rule_execution",
                        "challenge",
                        "manual"
                      ]
                    },
                    "source_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "cost": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "currency": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "cost_entry_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "expires_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "redeemed_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "cancelled_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "reward_id",
                    "customer_id",
                    "status",
                    "source_type",
                    "source_id",
                    "cost",
                    "currency",
                    "cost_entry_id",
                    "expires_at",
                    "redeemed_at",
                    "cancelled_at",
                    "version",
                    "created_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/reward_issuances/{id}/cancel": {
      "post": {
        "summary": "Cancel: refunds a spent cost by reversal and releases availability",
        "tags": [
          "rewards"
        ],
        "operationId": "post_reward_issuances_id_cancel",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "optional",
            "responseEtag": true
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "usage_allowance_exhausted",
            "free_allowance_exhausted",
            "live_requires_claim",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "resource_not_found",
            "concurrent_update",
            "invalid_state"
          ],
          "idempotency": "optional",
          "resource": "reward_issuances",
          "action": "transition",
          "examples": {
            "request": {
              "reason": "Cancelled by operator"
            },
            "success": {
              "status": 200,
              "body": {
                "id": "iss_0123456789abcdef0123456789abcdef",
                "reward_id": "rw_0123456789abcdef0123456789abcdef",
                "customer_id": "cust_0123456789abcdef0123456789abcdef",
                "status": "cancelled",
                "source_type": "manual",
                "source_id": null,
                "cost": 0,
                "currency": null,
                "cost_entry_id": null,
                "expires_at": null,
                "redeemed_at": null,
                "cancelled_at": null,
                "version": 1,
                "created_at": "2026-09-20T12:00:00.000Z"
              },
              "headers": {
                "ETag": "\"1\""
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "transition": {
            "from": [
              "issued",
              "redeemed"
            ],
            "to": "cancelled"
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "reward_issuances"
            ]
          },
          "stability": "stable"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "credential_bound"
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "scopes": [
              "programs:write"
            ],
            "environment": "selected"
          },
          {
            "principals": [
              "staff"
            ],
            "scopes": [],
            "environment": "selected"
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "description": "Optional. When sent, the stored response is replayed for 24 h.",
              "type": "string",
              "minLength": 1,
              "maxLength": 255
            },
            "description": "Optional. When sent, the stored response is replayed for 24 h."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Optional legacy revision. Missing or malformed values follow the existing route parser."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "reason": "Cancelled by operator"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string",
                    "maxLength": 500
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "ETag": {
                "schema": {
                  "type": "string"
                },
                "description": "Resource revision."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "reward_id": {
                      "type": "string"
                    },
                    "customer_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "issued",
                        "redeemed",
                        "cancelled",
                        "expired"
                      ]
                    },
                    "source_type": {
                      "type": "string",
                      "enum": [
                        "rule_execution",
                        "challenge",
                        "manual"
                      ]
                    },
                    "source_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "cost": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "currency": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "cost_entry_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "expires_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "redeemed_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "cancelled_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "version": {
                      "type": "number"
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    }
                  },
                  "required": [
                    "id",
                    "reward_id",
                    "customer_id",
                    "status",
                    "source_type",
                    "source_id",
                    "cost",
                    "currency",
                    "cost_entry_id",
                    "expires_at",
                    "redeemed_at",
                    "cancelled_at",
                    "version",
                    "created_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "402": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/programs": {
      "get": {
        "summary": "List programs",
        "tags": [
          "programs"
        ],
        "operationId": "list_programs",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor",
            "rule_invalid",
            "invalid_state",
            "already_exists",
            "concurrent_update",
            "resource_in_use"
          ],
          "resource": "programs",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [
                  {
                    "id": "prog_example",
                    "environment_id": "env_example",
                    "kind": "quest",
                    "key": "welcome",
                    "name": "Welcome",
                    "status": "draft",
                    "active_version_id": null,
                    "authority": "contract",
                    "legacy_table": null,
                    "version": 1,
                    "created_at": "2026-09-20T00:00:00.000Z",
                    "updated_at": "2026-09-20T00:00:00.000Z",
                    "archived_at": null
                  }
                ],
                "next_cursor": null,
                "has_more": false
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads a program or mechanic of the selected environment; ids resolve inside it."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "rules:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "rules:read"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "query",
            "name": "kind",
            "schema": {
              "type": "string",
              "enum": [
                "tier",
                "quest",
                "campaign",
                "reward",
                "streak",
                "badge",
                "leaderboard",
                "referral"
              ]
            }
          },
          {
            "in": "query",
            "name": "status",
            "schema": {
              "type": "string",
              "enum": [
                "draft",
                "active",
                "paused",
                "ended",
                "archived"
              ]
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "environment_id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "tier",
                              "quest",
                              "campaign",
                              "reward",
                              "streak",
                              "badge",
                              "leaderboard",
                              "referral"
                            ]
                          },
                          "key": {
                            "type": "string",
                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                          },
                          "name": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "draft",
                              "active",
                              "paused",
                              "ended",
                              "archived"
                            ]
                          },
                          "active_version_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "authority": {
                            "type": "string",
                            "enum": [
                              "legacy",
                              "contract"
                            ]
                          },
                          "legacy_table": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "version": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "updated_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          },
                          "archived_at": {
                            "anyOf": [
                              {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                              },
                              {
                                "type": "null"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "environment_id",
                          "kind",
                          "key",
                          "name",
                          "status",
                          "active_version_id",
                          "authority",
                          "legacy_table",
                          "version",
                          "created_at",
                          "updated_at",
                          "archived_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Create a program draft",
        "tags": [
          "programs"
        ],
        "operationId": "create_program",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_cursor",
            "rule_invalid",
            "invalid_state",
            "already_exists",
            "concurrent_update",
            "resource_in_use"
          ],
          "resource": "programs",
          "action": "create",
          "examples": {
            "request": {
              "kind": "quest",
              "key": "welcome",
              "name": "Welcome"
            },
            "success": {
              "status": 201,
              "body": {
                "id": "prog_example",
                "environment_id": "env_example",
                "kind": "quest",
                "key": "welcome",
                "name": "Welcome",
                "status": "draft",
                "active_version_id": null,
                "authority": "contract",
                "legacy_table": null,
                "version": 1,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z",
                "archived_at": null
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "id": "prog_example",
                "environment_id": "env_example",
                "kind": "quest",
                "key": "welcome",
                "name": "Welcome",
                "status": "draft",
                "active_version_id": null,
                "authority": "contract",
                "legacy_table": null,
                "version": 1,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z",
                "archived_at": null
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "program_catalog"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "rules:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "rules:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "kind": "quest",
                "key": "welcome",
                "name": "Welcome"
              },
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "tier",
                      "quest",
                      "campaign",
                      "reward",
                      "streak",
                      "badge",
                      "leaderboard",
                      "referral"
                    ]
                  },
                  "key": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                  },
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 120
                  }
                },
                "required": [
                  "kind",
                  "key",
                  "name"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Success",
            "headers": {
              "Idempotent-Replayed": {
                "schema": {
                  "type": "string",
                  "enum": [
                    "true"
                  ]
                },
                "description": "Present when the stored result is replayed."
              },
              "Location": {
                "schema": {
                  "type": "string"
                },
                "description": "Created resource URL."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "environment_id": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "tier",
                        "quest",
                        "campaign",
                        "reward",
                        "streak",
                        "badge",
                        "leaderboard",
                        "referral"
                      ]
                    },
                    "key": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                    },
                    "name": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "active",
                        "paused",
                        "ended",
                        "archived"
                      ]
                    },
                    "active_version_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "authority": {
                      "type": "string",
                      "enum": [
                        "legacy",
                        "contract"
                      ]
                    },
                    "legacy_table": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "version": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "archived_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "environment_id",
                    "kind",
                    "key",
                    "name",
                    "status",
                    "active_version_id",
                    "authority",
                    "legacy_table",
                    "version",
                    "created_at",
                    "updated_at",
                    "archived_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/programs/{id}": {
      "get": {
        "summary": "Read a program",
        "tags": [
          "programs"
        ],
        "operationId": "get_program",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor",
            "rule_invalid",
            "invalid_state",
            "already_exists",
            "concurrent_update",
            "resource_in_use"
          ],
          "resource": "programs",
          "action": "read",
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "id": "prog_example",
                "environment_id": "env_example",
                "kind": "quest",
                "key": "welcome",
                "name": "Welcome",
                "status": "draft",
                "active_version_id": null,
                "authority": "contract",
                "legacy_table": null,
                "version": 1,
                "created_at": "2026-09-20T00:00:00.000Z",
                "updated_at": "2026-09-20T00:00:00.000Z",
                "archived_at": null
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads a program or mechanic of the selected environment; ids resolve inside it."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "rules:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "rules:read"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "environment_id": {
                      "type": "string"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "tier",
                        "quest",
                        "campaign",
                        "reward",
                        "streak",
                        "badge",
                        "leaderboard",
                        "referral"
                      ]
                    },
                    "key": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                    },
                    "name": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "draft",
                        "active",
                        "paused",
                        "ended",
                        "archived"
                      ]
                    },
                    "active_version_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "authority": {
                      "type": "string",
                      "enum": [
                        "legacy",
                        "contract"
                      ]
                    },
                    "legacy_table": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "version": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "created_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "updated_at": {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    "archived_at": {
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "environment_id",
                    "kind",
                    "key",
                    "name",
                    "status",
                    "active_version_id",
                    "authority",
                    "legacy_table",
                    "version",
                    "created_at",
                    "updated_at",
                    "archived_at"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Programs retain permanent history; use archive",
        "tags": [
          "programs"
        ],
        "operationId": "delete_program",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "outcome_unknown",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "test_player_limit",
            "test_environment_resetting",
            "resource_not_found",
            "invalid_cursor",
            "rule_invalid",
            "invalid_state",
            "already_exists",
            "concurrent_update",
            "resource_in_use"
          ],
          "resource": "programs",
          "action": "delete",
          "examples": {
            "success": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "resource_in_use",
                  "message": "resource in use",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#resource_in_use",
                  "request_id": "req_example"
                }
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": true,
            "effectFamilies": [
              "program_catalog"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "rules:write"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "rules:write"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/programs/{id}/versions": {
      "get": {
        "summary": "List immutable program versions",
        "tags": [
          "programs"
        ],
        "operationId": "list_program_versions",
        "x-orishare": {
          "concurrency": {
            "kind": "none"
          },
          "retry": "read",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "resource_not_found",
            "invalid_cursor",
            "rule_invalid",
            "invalid_state",
            "already_exists",
            "concurrent_update",
            "resource_in_use"
          ],
          "resource": "program_versions",
          "action": "list",
          "pagination": {
            "kind": "cursor",
            "defaultLimit": 50,
            "maximumLimit": 200
          },
          "examples": {
            "success": {
              "status": 200,
              "body": {
                "data": [
                  {
                    "id": "pv_example",
                    "program_id": "prog_example",
                    "number": 1,
                    "definition": {
                      "schema": "orishare.program/v1",
                      "kind": "quest",
                      "semantics": "native_v2",
                      "definition": {
                        "kind": "quest",
                        "steps": [
                          {
                            "key": "buy",
                            "aggregation": "count",
                            "target": 2
                          }
                        ],
                        "repeatable": false
                      },
                      "qualification": {
                        "sources": [
                          {
                            "event": "purchase",
                            "step": "buy",
                            "occurrence": "lifetime"
                          }
                        ]
                      },
                      "calendar": {
                        "schema": "orishare.calendar/v1",
                        "period": "none",
                        "run_per_period": false,
                        "timezone_source": "environment",
                        "day_start_offset_minutes": 0,
                        "ambiguous_local_time": "earlier",
                        "nonexistent_local_time": "next_valid",
                        "event_time": {
                          "merchant": "occurred_at",
                          "client": "received_at"
                        },
                        "grace_seconds": 0,
                        "max_lateness_seconds": 0,
                        "settlement_delay_seconds": 0,
                        "after_finalization": "correction_only"
                      },
                      "trust": {
                        "minimum_trust": "merchant_asserted",
                        "allowed_sources": [
                          "secret_key_event",
                          "operator_command"
                        ],
                        "on_insufficient": "ignore",
                        "liability_caps": [],
                        "recognition_caps": [],
                        "allow_legacy_unknown": false
                      },
                      "correction": {
                        "qualification": "reverse",
                        "spendable": "reverse",
                        "xp": "reverse",
                        "recognition": "keep",
                        "after_finalization": "correcting_revision",
                        "allowance_on_refund": "consumed"
                      },
                      "reward": {
                        "on": {
                          "completion": [
                            {
                              "type": "points.award",
                              "currency": "points",
                              "amount": 5,
                              "effect_key": "completion_points"
                            }
                          ]
                        }
                      },
                      "display": {
                        "sort_order": 0,
                        "hidden": false,
                        "locales": {}
                      },
                      "enrollment": {
                        "mode": "automatic"
                      }
                    },
                    "definition_hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                    "created_at": "2026-09-20T00:00:00.000Z"
                  }
                ],
                "next_cursor": null,
                "has_more": false
              }
            }
          },
          "tools": {
            "exposure": "read",
            "destructive": false,
            "effectFamilies": [],
            "assistant": {
              "offered": true,
              "reason": "Reads a program or mechanic of the selected environment; ids resolve inside it."
            }
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "rules:read"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "scopes": [
              "rules:read"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 50,
              "type": "integer",
              "minimum": 1,
              "maximum": 200
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string",
              "maxLength": 2048
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "program_id": {
                            "type": "string"
                          },
                          "number": {
                            "type": "integer",
                            "minimum": -9007199254740991,
                            "maximum": 9007199254740991
                          },
                          "definition": {
                            "anyOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "schema": {
                                    "type": "string",
                                    "const": "orishare.program/v1"
                                  },
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "tier",
                                      "quest",
                                      "campaign",
                                      "reward",
                                      "streak",
                                      "badge",
                                      "leaderboard",
                                      "referral"
                                    ]
                                  },
                                  "semantics": {
                                    "type": "string",
                                    "enum": [
                                      "native_v2",
                                      "compat_v1"
                                    ]
                                  },
                                  "definition": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "tier"
                                          },
                                          "legacy": {
                                            "type": "object",
                                            "propertyNames": {
                                              "type": "string"
                                            },
                                            "additionalProperties": {
                                              "$ref": "#/components/schemas/__schema5"
                                            }
                                          },
                                          "currency": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "basis": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "lifetime_earned"
                                                  }
                                                },
                                                "required": [
                                                  "type"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "balance"
                                                  }
                                                },
                                                "required": [
                                                  "type"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "earned_rolling_days"
                                                  },
                                                  "days": {
                                                    "type": "integer",
                                                    "exclusiveMinimum": 0,
                                                    "maximum": 9007199254740991
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "days"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "earned_calendar_year"
                                                  }
                                                },
                                                "required": [
                                                  "type"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "earned_anniversary_year"
                                                  }
                                                },
                                                "required": [
                                                  "type"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ],
                                            "type": "object"
                                          },
                                          "downgrade_check": {
                                            "type": "string",
                                            "enum": [
                                              "daily",
                                              "monthly",
                                              "never"
                                            ]
                                          },
                                          "levels": {
                                            "minItems": 1,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "threshold": {
                                                  "type": "integer",
                                                  "minimum": 0,
                                                  "maximum": 9007199254740991
                                                }
                                              },
                                              "required": [
                                                "key",
                                                "threshold"
                                              ],
                                              "additionalProperties": false
                                            }
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "currency",
                                          "basis",
                                          "downgrade_check",
                                          "levels"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "quest"
                                          },
                                          "legacy": {
                                            "type": "object",
                                            "propertyNames": {
                                              "type": "string"
                                            },
                                            "additionalProperties": {
                                              "$ref": "#/components/schemas/__schema5"
                                            }
                                          },
                                          "steps": {
                                            "minItems": 1,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "aggregation": {
                                                  "type": "string",
                                                  "enum": [
                                                    "count",
                                                    "sum"
                                                  ]
                                                },
                                                "target": {
                                                  "type": "integer",
                                                  "exclusiveMinimum": 0,
                                                  "maximum": 9007199254740991
                                                }
                                              },
                                              "required": [
                                                "key",
                                                "aggregation",
                                                "target"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "repeatable": {
                                            "type": "boolean"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "steps",
                                          "repeatable"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "campaign"
                                          },
                                          "legacy": {
                                            "type": "object",
                                            "propertyNames": {
                                              "type": "string"
                                            },
                                            "additionalProperties": {
                                              "$ref": "#/components/schemas/__schema5"
                                            }
                                          },
                                          "priority": {
                                            "default": 0,
                                            "type": "integer",
                                            "minimum": -9007199254740991,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "priority"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "reward"
                                          },
                                          "legacy": {
                                            "type": "object",
                                            "propertyNames": {
                                              "type": "string"
                                            },
                                            "additionalProperties": {
                                              "$ref": "#/components/schemas/__schema5"
                                            }
                                          },
                                          "reward": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "reward"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "streak"
                                          },
                                          "target": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "maximum": 9007199254740991
                                          },
                                          "freezes": {
                                            "default": 0,
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "target",
                                          "freezes"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "badge"
                                          },
                                          "repeatable": {
                                            "default": false,
                                            "type": "boolean"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "repeatable"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "leaderboard"
                                          },
                                          "aggregation": {
                                            "type": "string",
                                            "enum": [
                                              "sum",
                                              "max",
                                              "count"
                                            ]
                                          },
                                          "order": {
                                            "type": "string",
                                            "enum": [
                                              "ascending",
                                              "descending"
                                            ]
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "aggregation",
                                          "order"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "referral"
                                          },
                                          "target": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "target"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ],
                                    "type": "object"
                                  },
                                  "qualification": {
                                    "type": "object",
                                    "properties": {
                                      "sources": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "event": {
                                              "type": "string",
                                              "minLength": 1
                                            },
                                            "conditions": {
                                              "$ref": "#/components/schemas/__schema6"
                                            },
                                            "value": {
                                              "anyOf": [
                                                {
                                                  "type": "number"
                                                },
                                                {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              ]
                                            },
                                            "step": {
                                              "type": "string",
                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                            },
                                            "occurrence": {
                                              "default": "lifetime",
                                              "type": "string",
                                              "enum": [
                                                "lifetime",
                                                "period"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "event",
                                            "occurrence"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "audience": {
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        }
                                      },
                                      "starts_at": {
                                        "type": "string",
                                        "format": "date-time",
                                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                      },
                                      "ends_at": {
                                        "type": "string",
                                        "format": "date-time",
                                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                      },
                                      "campaign": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                      }
                                    },
                                    "required": [
                                      "sources"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "calendar": {
                                    "type": "object",
                                    "properties": {
                                      "schema": {
                                        "type": "string",
                                        "const": "orishare.calendar/v1"
                                      },
                                      "period": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "enum": [
                                              "none",
                                              "day",
                                              "week",
                                              "month",
                                              "year"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "const": "season"
                                              },
                                              "starts_at": {
                                                "type": "string",
                                                "format": "date-time",
                                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                              },
                                              "ends_at": {
                                                "type": "string",
                                                "format": "date-time",
                                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "starts_at",
                                              "ends_at"
                                            ],
                                            "additionalProperties": false
                                          }
                                        ]
                                      },
                                      "run_per_period": {
                                        "type": "boolean"
                                      },
                                      "timezone_source": {
                                        "type": "string",
                                        "enum": [
                                          "environment",
                                          "customer",
                                          "fixed"
                                        ]
                                      },
                                      "timezone": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "day_start_offset_minutes": {
                                        "default": 0,
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 1439
                                      },
                                      "ambiguous_local_time": {
                                        "type": "string",
                                        "const": "earlier"
                                      },
                                      "nonexistent_local_time": {
                                        "type": "string",
                                        "const": "next_valid"
                                      },
                                      "event_time": {
                                        "type": "object",
                                        "properties": {
                                          "merchant": {
                                            "type": "string",
                                            "const": "occurred_at"
                                          },
                                          "client": {
                                            "anyOf": [
                                              {
                                                "type": "string",
                                                "const": "received_at"
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "offline_seconds": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 9007199254740991
                                                  }
                                                },
                                                "required": [
                                                  "offline_seconds"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ]
                                          }
                                        },
                                        "required": [
                                          "merchant",
                                          "client"
                                        ],
                                        "additionalProperties": false
                                      },
                                      "grace_seconds": {
                                        "default": 0,
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "max_lateness_seconds": {
                                        "default": 0,
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "settlement_delay_seconds": {
                                        "default": 0,
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "after_finalization": {
                                        "type": "string",
                                        "const": "correction_only"
                                      }
                                    },
                                    "required": [
                                      "schema",
                                      "period",
                                      "run_per_period",
                                      "timezone_source",
                                      "day_start_offset_minutes",
                                      "ambiguous_local_time",
                                      "nonexistent_local_time",
                                      "event_time",
                                      "grace_seconds",
                                      "max_lateness_seconds",
                                      "settlement_delay_seconds",
                                      "after_finalization"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "trust": {
                                    "type": "object",
                                    "properties": {
                                      "minimum_trust": {
                                        "type": "string",
                                        "enum": [
                                          "anonymous_claim",
                                          "customer_claim",
                                          "merchant_asserted",
                                          "verified_evidence",
                                          "legacy_unknown"
                                        ]
                                      },
                                      "allowed_sources": {
                                        "minItems": 1,
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "enum": [
                                            "publishable_event",
                                            "secret_key_event",
                                            "verified_connector",
                                            "operator_command",
                                            "customer_command",
                                            "import",
                                            "program_transition",
                                            "schedule"
                                          ]
                                        }
                                      },
                                      "on_insufficient": {
                                        "type": "string",
                                        "enum": [
                                          "ignore",
                                          "progress_without_reward"
                                        ]
                                      },
                                      "liability_caps": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "trust": {
                                              "type": "string",
                                              "enum": [
                                                "anonymous_claim",
                                                "customer_claim",
                                                "merchant_asserted",
                                                "verified_evidence",
                                                "legacy_unknown"
                                              ]
                                            },
                                            "currency": {
                                              "type": "string",
                                              "pattern": "^[A-Za-z0-9_-]+$"
                                            },
                                            "scope": {
                                              "type": "string",
                                              "enum": [
                                                "customer",
                                                "environment"
                                              ]
                                            },
                                            "window": {
                                              "type": "string",
                                              "enum": [
                                                "day",
                                                "month",
                                                "lifetime"
                                              ]
                                            },
                                            "maximum_minor": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 9007199254740991
                                            }
                                          },
                                          "required": [
                                            "trust",
                                            "currency",
                                            "scope",
                                            "window",
                                            "maximum_minor"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "recognition_caps": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "trust": {
                                              "type": "string",
                                              "enum": [
                                                "anonymous_claim",
                                                "customer_claim",
                                                "merchant_asserted",
                                                "verified_evidence",
                                                "legacy_unknown"
                                              ]
                                            },
                                            "per": {
                                              "type": "string",
                                              "enum": [
                                                "period",
                                                "day"
                                              ]
                                            },
                                            "contributions": {
                                              "type": "integer",
                                              "exclusiveMinimum": 0,
                                              "maximum": 9007199254740991
                                            },
                                            "value": {
                                              "type": "integer",
                                              "exclusiveMinimum": 0,
                                              "maximum": 9007199254740991
                                            }
                                          },
                                          "required": [
                                            "trust",
                                            "per"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "allow_legacy_unknown": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "minimum_trust",
                                      "allowed_sources",
                                      "on_insufficient",
                                      "liability_caps",
                                      "recognition_caps",
                                      "allow_legacy_unknown"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "correction": {
                                    "type": "object",
                                    "properties": {
                                      "qualification": {
                                        "default": "reverse",
                                        "type": "string",
                                        "enum": [
                                          "reverse",
                                          "keep"
                                        ]
                                      },
                                      "spendable": {
                                        "type": "string",
                                        "const": "reverse"
                                      },
                                      "xp": {
                                        "default": "reverse",
                                        "type": "string",
                                        "enum": [
                                          "reverse",
                                          "keep"
                                        ]
                                      },
                                      "recognition": {
                                        "default": "keep",
                                        "type": "string",
                                        "enum": [
                                          "keep",
                                          "revoke_on_fraud"
                                        ]
                                      },
                                      "after_finalization": {
                                        "default": "correcting_revision",
                                        "type": "string",
                                        "const": "correcting_revision"
                                      },
                                      "allowance_on_refund": {
                                        "default": "consumed",
                                        "type": "string",
                                        "enum": [
                                          "consumed",
                                          "release_on_verified_void"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "qualification",
                                      "spendable",
                                      "xp",
                                      "recognition",
                                      "after_finalization",
                                      "allowance_on_refund"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "reward": {
                                    "type": "object",
                                    "properties": {
                                      "on": {
                                        "type": "object",
                                        "propertyNames": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]*(?::[a-z0-9_]+)?$"
                                        },
                                        "additionalProperties": {
                                          "type": "array",
                                          "items": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "points.award"
                                                  },
                                                  "currency": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "amount": {
                                                    "anyOf": [
                                                      {
                                                        "type": "number"
                                                      },
                                                      {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    ]
                                                  },
                                                  "reason": {
                                                    "type": "string",
                                                    "maxLength": 200
                                                  },
                                                  "confirm_after": {
                                                    "type": "string",
                                                    "pattern": "^\\d+[smhdw]$"
                                                  },
                                                  "expires_after": {
                                                    "type": "string",
                                                    "pattern": "^\\d+[smhdw]$"
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "currency",
                                                  "amount",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "points.deduct"
                                                  },
                                                  "currency": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "amount": {
                                                    "anyOf": [
                                                      {
                                                        "type": "number"
                                                      },
                                                      {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    ]
                                                  },
                                                  "reason": {
                                                    "type": "string",
                                                    "maxLength": 200
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "currency",
                                                  "amount",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "points.reverse"
                                                  },
                                                  "currency": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "match": {
                                                    "type": "object",
                                                    "properties": {
                                                      "event": {
                                                        "type": "string",
                                                        "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                      },
                                                      "on": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    },
                                                    "required": [
                                                      "event",
                                                      "on"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  "fraction": {
                                                    "anyOf": [
                                                      {
                                                        "type": "number"
                                                      },
                                                      {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    ]
                                                  },
                                                  "amount": {
                                                    "anyOf": [
                                                      {
                                                        "type": "number"
                                                      },
                                                      {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    ]
                                                  },
                                                  "reason": {
                                                    "type": "string",
                                                    "maxLength": 200
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "currency",
                                                  "match",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "reward.issue"
                                                  },
                                                  "reward": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "reward",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "tier.evaluate"
                                                  },
                                                  "program": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "program",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "attribute.set"
                                                  },
                                                  "attribute": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "value": {
                                                    "type": [
                                                      "string",
                                                      "number",
                                                      "boolean",
                                                      "null"
                                                    ]
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "attribute",
                                                  "value",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "webhook.emit"
                                                  },
                                                  "event": {
                                                    "type": "string",
                                                    "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                  },
                                                  "payload": {
                                                    "type": "object",
                                                    "propertyNames": {
                                                      "type": "string"
                                                    },
                                                    "additionalProperties": {
                                                      "anyOf": [
                                                        {
                                                          "type": [
                                                            "string",
                                                            "number",
                                                            "boolean"
                                                          ]
                                                        },
                                                        {
                                                          "type": "null"
                                                        },
                                                        {
                                                          "type": "array",
                                                          "items": {
                                                            "type": [
                                                              "string",
                                                              "number",
                                                              "boolean"
                                                            ]
                                                          }
                                                        }
                                                      ]
                                                    }
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "event",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "badge.grant"
                                                  },
                                                  "badge": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "occurrence": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "badge",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "streak.contribute"
                                                  },
                                                  "streak": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "value": {
                                                    "anyOf": [
                                                      {
                                                        "type": "number"
                                                      },
                                                      {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    ]
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "streak",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "streak.freeze_grant"
                                                  },
                                                  "streak": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "quantity": {
                                                    "type": "integer",
                                                    "exclusiveMinimum": 0,
                                                    "maximum": 9007199254740991
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "streak",
                                                  "quantity",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "quest.contribute"
                                                  },
                                                  "quest": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "step": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "value": {
                                                    "anyOf": [
                                                      {
                                                        "type": "number"
                                                      },
                                                      {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    ]
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "quest",
                                                  "step",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "quest.enroll"
                                                  },
                                                  "quest": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "quest",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "leaderboard.contribute"
                                                  },
                                                  "leaderboard": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "value": {
                                                    "anyOf": [
                                                      {
                                                        "type": "number"
                                                      },
                                                      {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    ]
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "leaderboard",
                                                  "value",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "program.reverse_contribution"
                                                  },
                                                  "program": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "source_fact": {
                                                    "anyOf": [
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "fact_id": {
                                                            "type": "string",
                                                            "pattern": "^[A-Za-z0-9_-]+$"
                                                          }
                                                        },
                                                        "required": [
                                                          "fact_id"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "object_type": {
                                                            "type": "string",
                                                            "pattern": "^[A-Za-z0-9_-]+$"
                                                          },
                                                          "key": {
                                                            "minItems": 1,
                                                            "type": "array",
                                                            "items": {
                                                              "type": "string",
                                                              "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_-]*(?:\\.[A-Za-z_][A-Za-z0-9_-]*)*$"
                                                            }
                                                          }
                                                        },
                                                        "required": [
                                                          "object_type",
                                                          "key"
                                                        ],
                                                        "additionalProperties": false
                                                      }
                                                    ]
                                                  },
                                                  "fraction": {
                                                    "type": "string",
                                                    "pattern": "^(?:0(?:\\.\\d+)?|1(?:\\.0+)?)$"
                                                  },
                                                  "amount": {
                                                    "type": "number",
                                                    "exclusiveMinimum": 0
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "program",
                                                  "source_fact",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ]
                                          }
                                        }
                                      }
                                    },
                                    "required": [
                                      "on"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "display": {
                                    "type": "object",
                                    "properties": {
                                      "title": {
                                        "type": "string"
                                      },
                                      "description": {
                                        "type": "string"
                                      },
                                      "image_url": {
                                        "type": "string",
                                        "format": "uri"
                                      },
                                      "icon": {
                                        "type": "string"
                                      },
                                      "color": {
                                        "type": "string"
                                      },
                                      "sort_order": {
                                        "default": 0,
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "hidden": {
                                        "default": false,
                                        "type": "boolean"
                                      },
                                      "locales": {
                                        "default": {},
                                        "type": "object",
                                        "propertyNames": {
                                          "type": "string",
                                          "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
                                        },
                                        "additionalProperties": {
                                          "type": "object",
                                          "properties": {
                                            "title": {
                                              "type": "string"
                                            },
                                            "description": {
                                              "type": "string"
                                            }
                                          },
                                          "additionalProperties": false
                                        }
                                      }
                                    },
                                    "required": [
                                      "sort_order",
                                      "hidden",
                                      "locales"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "enrollment": {
                                    "type": "object",
                                    "properties": {
                                      "mode": {
                                        "default": "automatic",
                                        "type": "string",
                                        "enum": [
                                          "automatic",
                                          "explicit"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "mode"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "schema",
                                  "kind",
                                  "semantics",
                                  "definition",
                                  "qualification",
                                  "calendar",
                                  "trust",
                                  "correction",
                                  "reward",
                                  "display",
                                  "enrollment"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "schema": {
                                    "type": "string",
                                    "const": "orishare.program/v2"
                                  },
                                  "kind": {
                                    "type": "string",
                                    "enum": [
                                      "tier",
                                      "quest",
                                      "campaign",
                                      "reward",
                                      "streak",
                                      "badge",
                                      "leaderboard",
                                      "referral"
                                    ]
                                  },
                                  "semantics": {
                                    "type": "string",
                                    "const": "native_v2"
                                  },
                                  "definition": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "streak"
                                          },
                                          "qualification": {
                                            "type": "object",
                                            "properties": {
                                              "aggregation": {
                                                "type": "string",
                                                "enum": [
                                                  "count",
                                                  "sum"
                                                ]
                                              },
                                              "minimum": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "aggregation",
                                              "minimum"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "freezes": {
                                            "type": "object",
                                            "properties": {
                                              "ceiling": {
                                                "type": "integer",
                                                "minimum": 0,
                                                "maximum": 1000
                                              },
                                              "auto_use": {
                                                "default": true,
                                                "type": "boolean"
                                              },
                                              "purchase": {
                                                "type": "object",
                                                "properties": {
                                                  "currency": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "amount_minor": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "currency",
                                                  "amount_minor"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "required": [
                                              "ceiling",
                                              "auto_use"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "milestones": {
                                            "maxItems": 64,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "threshold": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 9007199254740991
                                                },
                                                "occurrence": {
                                                  "type": "string",
                                                  "enum": [
                                                    "lifetime",
                                                    "episode"
                                                  ]
                                                }
                                              },
                                              "required": [
                                                "key",
                                                "threshold",
                                                "occurrence"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "repair": {
                                            "type": "object",
                                            "properties": {
                                              "price": {
                                                "type": "object",
                                                "properties": {
                                                  "currency": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "amount_minor": {
                                                    "type": "string"
                                                  }
                                                },
                                                "required": [
                                                  "currency",
                                                  "amount_minor"
                                                ],
                                                "additionalProperties": false
                                              },
                                              "window_periods": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 30
                                              },
                                              "maximum_per_days": {
                                                "type": "object",
                                                "properties": {
                                                  "count": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 1000
                                                  },
                                                  "days": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 366
                                                  }
                                                },
                                                "required": [
                                                  "count",
                                                  "days"
                                                ],
                                                "additionalProperties": false
                                              }
                                            },
                                            "required": [
                                              "price",
                                              "window_periods"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "protected_weekdays": {
                                            "minItems": 1,
                                            "maxItems": 6,
                                            "type": "array",
                                            "items": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 6
                                            }
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "qualification",
                                          "freezes",
                                          "milestones"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "badge"
                                          },
                                          "qualification": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "aggregation": {
                                                    "type": "string",
                                                    "const": "count"
                                                  }
                                                },
                                                "required": [
                                                  "aggregation"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "aggregation": {
                                                    "type": "string",
                                                    "const": "sum"
                                                  }
                                                },
                                                "required": [
                                                  "aggregation"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "aggregation": {
                                                    "type": "string",
                                                    "const": "distinct"
                                                  },
                                                  "distinct_key": {
                                                    "type": "string",
                                                    "maxLength": 255,
                                                    "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                                  }
                                                },
                                                "required": [
                                                  "aggregation",
                                                  "distinct_key"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ],
                                            "type": "object"
                                          },
                                          "ranks": {
                                            "minItems": 1,
                                            "maxItems": 64,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "threshold": {
                                                  "type": "string"
                                                },
                                                "display": {
                                                  "type": "object",
                                                  "properties": {
                                                    "title": {
                                                      "type": "string",
                                                      "maxLength": 255
                                                    },
                                                    "description": {
                                                      "type": "string",
                                                      "maxLength": 4096
                                                    }
                                                  },
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "key",
                                                "threshold"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "visibility": {
                                            "type": "string",
                                            "enum": [
                                              "visible",
                                              "hidden_until_earned"
                                            ]
                                          },
                                          "collection": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "repeatable": {
                                            "type": "boolean"
                                          },
                                          "occurrence": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "lifetime"
                                                  }
                                                },
                                                "required": [
                                                  "type"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "period"
                                                  }
                                                },
                                                "required": [
                                                  "type"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "season"
                                                  }
                                                },
                                                "required": [
                                                  "type"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "verified_fact"
                                                  }
                                                },
                                                "required": [
                                                  "type"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ],
                                            "type": "object"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "qualification",
                                          "ranks",
                                          "visibility",
                                          "repeatable",
                                          "occurrence"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "quest"
                                          },
                                          "steps": {
                                            "minItems": 1,
                                            "maxItems": 32,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "aggregation": {
                                                  "type": "string",
                                                  "enum": [
                                                    "count",
                                                    "sum",
                                                    "distinct"
                                                  ]
                                                },
                                                "target": {
                                                  "type": "string"
                                                },
                                                "distinct_key": {
                                                  "type": "string",
                                                  "maxLength": 255,
                                                  "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                                },
                                                "display": {
                                                  "type": "object",
                                                  "properties": {
                                                    "title": {
                                                      "type": "string",
                                                      "maxLength": 255
                                                    },
                                                    "description": {
                                                      "type": "string",
                                                      "maxLength": 4096
                                                    }
                                                  },
                                                  "additionalProperties": false
                                                },
                                                "available_from": {
                                                  "type": "string",
                                                  "format": "date-time",
                                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                },
                                                "deadline": {
                                                  "type": "string",
                                                  "format": "date-time",
                                                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                                }
                                              },
                                              "required": [
                                                "key",
                                                "aggregation",
                                                "target",
                                                "display"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "prerequisites": {
                                            "maxItems": 64,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "step": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "requires": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                }
                                              },
                                              "required": [
                                                "step",
                                                "requires"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "collection": {
                                            "type": "string",
                                            "enum": [
                                              "auto_collect",
                                              "claim"
                                            ]
                                          },
                                          "repeatable": {
                                            "type": "boolean"
                                          },
                                          "claim_deadline": {
                                            "type": "string",
                                            "format": "date-time",
                                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                          },
                                          "chain": {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "const": "program"
                                              },
                                              "key": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                              },
                                              "version": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 9007199254740991
                                              },
                                              "digest": {
                                                "type": "string",
                                                "pattern": "^[a-f0-9]{64}$"
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "key",
                                              "version",
                                              "digest"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "rotation": {
                                            "type": "object",
                                            "properties": {
                                              "candidates": {
                                                "minItems": 1,
                                                "maxItems": 100,
                                                "type": "array",
                                                "items": {
                                                  "type": "object",
                                                  "properties": {
                                                    "kind": {
                                                      "type": "string",
                                                      "const": "program"
                                                    },
                                                    "key": {
                                                      "type": "string",
                                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                    },
                                                    "version": {
                                                      "type": "integer",
                                                      "minimum": 1,
                                                      "maximum": 9007199254740991
                                                    },
                                                    "digest": {
                                                      "type": "string",
                                                      "pattern": "^[a-f0-9]{64}$"
                                                    }
                                                  },
                                                  "required": [
                                                    "kind",
                                                    "key",
                                                    "version",
                                                    "digest"
                                                  ],
                                                  "additionalProperties": false
                                                }
                                              },
                                              "select": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 100
                                              }
                                            },
                                            "required": [
                                              "candidates",
                                              "select"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "steps",
                                          "prerequisites",
                                          "collection",
                                          "repeatable"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "tier"
                                          },
                                          "currency": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "basis": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "lifetime_earned"
                                                  }
                                                },
                                                "required": [
                                                  "type"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "balance"
                                                  }
                                                },
                                                "required": [
                                                  "type"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "earned_rolling_days"
                                                  },
                                                  "days": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 9007199254740991
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "days"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ],
                                            "type": "object"
                                          },
                                          "downgrade_check": {
                                            "type": "string",
                                            "enum": [
                                              "daily",
                                              "monthly",
                                              "never"
                                            ]
                                          },
                                          "levels": {
                                            "minItems": 1,
                                            "maxItems": 1000,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "threshold": {
                                                  "type": "string"
                                                },
                                                "display": {
                                                  "type": "object",
                                                  "properties": {
                                                    "title": {
                                                      "type": "string",
                                                      "maxLength": 255
                                                    },
                                                    "description": {
                                                      "type": "string",
                                                      "maxLength": 4096
                                                    }
                                                  },
                                                  "additionalProperties": false
                                                }
                                              },
                                              "required": [
                                                "key",
                                                "threshold",
                                                "display"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "occurrence": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "lifetime"
                                                  }
                                                },
                                                "required": [
                                                  "type"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "season"
                                                  }
                                                },
                                                "required": [
                                                  "type"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "prestige"
                                                  },
                                                  "maximum_runs": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 9007199254740991
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "maximum_runs"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ],
                                            "type": "object"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "currency",
                                          "basis",
                                          "downgrade_check",
                                          "levels",
                                          "occurrence"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "leaderboard"
                                          },
                                          "aggregation": {
                                            "type": "string",
                                            "enum": [
                                              "sum",
                                              "max",
                                              "latest_verified"
                                            ]
                                          },
                                          "input": {
                                            "type": "object",
                                            "properties": {
                                              "minimum": {
                                                "type": "string"
                                              },
                                              "maximum": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "minimum",
                                              "maximum"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "order": {
                                            "type": "string",
                                            "enum": [
                                              "ascending",
                                              "descending"
                                            ]
                                          },
                                          "scope": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "global"
                                                  }
                                                },
                                                "required": [
                                                  "type"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "segment"
                                                  },
                                                  "segment": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "segment"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "group_key"
                                                  },
                                                  "key": {
                                                    "type": "string",
                                                    "maxLength": 255,
                                                    "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "key"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ],
                                            "type": "object"
                                          },
                                          "rank": {
                                            "type": "string",
                                            "const": "ordinal"
                                          },
                                          "privacy": {
                                            "type": "object",
                                            "properties": {
                                              "display": {
                                                "type": "string",
                                                "const": "pseudonymous"
                                              },
                                              "opt_out": {
                                                "type": "boolean",
                                                "const": true
                                              },
                                              "anonymous_entries": {
                                                "type": "boolean",
                                                "const": false
                                              }
                                            },
                                            "required": [
                                              "display",
                                              "opt_out",
                                              "anonymous_entries"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "prizes": {
                                            "maxItems": 100,
                                            "type": "array",
                                            "items": {
                                              "type": "object",
                                              "properties": {
                                                "key": {
                                                  "type": "string",
                                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                },
                                                "from": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 1000
                                                },
                                                "through": {
                                                  "type": "integer",
                                                  "minimum": 1,
                                                  "maximum": 1000
                                                },
                                                "awards": {
                                                  "minItems": 1,
                                                  "maxItems": 16,
                                                  "type": "array",
                                                  "items": {
                                                    "oneOf": [
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "currency": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                          },
                                                          "amount_minor": {
                                                            "type": "string"
                                                          },
                                                          "type": {
                                                            "type": "string",
                                                            "const": "currency"
                                                          }
                                                        },
                                                        "required": [
                                                          "currency",
                                                          "amount_minor",
                                                          "type"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "type": {
                                                            "type": "string",
                                                            "const": "reward"
                                                          },
                                                          "reward": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                          },
                                                          "quantity": {
                                                            "type": "number",
                                                            "const": 1
                                                          }
                                                        },
                                                        "required": [
                                                          "type",
                                                          "reward",
                                                          "quantity"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "type": {
                                                            "type": "string",
                                                            "const": "item"
                                                          },
                                                          "item": {
                                                            "type": "string",
                                                            "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                          },
                                                          "quantity": {
                                                            "type": "integer",
                                                            "minimum": 1,
                                                            "maximum": 1000
                                                          }
                                                        },
                                                        "required": [
                                                          "type",
                                                          "item",
                                                          "quantity"
                                                        ],
                                                        "additionalProperties": false
                                                      }
                                                    ],
                                                    "type": "object"
                                                  }
                                                }
                                              },
                                              "required": [
                                                "key",
                                                "from",
                                                "through",
                                                "awards"
                                              ],
                                              "additionalProperties": false
                                            }
                                          },
                                          "score_source": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "contributions"
                                                  }
                                                },
                                                "required": [
                                                  "type"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "currency_earned"
                                                  },
                                                  "currency": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "currency"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "currency_balance"
                                                  },
                                                  "currency": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "currency"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ],
                                            "type": "object"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "aggregation",
                                          "input",
                                          "order",
                                          "scope",
                                          "rank",
                                          "privacy",
                                          "prizes"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "referral"
                                          },
                                          "attribution_window_seconds": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 9007199254740991
                                          },
                                          "account_eligibility": {
                                            "type": "string",
                                            "enum": [
                                              "new",
                                              "existing",
                                              "any"
                                            ]
                                          },
                                          "new_account_window_seconds": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 9007199254740991
                                          },
                                          "allow_anonymous_claim": {
                                            "type": "boolean"
                                          },
                                          "qualifying_event": {
                                            "type": "string",
                                            "maxLength": 255,
                                            "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                          },
                                          "minimum": {
                                            "type": "object",
                                            "properties": {
                                              "currency": {
                                                "type": "string",
                                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                              },
                                              "amount_minor": {
                                                "type": "string"
                                              }
                                            },
                                            "required": [
                                              "currency",
                                              "amount_minor"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "cooling_off_seconds": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 9007199254740991
                                          },
                                          "rewards": {
                                            "type": "object",
                                            "properties": {
                                              "referrer": {
                                                "minItems": 1,
                                                "maxItems": 16,
                                                "type": "array",
                                                "items": {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "string"
                                                        },
                                                        "type": {
                                                          "type": "string",
                                                          "const": "currency"
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor",
                                                        "type"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "reward"
                                                        },
                                                        "reward": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "quantity": {
                                                          "type": "number",
                                                          "const": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "reward",
                                                        "quantity"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "item"
                                                        },
                                                        "item": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                        },
                                                        "quantity": {
                                                          "type": "integer",
                                                          "minimum": 1,
                                                          "maximum": 1000
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "item",
                                                        "quantity"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  ],
                                                  "type": "object"
                                                }
                                              },
                                              "referred": {
                                                "minItems": 1,
                                                "maxItems": 16,
                                                "type": "array",
                                                "items": {
                                                  "oneOf": [
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "currency": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "amount_minor": {
                                                          "type": "string"
                                                        },
                                                        "type": {
                                                          "type": "string",
                                                          "const": "currency"
                                                        }
                                                      },
                                                      "required": [
                                                        "currency",
                                                        "amount_minor",
                                                        "type"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "reward"
                                                        },
                                                        "reward": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                        },
                                                        "quantity": {
                                                          "type": "number",
                                                          "const": 1
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "reward",
                                                        "quantity"
                                                      ],
                                                      "additionalProperties": false
                                                    },
                                                    {
                                                      "type": "object",
                                                      "properties": {
                                                        "type": {
                                                          "type": "string",
                                                          "const": "item"
                                                        },
                                                        "item": {
                                                          "type": "string",
                                                          "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                        },
                                                        "quantity": {
                                                          "type": "integer",
                                                          "minimum": 1,
                                                          "maximum": 1000
                                                        }
                                                      },
                                                      "required": [
                                                        "type",
                                                        "item",
                                                        "quantity"
                                                      ],
                                                      "additionalProperties": false
                                                    }
                                                  ],
                                                  "type": "object"
                                                }
                                              }
                                            },
                                            "required": [
                                              "referrer",
                                              "referred"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "caps": {
                                            "type": "object",
                                            "properties": {
                                              "per_referrer": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 9007199254740991
                                              },
                                              "per_environment": {
                                                "type": "integer",
                                                "minimum": 1,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "per_referrer",
                                              "per_environment"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "refund": {
                                            "type": "string",
                                            "const": "proportional_then_invalidate"
                                          },
                                          "approval": {
                                            "oneOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "mode": {
                                                    "type": "string",
                                                    "const": "review"
                                                  }
                                                },
                                                "required": [
                                                  "mode"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "mode": {
                                                    "type": "string",
                                                    "const": "automatic"
                                                  },
                                                  "period_seconds": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 2678400
                                                  },
                                                  "max_per_referrer_per_period": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 9007199254740991
                                                  },
                                                  "max_per_period": {
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 9007199254740991
                                                  }
                                                },
                                                "required": [
                                                  "mode",
                                                  "period_seconds",
                                                  "max_per_referrer_per_period",
                                                  "max_per_period"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ],
                                            "type": "object"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "attribution_window_seconds",
                                          "account_eligibility",
                                          "allow_anonymous_claim",
                                          "qualifying_event",
                                          "minimum",
                                          "cooling_off_seconds",
                                          "rewards",
                                          "caps",
                                          "refund"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "campaign"
                                          },
                                          "priority": {
                                            "type": "integer",
                                            "minimum": -2147483648,
                                            "maximum": 2147483647
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "priority"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "kind": {
                                            "type": "string",
                                            "const": "reward"
                                          },
                                          "reward": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          }
                                        },
                                        "required": [
                                          "kind",
                                          "reward"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ],
                                    "type": "object"
                                  },
                                  "qualification": {
                                    "type": "object",
                                    "properties": {
                                      "sources": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "event": {
                                              "type": "string",
                                              "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                            },
                                            "conditions": {
                                              "$ref": "#/components/schemas/__schema6"
                                            },
                                            "value": {
                                              "anyOf": [
                                                {
                                                  "type": "number"
                                                },
                                                {
                                                  "type": "string",
                                                  "minLength": 1
                                                }
                                              ]
                                            },
                                            "step": {
                                              "type": "string",
                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                            },
                                            "occurrence": {
                                              "default": "lifetime",
                                              "type": "string",
                                              "enum": [
                                                "lifetime",
                                                "period"
                                              ]
                                            }
                                          },
                                          "required": [
                                            "event",
                                            "occurrence"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "audience": {
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        }
                                      },
                                      "starts_at": {
                                        "type": "string",
                                        "format": "date-time",
                                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                      },
                                      "ends_at": {
                                        "type": "string",
                                        "format": "date-time",
                                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                      },
                                      "campaign": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                      }
                                    },
                                    "required": [
                                      "sources"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "calendar": {
                                    "type": "object",
                                    "properties": {
                                      "schema": {
                                        "type": "string",
                                        "const": "orishare.calendar/v1"
                                      },
                                      "period": {
                                        "anyOf": [
                                          {
                                            "type": "string",
                                            "enum": [
                                              "none",
                                              "day",
                                              "week",
                                              "month",
                                              "year"
                                            ]
                                          },
                                          {
                                            "type": "object",
                                            "properties": {
                                              "kind": {
                                                "type": "string",
                                                "const": "season"
                                              },
                                              "starts_at": {
                                                "type": "string",
                                                "format": "date-time",
                                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                              },
                                              "ends_at": {
                                                "type": "string",
                                                "format": "date-time",
                                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                              }
                                            },
                                            "required": [
                                              "kind",
                                              "starts_at",
                                              "ends_at"
                                            ],
                                            "additionalProperties": false
                                          }
                                        ]
                                      },
                                      "run_per_period": {
                                        "type": "boolean"
                                      },
                                      "timezone_source": {
                                        "type": "string",
                                        "enum": [
                                          "environment",
                                          "customer",
                                          "fixed"
                                        ]
                                      },
                                      "timezone": {
                                        "type": "string",
                                        "minLength": 1
                                      },
                                      "day_start_offset_minutes": {
                                        "default": 0,
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 1439
                                      },
                                      "ambiguous_local_time": {
                                        "type": "string",
                                        "const": "earlier"
                                      },
                                      "nonexistent_local_time": {
                                        "type": "string",
                                        "const": "next_valid"
                                      },
                                      "event_time": {
                                        "type": "object",
                                        "properties": {
                                          "merchant": {
                                            "type": "string",
                                            "const": "occurred_at"
                                          },
                                          "client": {
                                            "anyOf": [
                                              {
                                                "type": "string",
                                                "const": "received_at"
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "offline_seconds": {
                                                    "type": "integer",
                                                    "minimum": 0,
                                                    "maximum": 9007199254740991
                                                  }
                                                },
                                                "required": [
                                                  "offline_seconds"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ]
                                          }
                                        },
                                        "required": [
                                          "merchant",
                                          "client"
                                        ],
                                        "additionalProperties": false
                                      },
                                      "grace_seconds": {
                                        "default": 0,
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "max_lateness_seconds": {
                                        "default": 0,
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "settlement_delay_seconds": {
                                        "default": 0,
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 9007199254740991
                                      },
                                      "after_finalization": {
                                        "type": "string",
                                        "const": "correction_only"
                                      }
                                    },
                                    "required": [
                                      "schema",
                                      "period",
                                      "run_per_period",
                                      "timezone_source",
                                      "day_start_offset_minutes",
                                      "ambiguous_local_time",
                                      "nonexistent_local_time",
                                      "event_time",
                                      "grace_seconds",
                                      "max_lateness_seconds",
                                      "settlement_delay_seconds",
                                      "after_finalization"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "trust": {
                                    "type": "object",
                                    "properties": {
                                      "minimum_trust": {
                                        "type": "string",
                                        "enum": [
                                          "anonymous_claim",
                                          "customer_claim",
                                          "merchant_asserted",
                                          "verified_evidence",
                                          "legacy_unknown"
                                        ]
                                      },
                                      "allowed_sources": {
                                        "minItems": 1,
                                        "type": "array",
                                        "items": {
                                          "type": "string",
                                          "enum": [
                                            "publishable_event",
                                            "secret_key_event",
                                            "verified_connector",
                                            "operator_command",
                                            "customer_command",
                                            "import",
                                            "program_transition",
                                            "schedule"
                                          ]
                                        }
                                      },
                                      "on_insufficient": {
                                        "type": "string",
                                        "enum": [
                                          "ignore",
                                          "progress_without_reward"
                                        ]
                                      },
                                      "liability_caps": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "trust": {
                                              "type": "string",
                                              "enum": [
                                                "anonymous_claim",
                                                "customer_claim",
                                                "merchant_asserted",
                                                "verified_evidence",
                                                "legacy_unknown"
                                              ]
                                            },
                                            "currency": {
                                              "type": "string",
                                              "pattern": "^[A-Za-z0-9_-]+$"
                                            },
                                            "scope": {
                                              "type": "string",
                                              "enum": [
                                                "customer",
                                                "environment"
                                              ]
                                            },
                                            "window": {
                                              "type": "string",
                                              "enum": [
                                                "day",
                                                "month",
                                                "lifetime"
                                              ]
                                            },
                                            "maximum_minor": {
                                              "type": "integer",
                                              "minimum": 0,
                                              "maximum": 9007199254740991
                                            }
                                          },
                                          "required": [
                                            "trust",
                                            "currency",
                                            "scope",
                                            "window",
                                            "maximum_minor"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "recognition_caps": {
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "trust": {
                                              "type": "string",
                                              "enum": [
                                                "anonymous_claim",
                                                "customer_claim",
                                                "merchant_asserted",
                                                "verified_evidence",
                                                "legacy_unknown"
                                              ]
                                            },
                                            "per": {
                                              "type": "string",
                                              "enum": [
                                                "period",
                                                "day"
                                              ]
                                            },
                                            "contributions": {
                                              "type": "integer",
                                              "exclusiveMinimum": 0,
                                              "maximum": 9007199254740991
                                            },
                                            "value": {
                                              "type": "integer",
                                              "exclusiveMinimum": 0,
                                              "maximum": 9007199254740991
                                            }
                                          },
                                          "required": [
                                            "trust",
                                            "per"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "allow_legacy_unknown": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "minimum_trust",
                                      "allowed_sources",
                                      "on_insufficient",
                                      "liability_caps",
                                      "recognition_caps",
                                      "allow_legacy_unknown"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "correction": {
                                    "type": "object",
                                    "properties": {
                                      "qualification": {
                                        "default": "reverse",
                                        "type": "string",
                                        "enum": [
                                          "reverse",
                                          "keep"
                                        ]
                                      },
                                      "spendable": {
                                        "type": "string",
                                        "const": "reverse"
                                      },
                                      "xp": {
                                        "default": "reverse",
                                        "type": "string",
                                        "enum": [
                                          "reverse",
                                          "keep"
                                        ]
                                      },
                                      "recognition": {
                                        "default": "keep",
                                        "type": "string",
                                        "enum": [
                                          "keep",
                                          "revoke_on_fraud"
                                        ]
                                      },
                                      "after_finalization": {
                                        "default": "correcting_revision",
                                        "type": "string",
                                        "const": "correcting_revision"
                                      },
                                      "allowance_on_refund": {
                                        "default": "consumed",
                                        "type": "string",
                                        "enum": [
                                          "consumed",
                                          "release_on_verified_void"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "qualification",
                                      "spendable",
                                      "xp",
                                      "recognition",
                                      "after_finalization",
                                      "allowance_on_refund"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "reward": {
                                    "type": "object",
                                    "properties": {
                                      "on": {
                                        "type": "object",
                                        "propertyNames": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]*(?::[a-z0-9_]+)?$"
                                        },
                                        "additionalProperties": {
                                          "type": "array",
                                          "items": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "points.award"
                                                  },
                                                  "currency": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "amount": {
                                                    "anyOf": [
                                                      {
                                                        "type": "number"
                                                      },
                                                      {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    ]
                                                  },
                                                  "reason": {
                                                    "type": "string",
                                                    "maxLength": 200
                                                  },
                                                  "confirm_after": {
                                                    "type": "string",
                                                    "pattern": "^\\d+[smhdw]$"
                                                  },
                                                  "expires_after": {
                                                    "type": "string",
                                                    "pattern": "^\\d+[smhdw]$"
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "currency",
                                                  "amount",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "points.deduct"
                                                  },
                                                  "currency": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "amount": {
                                                    "anyOf": [
                                                      {
                                                        "type": "number"
                                                      },
                                                      {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    ]
                                                  },
                                                  "reason": {
                                                    "type": "string",
                                                    "maxLength": 200
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "currency",
                                                  "amount",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "points.reverse"
                                                  },
                                                  "currency": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "match": {
                                                    "type": "object",
                                                    "properties": {
                                                      "event": {
                                                        "type": "string",
                                                        "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                      },
                                                      "on": {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    },
                                                    "required": [
                                                      "event",
                                                      "on"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  "fraction": {
                                                    "anyOf": [
                                                      {
                                                        "type": "number"
                                                      },
                                                      {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    ]
                                                  },
                                                  "amount": {
                                                    "anyOf": [
                                                      {
                                                        "type": "number"
                                                      },
                                                      {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    ]
                                                  },
                                                  "reason": {
                                                    "type": "string",
                                                    "maxLength": 200
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "currency",
                                                  "match",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "reward.issue"
                                                  },
                                                  "reward": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "reward",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "tier.evaluate"
                                                  },
                                                  "program": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "program",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "attribute.set"
                                                  },
                                                  "attribute": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "value": {
                                                    "type": [
                                                      "string",
                                                      "number",
                                                      "boolean",
                                                      "null"
                                                    ]
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "attribute",
                                                  "value",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "webhook.emit"
                                                  },
                                                  "event": {
                                                    "type": "string",
                                                    "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                                  },
                                                  "payload": {
                                                    "type": "object",
                                                    "propertyNames": {
                                                      "type": "string"
                                                    },
                                                    "additionalProperties": {
                                                      "anyOf": [
                                                        {
                                                          "type": [
                                                            "string",
                                                            "number",
                                                            "boolean"
                                                          ]
                                                        },
                                                        {
                                                          "type": "null"
                                                        },
                                                        {
                                                          "type": "array",
                                                          "items": {
                                                            "type": [
                                                              "string",
                                                              "number",
                                                              "boolean"
                                                            ]
                                                          }
                                                        }
                                                      ]
                                                    }
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "event",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "badge.contribute"
                                                  },
                                                  "badge": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "value": {
                                                    "anyOf": [
                                                      {
                                                        "type": "number"
                                                      },
                                                      {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    ]
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "badge",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "badge.grant"
                                                  },
                                                  "badge": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "rank": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "occurrence": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "badge",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "streak.contribute"
                                                  },
                                                  "streak": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "value": {
                                                    "anyOf": [
                                                      {
                                                        "type": "number"
                                                      },
                                                      {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    ]
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "streak",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "streak.freeze_grant"
                                                  },
                                                  "streak": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "quantity": {
                                                    "type": "integer",
                                                    "exclusiveMinimum": 0,
                                                    "maximum": 9007199254740991
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "streak",
                                                  "quantity",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "quest.contribute"
                                                  },
                                                  "quest": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "step": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "value": {
                                                    "anyOf": [
                                                      {
                                                        "type": "number"
                                                      },
                                                      {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    ]
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "quest",
                                                  "step",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "quest.enroll"
                                                  },
                                                  "quest": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "quest",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "leaderboard.contribute"
                                                  },
                                                  "leaderboard": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "value": {
                                                    "anyOf": [
                                                      {
                                                        "type": "number"
                                                      },
                                                      {
                                                        "type": "string",
                                                        "minLength": 1
                                                      }
                                                    ]
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "leaderboard",
                                                  "value",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "program.reverse_contribution"
                                                  },
                                                  "program": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "source_fact": {
                                                    "anyOf": [
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "fact_id": {
                                                            "type": "string",
                                                            "pattern": "^[A-Za-z0-9_-]+$"
                                                          }
                                                        },
                                                        "required": [
                                                          "fact_id"
                                                        ],
                                                        "additionalProperties": false
                                                      },
                                                      {
                                                        "type": "object",
                                                        "properties": {
                                                          "object_type": {
                                                            "type": "string",
                                                            "pattern": "^[A-Za-z0-9_-]+$"
                                                          },
                                                          "key": {
                                                            "minItems": 1,
                                                            "type": "array",
                                                            "items": {
                                                              "type": "string",
                                                              "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_-]*(?:\\.[A-Za-z_][A-Za-z0-9_-]*)*$"
                                                            }
                                                          }
                                                        },
                                                        "required": [
                                                          "object_type",
                                                          "key"
                                                        ],
                                                        "additionalProperties": false
                                                      }
                                                    ]
                                                  },
                                                  "fraction": {
                                                    "type": "string",
                                                    "pattern": "^(?:0(?:\\.\\d+)?|1(?:\\.0+)?)$"
                                                  },
                                                  "amount": {
                                                    "type": "number",
                                                    "exclusiveMinimum": 0
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "program",
                                                  "source_fact",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "coupon.issue"
                                                  },
                                                  "offer": {
                                                    "type": "object",
                                                    "properties": {
                                                      "key": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      },
                                                      "version": {
                                                        "type": "integer",
                                                        "minimum": 1,
                                                        "maximum": 9007199254740991
                                                      },
                                                      "digest": {
                                                        "type": "string",
                                                        "pattern": "^[a-f0-9]{64}$"
                                                      }
                                                    },
                                                    "required": [
                                                      "key",
                                                      "version",
                                                      "digest"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "offer",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "discount.quote"
                                                  },
                                                  "offer": {
                                                    "type": "object",
                                                    "properties": {
                                                      "key": {
                                                        "type": "string",
                                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                      },
                                                      "version": {
                                                        "type": "integer",
                                                        "minimum": 1,
                                                        "maximum": 9007199254740991
                                                      },
                                                      "digest": {
                                                        "type": "string",
                                                        "pattern": "^[a-f0-9]{64}$"
                                                      }
                                                    },
                                                    "required": [
                                                      "key",
                                                      "version",
                                                      "digest"
                                                    ],
                                                    "additionalProperties": false
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "offer",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "type": {
                                                    "type": "string",
                                                    "const": "item.grant"
                                                  },
                                                  "item": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,63}$"
                                                  },
                                                  "quantity": {
                                                    "default": 1,
                                                    "type": "integer",
                                                    "minimum": 1,
                                                    "maximum": 1000
                                                  },
                                                  "effect_key": {
                                                    "type": "string",
                                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                                  },
                                                  "liability": {
                                                    "type": "object",
                                                    "properties": {
                                                      "currency": {
                                                        "type": "string",
                                                        "pattern": "^[A-Za-z0-9_-]+$"
                                                      },
                                                      "amount_minor": {
                                                        "type": "integer",
                                                        "exclusiveMinimum": 0,
                                                        "maximum": 9007199254740991
                                                      }
                                                    },
                                                    "required": [
                                                      "currency",
                                                      "amount_minor"
                                                    ],
                                                    "additionalProperties": false
                                                  }
                                                },
                                                "required": [
                                                  "type",
                                                  "item",
                                                  "quantity",
                                                  "effect_key"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ]
                                          }
                                        }
                                      }
                                    },
                                    "required": [
                                      "on"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "display": {
                                    "type": "object",
                                    "properties": {
                                      "title": {
                                        "type": "string"
                                      },
                                      "description": {
                                        "type": "string"
                                      },
                                      "image_url": {
                                        "type": "string",
                                        "format": "uri"
                                      },
                                      "icon": {
                                        "type": "string"
                                      },
                                      "color": {
                                        "type": "string"
                                      },
                                      "sort_order": {
                                        "default": 0,
                                        "type": "integer",
                                        "minimum": -9007199254740991,
                                        "maximum": 9007199254740991
                                      },
                                      "hidden": {
                                        "default": false,
                                        "type": "boolean"
                                      },
                                      "locales": {
                                        "default": {},
                                        "type": "object",
                                        "propertyNames": {
                                          "type": "string",
                                          "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
                                        },
                                        "additionalProperties": {
                                          "type": "object",
                                          "properties": {
                                            "title": {
                                              "type": "string"
                                            },
                                            "description": {
                                              "type": "string"
                                            }
                                          },
                                          "additionalProperties": false
                                        }
                                      }
                                    },
                                    "required": [
                                      "sort_order",
                                      "hidden",
                                      "locales"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "enrollment": {
                                    "type": "object",
                                    "properties": {
                                      "mode": {
                                        "default": "automatic",
                                        "type": "string",
                                        "enum": [
                                          "automatic",
                                          "explicit"
                                        ]
                                      }
                                    },
                                    "required": [
                                      "mode"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "season": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "season"
                                      },
                                      "key": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                      },
                                      "version": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 9007199254740991
                                      },
                                      "digest": {
                                        "type": "string",
                                        "pattern": "^[a-f0-9]{64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "key",
                                      "version",
                                      "digest"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "dependencies": {
                                    "default": [],
                                    "maxItems": 64,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "kind": {
                                          "type": "string",
                                          "enum": [
                                            "program",
                                            "currency",
                                            "season",
                                            "reward",
                                            "counter",
                                            "segment",
                                            "campaign",
                                            "offer",
                                            "asset"
                                          ]
                                        },
                                        "key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "version": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 9007199254740991
                                        },
                                        "digest": {
                                          "type": "string",
                                          "pattern": "^[a-f0-9]{64}$"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "key",
                                        "version",
                                        "digest"
                                      ],
                                      "additionalProperties": false
                                    }
                                  }
                                },
                                "required": [
                                  "schema",
                                  "kind",
                                  "semantics",
                                  "definition",
                                  "qualification",
                                  "calendar",
                                  "trust",
                                  "correction",
                                  "reward",
                                  "display",
                                  "enrollment",
                                  "dependencies"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          },
                          "definition_hash": {
                            "type": "string"
                          },
                          "created_at": {
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "id",
                          "program_id",
                          "number",
                          "definition",
                          "definition_hash",
                          "created_at"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "has_more": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "data",
                    "next_cursor",
                    "has_more"
                  ],
                  "additionalProperties": false
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "string"
                },
                "description": "1 on concurrent_update; retry the same operation key."
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "421": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "422": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "post": {
        "summary": "Publish and activate an immutable program version",
        "tags": [
          "programs"
        ],
        "operationId": "publish_program_version",
        "x-orishare": {
          "concurrency": {
            "kind": "version",
            "ifMatch": "required",
            "responseEtag": true
          },
          "retry": "atomic_replay",
          "errors": [
            "validation_failed",
            "internal_error",
            "authentication_required",
            "invalid_credentials",
            "credentials_revoked",
            "forbidden",
            "insufficient_scope",
            "audit_reason_required",
            "environment_required",
            "environment_served_elsewhere",
            "confirmation_required",
            "idempotency_key_required",
            "idempotency_key_reused",
            "idempotency_in_progress",
            "test_player_limit",
            "test_environment_resetting",
            "stale_write",
            "resource_not_found",
            "invalid_cursor",
            "rule_invalid",
            "invalid_state",
            "already_exists",
            "concurrent_update",
            "resource_in_use"
          ],
          "resource": "program_versions",
          "action": "create",
          "examples": {
            "request": {
              "definition": {
                "schema": "orishare.program/v1",
                "kind": "quest",
                "semantics": "native_v2",
                "definition": {
                  "kind": "quest",
                  "steps": [
                    {
                      "key": "buy",
                      "aggregation": "count",
                      "target": 2
                    }
                  ],
                  "repeatable": false
                },
                "qualification": {
                  "sources": [
                    {
                      "event": "purchase",
                      "step": "buy",
                      "occurrence": "lifetime"
                    }
                  ]
                },
                "calendar": {
                  "schema": "orishare.calendar/v1",
                  "period": "none",
                  "run_per_period": false,
                  "timezone_source": "environment",
                  "day_start_offset_minutes": 0,
                  "ambiguous_local_time": "earlier",
                  "nonexistent_local_time": "next_valid",
                  "event_time": {
                    "merchant": "occurred_at",
                    "client": "received_at"
                  },
                  "grace_seconds": 0,
                  "max_lateness_seconds": 0,
                  "settlement_delay_seconds": 0,
                  "after_finalization": "correction_only"
                },
                "trust": {
                  "minimum_trust": "merchant_asserted",
                  "allowed_sources": [
                    "secret_key_event",
                    "operator_command"
                  ],
                  "on_insufficient": "ignore",
                  "liability_caps": [],
                  "recognition_caps": [],
                  "allow_legacy_unknown": false
                },
                "correction": {
                  "qualification": "reverse",
                  "spendable": "reverse",
                  "xp": "reverse",
                  "recognition": "keep",
                  "after_finalization": "correcting_revision",
                  "allowance_on_refund": "consumed"
                },
                "reward": {
                  "on": {
                    "completion": [
                      {
                        "type": "points.award",
                        "currency": "points",
                        "amount": 5,
                        "effect_key": "completion_points"
                      }
                    ]
                  }
                },
                "display": {
                  "sort_order": 0,
                  "hidden": false,
                  "locales": {}
                },
                "enrollment": {
                  "mode": "automatic"
                }
              }
            },
            "success": {
              "status": 201,
              "body": {
                "program": {
                  "id": "prog_example",
                  "environment_id": "env_example",
                  "kind": "quest",
                  "key": "welcome",
                  "name": "Welcome",
                  "status": "active",
                  "active_version_id": "pv_example",
                  "authority": "contract",
                  "legacy_table": null,
                  "version": 2,
                  "created_at": "2026-09-20T00:00:00.000Z",
                  "updated_at": "2026-09-20T00:00:00.000Z",
                  "archived_at": null
                },
                "version": {
                  "id": "pv_example",
                  "program_id": "prog_example",
                  "number": 1,
                  "definition": {
                    "schema": "orishare.program/v1",
                    "kind": "quest",
                    "semantics": "native_v2",
                    "definition": {
                      "kind": "quest",
                      "steps": [
                        {
                          "key": "buy",
                          "aggregation": "count",
                          "target": 2
                        }
                      ],
                      "repeatable": false
                    },
                    "qualification": {
                      "sources": [
                        {
                          "event": "purchase",
                          "step": "buy",
                          "occurrence": "lifetime"
                        }
                      ]
                    },
                    "calendar": {
                      "schema": "orishare.calendar/v1",
                      "period": "none",
                      "run_per_period": false,
                      "timezone_source": "environment",
                      "day_start_offset_minutes": 0,
                      "ambiguous_local_time": "earlier",
                      "nonexistent_local_time": "next_valid",
                      "event_time": {
                        "merchant": "occurred_at",
                        "client": "received_at"
                      },
                      "grace_seconds": 0,
                      "max_lateness_seconds": 0,
                      "settlement_delay_seconds": 0,
                      "after_finalization": "correction_only"
                    },
                    "trust": {
                      "minimum_trust": "merchant_asserted",
                      "allowed_sources": [
                        "secret_key_event",
                        "operator_command"
                      ],
                      "on_insufficient": "ignore",
                      "liability_caps": [],
                      "recognition_caps": [],
                      "allow_legacy_unknown": false
                    },
                    "correction": {
                      "qualification": "reverse",
                      "spendable": "reverse",
                      "xp": "reverse",
                      "recognition": "keep",
                      "after_finalization": "correcting_revision",
                      "allowance_on_refund": "consumed"
                    },
                    "reward": {
                      "on": {
                        "completion": [
                          {
                            "type": "points.award",
                            "currency": "points",
                            "amount": 5,
                            "effect_key": "completion_points"
                          }
                        ]
                      }
                    },
                    "display": {
                      "sort_order": 0,
                      "hidden": false,
                      "locales": {}
                    },
                    "enrollment": {
                      "mode": "automatic"
                    }
                  },
                  "definition_hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "created_at": "2026-09-20T00:00:00.000Z"
                }
              }
            },
            "sameKeyReplay": {
              "status": 201,
              "body": {
                "program": {
                  "id": "prog_example",
                  "environment_id": "env_example",
                  "kind": "quest",
                  "key": "welcome",
                  "name": "Welcome",
                  "status": "active",
                  "active_version_id": "pv_example",
                  "authority": "contract",
                  "legacy_table": null,
                  "version": 2,
                  "created_at": "2026-09-20T00:00:00.000Z",
                  "updated_at": "2026-09-20T00:00:00.000Z",
                  "archived_at": null
                },
                "version": {
                  "id": "pv_example",
                  "program_id": "prog_example",
                  "number": 1,
                  "definition": {
                    "schema": "orishare.program/v1",
                    "kind": "quest",
                    "semantics": "native_v2",
                    "definition": {
                      "kind": "quest",
                      "steps": [
                        {
                          "key": "buy",
                          "aggregation": "count",
                          "target": 2
                        }
                      ],
                      "repeatable": false
                    },
                    "qualification": {
                      "sources": [
                        {
                          "event": "purchase",
                          "step": "buy",
                          "occurrence": "lifetime"
                        }
                      ]
                    },
                    "calendar": {
                      "schema": "orishare.calendar/v1",
                      "period": "none",
                      "run_per_period": false,
                      "timezone_source": "environment",
                      "day_start_offset_minutes": 0,
                      "ambiguous_local_time": "earlier",
                      "nonexistent_local_time": "next_valid",
                      "event_time": {
                        "merchant": "occurred_at",
                        "client": "received_at"
                      },
                      "grace_seconds": 0,
                      "max_lateness_seconds": 0,
                      "settlement_delay_seconds": 0,
                      "after_finalization": "correction_only"
                    },
                    "trust": {
                      "minimum_trust": "merchant_asserted",
                      "allowed_sources": [
                        "secret_key_event",
                        "operator_command"
                      ],
                      "on_insufficient": "ignore",
                      "liability_caps": [],
                      "recognition_caps": [],
                      "allow_legacy_unknown": false
                    },
                    "correction": {
                      "qualification": "reverse",
                      "spendable": "reverse",
                      "xp": "reverse",
                      "recognition": "keep",
                      "after_finalization": "correcting_revision",
                      "allowance_on_refund": "consumed"
                    },
                    "reward": {
                      "on": {
                        "completion": [
                          {
                            "type": "points.award",
                            "currency": "points",
                            "amount": 5,
                            "effect_key": "completion_points"
                          }
                        ]
                      }
                    },
                    "display": {
                      "sort_order": 0,
                      "hidden": false,
                      "locales": {}
                    },
                    "enrollment": {
                      "mode": "automatic"
                    }
                  },
                  "definition_hash": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
                  "created_at": "2026-09-20T00:00:00.000Z"
                }
              },
              "headers": {
                "Idempotent-Replayed": "true"
              }
            },
            "differentBody": {
              "status": 422,
              "body": {
                "error": {
                  "type": "idempotency",
                  "code": "idempotency_key_reused",
                  "message": "idempotency key reused",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#idempotency_key_reused",
                  "request_id": "req_example"
                }
              }
            },
            "conflict": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "stale_write",
                  "message": "stale write",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#stale_write",
                  "request_id": "req_example"
                }
              }
            },
            "permissionFailure": {
              "status": 403,
              "body": {
                "error": {
                  "type": "permission",
                  "code": "insufficient_scope",
                  "message": "insufficient scope",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#insufficient_scope",
                  "request_id": "req_example"
                }
              }
            },
            "retry": {
              "status": 409,
              "body": {
                "error": {
                  "type": "conflict",
                  "code": "concurrent_update",
                  "message": "concurrent update",
                  "param": null,
                  "doc_url": "https://docs.orishare.com/errors#concurrent_update",
                  "request_id": "req_example"
                }
              },
              "headers": {
                "Retry-After": "1"
              }
            }
          },
          "tools": {
            "exposure": "mutation",
            "destructive": false,
            "effectFamilies": [
              "program_catalog"
            ]
          },
          "stability": "beta"
        },
        "x-orishare-authorization": [
          {
            "principals": [
              "secret_key"
            ],
            "environment": "credential_bound",
            "scopes": [
              "rules:write",
              "rules:publish"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "runtimeClass": "sandbox",
            "scopes": [
              "rules:write",
              "rules:publish_sandbox"
            ]
          },
          {
            "principals": [
              "pat",
              "session"
            ],
            "environment": "selected",
            "runtimeClass": "production",
            "scopes": [
              "rules:write",
              "rules:publish"
            ]
          },
          {
            "principals": [
              "staff"
            ],
            "environment": "selected",
            "scopes": []
          }
        ],
        "security": [
          {
            "secretKey": []
          },
          {
            "personalAccessToken": []
          },
          {
            "session": []
          },
          {
            "staff": []
          }
        ],
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "required": true
          },
          {
            "in": "header",
            "name": "Idempotency-Key",
            "schema": {
              "type": "string",
              "minLength": 1,
              "maxLength": 255,
              "description": "Required. Official clients generate a UUID when omitted by the caller."
            },
            "required": true,
            "description": "Required. Official clients generate a UUID when omitted by the caller."
          },
          {
            "in": "header",
            "name": "X-Orishare-Environment",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for selected-environment authorization branches; API keys use their bound environment."
            }
          },
          {
            "in": "header",
            "name": "X-Orishare-Audit-Reason",
            "schema": {
              "type": "string",
              "minLength": 1,
              "description": "Required for staff authorization. Records the reason for staff access."
            }
          },
          {
            "in": "header",
            "name": "If-Match",
            "schema": {
              "type": "string",
              "description": "Required revision, checked in the owning transaction."
            },
            "required": true,
            "description": "Required revision, checked in the owning transaction."
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "example": {
                "definition": {
                  "schema": "orishare.program/v1",
                  "kind": "quest",
                  "semantics": "native_v2",
                  "definition": {
                    "kind": "quest",
                    "steps": [
                      {
                        "key": "buy",
                        "aggregation": "count",
                        "target": 2
                      }
                    ],
                    "repeatable": false
                  },
                  "qualification": {
                    "sources": [
                      {
                        "event": "purchase",
                        "step": "buy",
                        "occurrence": "lifetime"
                      }
                    ]
                  },
                  "calendar": {
                    "schema": "orishare.calendar/v1",
                    "period": "none",
                    "run_per_period": false,
                    "timezone_source": "environment",
                    "day_start_offset_minutes": 0,
                    "ambiguous_local_time": "earlier",
                    "nonexistent_local_time": "next_valid",
                    "event_time": {
                      "merchant": "occurred_at",
                      "client": "received_at"
                    },
                    "grace_seconds": 0,
                    "max_lateness_seconds": 0,
                    "settlement_delay_seconds": 0,
                    "after_finalization": "correction_only"
                  },
                  "trust": {
                    "minimum_trust": "merchant_asserted",
                    "allowed_sources": [
                      "secret_key_event",
                      "operator_command"
                    ],
                    "on_insufficient": "ignore",
                    "liability_caps": [],
                    "recognition_caps": [],
                    "allow_legacy_unknown": false
                  },
                  "correction": {
                    "qualification": "reverse",
                    "spendable": "reverse",
                    "xp": "reverse",
                    "recognition": "keep",
                    "after_finalization": "correcting_revision",
                    "allowance_on_refund": "consumed"
                  },
                  "reward": {
                    "on": {
                      "completion": [
                        {
                          "type": "points.award",
                          "currency": "points",
                          "amount": 5,
                          "effect_key": "completion_points"
                        }
                      ]
                    }
                  },
                  "display": {
                    "sort_order": 0,
                    "hidden": false,
                    "locales": {}
                  },
                  "enrollment": {
                    "mode": "automatic"
                  }
                }
              },
              "schema": {
                "type": "object",
                "properties": {
                  "definition": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "schema": {
                            "type": "string",
                            "const": "orishare.program/v1"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "tier",
                              "quest",
                              "campaign",
                              "reward",
                              "streak",
                              "badge",
                              "leaderboard",
                              "referral"
                            ]
                          },
                          "semantics": {
                            "type": "string",
                            "enum": [
                              "native_v2",
                              "compat_v1"
                            ]
                          },
                          "definition": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "tier"
                                  },
                                  "legacy": {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {
                                      "$ref": "#/components/schemas/__schema2"
                                    }
                                  },
                                  "currency": {
                                    "type": "string",
                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                  },
                                  "basis": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "lifetime_earned"
                                          }
                                        },
                                        "required": [
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "balance"
                                          }
                                        },
                                        "required": [
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "earned_rolling_days"
                                          },
                                          "days": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "days"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "earned_calendar_year"
                                          }
                                        },
                                        "required": [
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "earned_anniversary_year"
                                          }
                                        },
                                        "required": [
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ],
                                    "type": "object"
                                  },
                                  "downgrade_check": {
                                    "type": "string",
                                    "enum": [
                                      "daily",
                                      "monthly",
                                      "never"
                                    ]
                                  },
                                  "levels": {
                                    "minItems": 1,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "threshold": {
                                          "type": "integer",
                                          "minimum": 0,
                                          "maximum": 9007199254740991
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "threshold"
                                      ],
                                      "additionalProperties": false
                                    }
                                  }
                                },
                                "required": [
                                  "kind",
                                  "currency",
                                  "basis",
                                  "downgrade_check",
                                  "levels"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "quest"
                                  },
                                  "legacy": {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {
                                      "$ref": "#/components/schemas/__schema2"
                                    }
                                  },
                                  "steps": {
                                    "minItems": 1,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "aggregation": {
                                          "type": "string",
                                          "enum": [
                                            "count",
                                            "sum"
                                          ]
                                        },
                                        "target": {
                                          "type": "integer",
                                          "exclusiveMinimum": 0,
                                          "maximum": 9007199254740991
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "aggregation",
                                        "target"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "repeatable": {
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "steps",
                                  "repeatable"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "campaign"
                                  },
                                  "legacy": {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {
                                      "$ref": "#/components/schemas/__schema2"
                                    }
                                  },
                                  "priority": {
                                    "default": 0,
                                    "type": "integer",
                                    "minimum": -9007199254740991,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "reward"
                                  },
                                  "legacy": {
                                    "type": "object",
                                    "propertyNames": {
                                      "type": "string"
                                    },
                                    "additionalProperties": {
                                      "$ref": "#/components/schemas/__schema2"
                                    }
                                  },
                                  "reward": {
                                    "type": "string",
                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "reward"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "streak"
                                  },
                                  "target": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  },
                                  "freezes": {
                                    "default": 0,
                                    "type": "integer",
                                    "minimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "target"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "badge"
                                  },
                                  "repeatable": {
                                    "default": false,
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "kind"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "leaderboard"
                                  },
                                  "aggregation": {
                                    "type": "string",
                                    "enum": [
                                      "sum",
                                      "max",
                                      "count"
                                    ]
                                  },
                                  "order": {
                                    "type": "string",
                                    "enum": [
                                      "ascending",
                                      "descending"
                                    ]
                                  }
                                },
                                "required": [
                                  "kind",
                                  "aggregation",
                                  "order"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "referral"
                                  },
                                  "target": {
                                    "type": "integer",
                                    "exclusiveMinimum": 0,
                                    "maximum": 9007199254740991
                                  }
                                },
                                "required": [
                                  "kind",
                                  "target"
                                ],
                                "additionalProperties": false
                              }
                            ],
                            "type": "object"
                          },
                          "qualification": {
                            "type": "object",
                            "properties": {
                              "sources": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "event": {
                                      "type": "string",
                                      "minLength": 1
                                    },
                                    "conditions": {
                                      "$ref": "#/components/schemas/__schema3"
                                    },
                                    "value": {
                                      "anyOf": [
                                        {
                                          "type": "number"
                                        },
                                        {
                                          "type": "string",
                                          "minLength": 1
                                        }
                                      ]
                                    },
                                    "step": {
                                      "type": "string",
                                      "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                    },
                                    "occurrence": {
                                      "default": "lifetime",
                                      "type": "string",
                                      "enum": [
                                        "lifetime",
                                        "period"
                                      ]
                                    }
                                  },
                                  "required": [
                                    "event"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "audience": {
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                }
                              },
                              "starts_at": {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                              },
                              "ends_at": {
                                "type": "string",
                                "format": "date-time",
                                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                              },
                              "campaign": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,62}$"
                              }
                            },
                            "required": [
                              "sources"
                            ],
                            "additionalProperties": false
                          },
                          "calendar": {
                            "type": "object",
                            "properties": {
                              "schema": {
                                "type": "string",
                                "const": "orishare.calendar/v1"
                              },
                              "period": {
                                "anyOf": [
                                  {
                                    "type": "string",
                                    "enum": [
                                      "none",
                                      "day",
                                      "week",
                                      "month",
                                      "year"
                                    ]
                                  },
                                  {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "season"
                                      },
                                      "starts_at": {
                                        "type": "string",
                                        "format": "date-time",
                                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                      },
                                      "ends_at": {
                                        "type": "string",
                                        "format": "date-time",
                                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "starts_at",
                                      "ends_at"
                                    ],
                                    "additionalProperties": false
                                  }
                                ]
                              },
                              "run_per_period": {
                                "type": "boolean"
                              },
                              "timezone_source": {
                                "type": "string",
                                "enum": [
                                  "environment",
                                  "customer",
                                  "fixed"
                                ]
                              },
                              "timezone": {
                                "type": "string",
                                "minLength": 1
                              },
                              "day_start_offset_minutes": {
                                "default": 0,
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 1439
                              },
                              "ambiguous_local_time": {
                                "type": "string",
                                "const": "earlier"
                              },
                              "nonexistent_local_time": {
                                "type": "string",
                                "const": "next_valid"
                              },
                              "event_time": {
                                "type": "object",
                                "properties": {
                                  "merchant": {
                                    "type": "string",
                                    "const": "occurred_at"
                                  },
                                  "client": {
                                    "anyOf": [
                                      {
                                        "type": "string",
                                        "const": "received_at"
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "offline_seconds": {
                                            "type": "integer",
                                            "minimum": 0,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": [
                                          "offline_seconds"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "merchant",
                                  "client"
                                ],
                                "additionalProperties": false
                              },
                              "grace_seconds": {
                                "default": 0,
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "max_lateness_seconds": {
                                "default": 0,
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "settlement_delay_seconds": {
                                "default": 0,
                                "type": "integer",
                                "minimum": 0,
                                "maximum": 9007199254740991
                              },
                              "after_finalization": {
                                "type": "string",
                                "const": "correction_only"
                              }
                            },
                            "required": [
                              "schema",
                              "period",
                              "run_per_period",
                              "timezone_source",
                              "ambiguous_local_time",
                              "nonexistent_local_time",
                              "event_time",
                              "after_finalization"
                            ],
                            "additionalProperties": false
                          },
                          "trust": {
                            "type": "object",
                            "properties": {
                              "minimum_trust": {
                                "type": "string",
                                "enum": [
                                  "anonymous_claim",
                                  "customer_claim",
                                  "merchant_asserted",
                                  "verified_evidence",
                                  "legacy_unknown"
                                ]
                              },
                              "allowed_sources": {
                                "minItems": 1,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "enum": [
                                    "publishable_event",
                                    "secret_key_event",
                                    "verified_connector",
                                    "operator_command",
                                    "customer_command",
                                    "import",
                                    "program_transition",
                                    "schedule"
                                  ]
                                }
                              },
                              "on_insufficient": {
                                "type": "string",
                                "enum": [
                                  "ignore",
                                  "progress_without_reward"
                                ]
                              },
                              "liability_caps": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "trust": {
                                      "type": "string",
                                      "enum": [
                                        "anonymous_claim",
                                        "customer_claim",
                                        "merchant_asserted",
                                        "verified_evidence",
                                        "legacy_unknown"
                                      ]
                                    },
                                    "currency": {
                                      "type": "string",
                                      "pattern": "^[A-Za-z0-9_-]+$"
                                    },
                                    "scope": {
                                      "type": "string",
                                      "enum": [
                                        "customer",
                                        "environment"
                                      ]
                                    },
                                    "window": {
                                      "type": "string",
                                      "enum": [
                                        "day",
                                        "month",
                                        "lifetime"
                                      ]
                                    },
                                    "maximum_minor": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "trust",
                                    "currency",
                                    "scope",
                                    "window",
                                    "maximum_minor"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "recognition_caps": {
                                "type": "array",
                                "items": {
                                  "type": "object",
                                  "properties": {
                                    "trust": {
                                      "type": "string",
                                      "enum": [
                                        "anonymous_claim",
                                        "customer_claim",
                                        "merchant_asserted",
                                        "verified_evidence",
                                        "legacy_unknown"
                                      ]
                                    },
                                    "per": {
                                      "type": "string",
                                      "enum": [
                                        "period",
                                        "day"
                                      ]
                                    },
                                    "contributions": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    },
                                    "value": {
                                      "type": "integer",
                                      "exclusiveMinimum": 0,
                                      "maximum": 9007199254740991
                                    }
                                  },
                                  "required": [
                                    "trust",
                                    "per"
                                  ],
                                  "additionalProperties": false
                                }
                              },
                              "allow_legacy_unknown": {
                                "type": "boolean",
                                "const": false
                              }
                            },
                            "required": [
                              "minimum_trust",
                              "allowed_sources",
                              "on_insufficient",
                              "liability_caps",
                              "recognition_caps",
                              "allow_legacy_unknown"
                            ],
                            "additionalProperties": false
                          },
                          "correction": {
                            "type": "object",
                            "properties": {
                              "qualification": {
                                "default": "reverse",
                                "type": "string",
                                "enum": [
                                  "reverse",
                                  "keep"
                                ]
                              },
                              "spendable": {
                                "type": "string",
                                "const": "reverse"
                              },
                              "xp": {
                                "default": "reverse",
                                "type": "string",
                                "enum": [
                                  "reverse",
                                  "keep"
                                ]
                              },
                              "recognition": {
                                "default": "keep",
                                "type": "string",
                                "enum": [
                                  "keep",
                                  "revoke_on_fraud"
                                ]
                              },
                              "after_finalization": {
                                "default": "correcting_revision",
                                "type": "string",
                                "const": "correcting_revision"
                              },
                              "allowance_on_refund": {
                                "default": "consumed",
                                "type": "string",
                                "enum": [
                                  "consumed",
                                  "release_on_verified_void"
                                ]
                              }
                            },
                            "required": [
                              "spendable"
                            ],
                            "additionalProperties": false
                          },
                          "reward": {
                            "type": "object",
                            "properties": {
                              "on": {
                                "type": "object",
                                "propertyNames": {
                                  "type": "string",
                                  "pattern": "^[a-z][a-z0-9_]*(?::[a-z0-9_]+)?$"
                                },
                                "additionalProperties": {
                                  "type": "array",
                                  "items": {
                                    "anyOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "points.award"
                                          },
                                          "currency": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9_-]+$"
                                          },
                                          "amount": {
                                            "anyOf": [
                                              {
                                                "type": "number"
                                              },
                                              {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            ]
                                          },
                                          "reason": {
                                            "type": "string",
                                            "maxLength": 200
                                          },
                                          "confirm_after": {
                                            "type": "string",
                                            "pattern": "^\\d+[smhdw]$"
                                          },
                                          "expires_after": {
                                            "type": "string",
                                            "pattern": "^\\d+[smhdw]$"
                                          },
                                          "effect_key": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "liability": {
                                            "type": "object",
                                            "properties": {
                                              "currency": {
                                                "type": "string",
                                                "pattern": "^[A-Za-z0-9_-]+$"
                                              },
                                              "amount_minor": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "currency",
                                              "amount_minor"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "currency",
                                          "amount",
                                          "effect_key"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "points.deduct"
                                          },
                                          "currency": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9_-]+$"
                                          },
                                          "amount": {
                                            "anyOf": [
                                              {
                                                "type": "number"
                                              },
                                              {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            ]
                                          },
                                          "reason": {
                                            "type": "string",
                                            "maxLength": 200
                                          },
                                          "effect_key": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "liability": {
                                            "type": "object",
                                            "properties": {
                                              "currency": {
                                                "type": "string",
                                                "pattern": "^[A-Za-z0-9_-]+$"
                                              },
                                              "amount_minor": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "currency",
                                              "amount_minor"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "currency",
                                          "amount",
                                          "effect_key"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "points.reverse"
                                          },
                                          "currency": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9_-]+$"
                                          },
                                          "match": {
                                            "type": "object",
                                            "properties": {
                                              "event": {
                                                "type": "string",
                                                "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                              },
                                              "on": {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            },
                                            "required": [
                                              "event",
                                              "on"
                                            ],
                                            "additionalProperties": false
                                          },
                                          "fraction": {
                                            "anyOf": [
                                              {
                                                "type": "number"
                                              },
                                              {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            ]
                                          },
                                          "amount": {
                                            "anyOf": [
                                              {
                                                "type": "number"
                                              },
                                              {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            ]
                                          },
                                          "reason": {
                                            "type": "string",
                                            "maxLength": 200
                                          },
                                          "effect_key": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "liability": {
                                            "type": "object",
                                            "properties": {
                                              "currency": {
                                                "type": "string",
                                                "pattern": "^[A-Za-z0-9_-]+$"
                                              },
                                              "amount_minor": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "currency",
                                              "amount_minor"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "currency",
                                          "match",
                                          "effect_key"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "reward.issue"
                                          },
                                          "reward": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9_-]+$"
                                          },
                                          "effect_key": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "liability": {
                                            "type": "object",
                                            "properties": {
                                              "currency": {
                                                "type": "string",
                                                "pattern": "^[A-Za-z0-9_-]+$"
                                              },
                                              "amount_minor": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "currency",
                                              "amount_minor"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "reward",
                                          "effect_key"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "tier.evaluate"
                                          },
                                          "program": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9_-]+$"
                                          },
                                          "effect_key": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "liability": {
                                            "type": "object",
                                            "properties": {
                                              "currency": {
                                                "type": "string",
                                                "pattern": "^[A-Za-z0-9_-]+$"
                                              },
                                              "amount_minor": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "currency",
                                              "amount_minor"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "program",
                                          "effect_key"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "attribute.set"
                                          },
                                          "attribute": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9_-]+$"
                                          },
                                          "value": {
                                            "type": [
                                              "string",
                                              "number",
                                              "boolean",
                                              "null"
                                            ]
                                          },
                                          "effect_key": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "liability": {
                                            "type": "object",
                                            "properties": {
                                              "currency": {
                                                "type": "string",
                                                "pattern": "^[A-Za-z0-9_-]+$"
                                              },
                                              "amount_minor": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "currency",
                                              "amount_minor"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "attribute",
                                          "value",
                                          "effect_key"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "webhook.emit"
                                          },
                                          "event": {
                                            "type": "string",
                                            "pattern": "^[a-z0-9_]+(\\.[a-z0-9_]+)*$"
                                          },
                                          "payload": {
                                            "type": "object",
                                            "propertyNames": {
                                              "type": "string"
                                            },
                                            "additionalProperties": {
                                              "anyOf": [
                                                {
                                                  "type": [
                                                    "string",
                                                    "number",
                                                    "boolean"
                                                  ]
                                                },
                                                {
                                                  "type": "null"
                                                },
                                                {
                                                  "type": "array",
                                                  "items": {
                                                    "type": [
                                                      "string",
                                                      "number",
                                                      "boolean"
                                                    ]
                                                  }
                                                }
                                              ]
                                            }
                                          },
                                          "effect_key": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "liability": {
                                            "type": "object",
                                            "properties": {
                                              "currency": {
                                                "type": "string",
                                                "pattern": "^[A-Za-z0-9_-]+$"
                                              },
                                              "amount_minor": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "currency",
                                              "amount_minor"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "event",
                                          "effect_key"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "badge.grant"
                                          },
                                          "badge": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9_-]+$"
                                          },
                                          "occurrence": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9_-]+$"
                                          },
                                          "effect_key": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "liability": {
                                            "type": "object",
                                            "properties": {
                                              "currency": {
                                                "type": "string",
                                                "pattern": "^[A-Za-z0-9_-]+$"
                                              },
                                              "amount_minor": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "currency",
                                              "amount_minor"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "badge",
                                          "effect_key"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "streak.contribute"
                                          },
                                          "streak": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9_-]+$"
                                          },
                                          "value": {
                                            "anyOf": [
                                              {
                                                "type": "number"
                                              },
                                              {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            ]
                                          },
                                          "effect_key": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "liability": {
                                            "type": "object",
                                            "properties": {
                                              "currency": {
                                                "type": "string",
                                                "pattern": "^[A-Za-z0-9_-]+$"
                                              },
                                              "amount_minor": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "currency",
                                              "amount_minor"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "streak",
                                          "effect_key"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "streak.freeze_grant"
                                          },
                                          "streak": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9_-]+$"
                                          },
                                          "quantity": {
                                            "type": "integer",
                                            "exclusiveMinimum": 0,
                                            "maximum": 9007199254740991
                                          },
                                          "effect_key": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "liability": {
                                            "type": "object",
                                            "properties": {
                                              "currency": {
                                                "type": "string",
                                                "pattern": "^[A-Za-z0-9_-]+$"
                                              },
                                              "amount_minor": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "currency",
                                              "amount_minor"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "streak",
                                          "quantity",
                                          "effect_key"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "quest.contribute"
                                          },
                                          "quest": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9_-]+$"
                                          },
                                          "step": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9_-]+$"
                                          },
                                          "value": {
                                            "anyOf": [
                                              {
                                                "type": "number"
                                              },
                                              {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            ]
                                          },
                                          "effect_key": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "liability": {
                                            "type": "object",
                                            "properties": {
                                              "currency": {
                                                "type": "string",
                                                "pattern": "^[A-Za-z0-9_-]+$"
                                              },
                                              "amount_minor": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "currency",
                                              "amount_minor"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "quest",
                                          "step",
                                          "effect_key"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "quest.enroll"
                                          },
                                          "quest": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9_-]+$"
                                          },
                                          "effect_key": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "liability": {
                                            "type": "object",
                                            "properties": {
                                              "currency": {
                                                "type": "string",
                                                "pattern": "^[A-Za-z0-9_-]+$"
                                              },
                                              "amount_minor": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "currency",
                                              "amount_minor"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "quest",
                                          "effect_key"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "leaderboard.contribute"
                                          },
                                          "leaderboard": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9_-]+$"
                                          },
                                          "value": {
                                            "anyOf": [
                                              {
                                                "type": "number"
                                              },
                                              {
                                                "type": "string",
                                                "minLength": 1
                                              }
                                            ]
                                          },
                                          "effect_key": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "liability": {
                                            "type": "object",
                                            "properties": {
                                              "currency": {
                                                "type": "string",
                                                "pattern": "^[A-Za-z0-9_-]+$"
                                              },
                                              "amount_minor": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "currency",
                                              "amount_minor"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "leaderboard",
                                          "value",
                                          "effect_key"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "program.reverse_contribution"
                                          },
                                          "program": {
                                            "type": "string",
                                            "pattern": "^[A-Za-z0-9_-]+$"
                                          },
                                          "source_fact": {
                                            "anyOf": [
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "fact_id": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  }
                                                },
                                                "required": [
                                                  "fact_id"
                                                ],
                                                "additionalProperties": false
                                              },
                                              {
                                                "type": "object",
                                                "properties": {
                                                  "object_type": {
                                                    "type": "string",
                                                    "pattern": "^[A-Za-z0-9_-]+$"
                                                  },
                                                  "key": {
                                                    "minItems": 1,
                                                    "type": "array",
                                                    "items": {
                                                      "type": "string",
                                                      "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_-]*(?:\\.[A-Za-z_][A-Za-z0-9_-]*)*$"
                                                    }
                                                  }
                                                },
                                                "required": [
                                                  "object_type",
                                                  "key"
                                                ],
                                                "additionalProperties": false
                                              }
                                            ]
                                          },
                                          "fraction": {
                                            "type": "string",
                                            "pattern": "^(?:0(?:\\.\\d+)?|1(?:\\.0+)?)$"
                                          },
                                          "amount": {
                                            "type": "number",
                                            "exclusiveMinimum": 0
                                          },
                                          "effect_key": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "liability": {
                                            "type": "object",
                                            "properties": {
                                              "currency": {
                                                "type": "string",
                                                "pattern": "^[A-Za-z0-9_-]+$"
                                              },
                                              "amount_minor": {
                                                "type": "integer",
                                                "exclusiveMinimum": 0,
                                                "maximum": 9007199254740991
                                              }
                                            },
                                            "required": [
                                              "currency",
                                              "amount_minor"
                                            ],
                                            "additionalProperties": false
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "program",
                                          "source_fact",
                                          "effect_key"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ]
                                  }
                                }
                              }
                            },
                            "required": [
                              "on"
                            ],
                            "additionalProperties": false
                          },
                          "display": {
                            "type": "object",
                            "properties": {
                              "title": {
                                "type": "string"
                              },
                              "description": {
                                "type": "string"
                              },
                              "image_url": {
                                "type": "string",
                                "format": "uri"
                              },
                              "icon": {
                                "type": "string"
                              },
                              "color": {
                                "type": "string"
                              },
                              "sort_order": {
                                "default": 0,
                                "type": "integer",
                                "minimum": -9007199254740991,
                                "maximum": 9007199254740991
                              },
                              "hidden": {
                                "default": false,
                                "type": "boolean"
                              },
                              "locales": {
                                "default": {},
                                "type": "object",
                                "propertyNames": {
                                  "type": "string",
                                  "pattern": "^[A-Za-z]{2,8}(?:-[A-Za-z0-9]{1,8})*$"
                                },
                                "additionalProperties": {
                                  "type": "object",
                                  "properties": {
                                    "title": {
                                      "type": "string"
                                    },
                                    "description": {
                                      "type": "string"
                                    }
                                  },
                                  "additionalProperties": false
                                }
                              }
                            },
                            "additionalProperties": false
                          },
                          "enrollment": {
                            "type": "object",
                            "properties": {
                              "mode": {
                                "default": "automatic",
                                "type": "string",
                                "enum": [
                                  "automatic",
                                  "explicit"
                                ]
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "required": [
                          "schema",
                          "kind",
                          "semantics",
                          "definition",
                          "qualification",
                          "calendar",
                          "trust",
                          "correction",
                          "reward",
                          "display",
                          "enrollment"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "object",
                        "properties": {
                          "schema": {
                            "type": "string",
                            "const": "orishare.program/v2"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "tier",
                              "quest",
                              "campaign",
                              "reward",
                              "streak",
                              "badge",
                              "leaderboard",
                              "referral"
                            ]
                          },
                          "semantics": {
                            "type": "string",
                            "const": "native_v2"
                          },
                          "definition": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "streak"
                                  },
                                  "qualification": {
                                    "type": "object",
                                    "properties": {
                                      "aggregation": {
                                        "type": "string",
                                        "enum": [
                                          "count",
                                          "sum"
                                        ]
                                      },
                                      "minimum": {
                                        "type": "string",
                                        "pattern": "^(0|[1-9][0-9]{0,18})$"
                                      }
                                    },
                                    "required": [
                                      "aggregation",
                                      "minimum"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "freezes": {
                                    "type": "object",
                                    "properties": {
                                      "ceiling": {
                                        "type": "integer",
                                        "minimum": 0,
                                        "maximum": 1000
                                      },
                                      "auto_use": {
                                        "default": true,
                                        "type": "boolean"
                                      },
                                      "purchase": {
                                        "type": "object",
                                        "properties": {
                                          "currency": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "amount_minor": {
                                            "type": "string",
                                            "pattern": "^(0|[1-9][0-9]{0,18})$"
                                          }
                                        },
                                        "required": [
                                          "currency",
                                          "amount_minor"
                                        ],
                                        "additionalProperties": false
                                      }
                                    },
                                    "required": [
                                      "ceiling"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "milestones": {
                                    "maxItems": 64,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "threshold": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 9007199254740991
                                        },
                                        "occurrence": {
                                          "type": "string",
                                          "enum": [
                                            "lifetime",
                                            "episode"
                                          ]
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "threshold",
                                        "occurrence"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "repair": {
                                    "type": "object",
                                    "properties": {
                                      "price": {
                                        "type": "object",
                                        "properties": {
                                          "currency": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          },
                                          "amount_minor": {
                                            "type": "string",
                                            "pattern": "^(0|[1-9][0-9]{0,18})$"
                                          }
                                        },
                                        "required": [
                                          "currency",
                                          "amount_minor"
                                        ],
                                        "additionalProperties": false
                                      },
                                      "window_periods": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 30
                                      },
                                      "maximum_per_days": {
                                        "type": "object",
                                        "properties": {
                                          "count": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 1000
                                          },
                                          "days": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 366
                                          }
                                        },
                                        "required": [
                                          "count",
                                          "days"
                                        ],
                                        "additionalProperties": false
                                      }
                                    },
                                    "required": [
                                      "price",
                                      "window_periods"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "protected_weekdays": {
                                    "minItems": 1,
                                    "maxItems": 6,
                                    "type": "array",
                                    "items": {
                                      "type": "integer",
                                      "minimum": 0,
                                      "maximum": 6
                                    }
                                  }
                                },
                                "required": [
                                  "kind",
                                  "qualification",
                                  "freezes",
                                  "milestones"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "badge"
                                  },
                                  "qualification": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "aggregation": {
                                            "type": "string",
                                            "const": "count"
                                          }
                                        },
                                        "required": [
                                          "aggregation"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "aggregation": {
                                            "type": "string",
                                            "const": "sum"
                                          }
                                        },
                                        "required": [
                                          "aggregation"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "aggregation": {
                                            "type": "string",
                                            "const": "distinct"
                                          },
                                          "distinct_key": {
                                            "type": "string",
                                            "maxLength": 255,
                                            "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                          }
                                        },
                                        "required": [
                                          "aggregation",
                                          "distinct_key"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ],
                                    "type": "object"
                                  },
                                  "ranks": {
                                    "minItems": 1,
                                    "maxItems": 64,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "threshold": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]{0,18})$"
                                        },
                                        "display": {
                                          "type": "object",
                                          "properties": {
                                            "title": {
                                              "type": "string",
                                              "maxLength": 255
                                            },
                                            "description": {
                                              "type": "string",
                                              "maxLength": 4096
                                            }
                                          },
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "threshold"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "visibility": {
                                    "type": "string",
                                    "enum": [
                                      "visible",
                                      "hidden_until_earned"
                                    ]
                                  },
                                  "collection": {
                                    "type": "string",
                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                  },
                                  "repeatable": {
                                    "type": "boolean"
                                  },
                                  "occurrence": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "lifetime"
                                          }
                                        },
                                        "required": [
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "period"
                                          }
                                        },
                                        "required": [
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "season"
                                          }
                                        },
                                        "required": [
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "verified_fact"
                                          }
                                        },
                                        "required": [
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ],
                                    "type": "object"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "qualification",
                                  "ranks",
                                  "visibility",
                                  "repeatable",
                                  "occurrence"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "quest"
                                  },
                                  "steps": {
                                    "minItems": 1,
                                    "maxItems": 32,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "aggregation": {
                                          "type": "string",
                                          "enum": [
                                            "count",
                                            "sum",
                                            "distinct"
                                          ]
                                        },
                                        "target": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]{0,18})$"
                                        },
                                        "distinct_key": {
                                          "type": "string",
                                          "maxLength": 255,
                                          "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                        },
                                        "display": {
                                          "type": "object",
                                          "properties": {
                                            "title": {
                                              "type": "string",
                                              "maxLength": 255
                                            },
                                            "description": {
                                              "type": "string",
                                              "maxLength": 4096
                                            }
                                          },
                                          "additionalProperties": false
                                        },
                                        "available_from": {
                                          "type": "string",
                                          "format": "date-time",
                                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                        },
                                        "deadline": {
                                          "type": "string",
                                          "format": "date-time",
                                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "aggregation",
                                        "target",
                                        "display"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "prerequisites": {
                                    "maxItems": 64,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "step": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "requires": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        }
                                      },
                                      "required": [
                                        "step",
                                        "requires"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "collection": {
                                    "type": "string",
                                    "enum": [
                                      "auto_collect",
                                      "claim"
                                    ]
                                  },
                                  "repeatable": {
                                    "type": "boolean"
                                  },
                                  "claim_deadline": {
                                    "type": "string",
                                    "format": "date-time",
                                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                                  },
                                  "chain": {
                                    "type": "object",
                                    "properties": {
                                      "kind": {
                                        "type": "string",
                                        "const": "program"
                                      },
                                      "key": {
                                        "type": "string",
                                        "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                      },
                                      "version": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 9007199254740991
                                      },
                                      "digest": {
                                        "type": "string",
                                        "pattern": "^[a-f0-9]{64}$"
                                      }
                                    },
                                    "required": [
                                      "kind",
                                      "key",
                                      "version",
                                      "digest"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "rotation": {
                                    "type": "object",
                                    "properties": {
                                      "candidates": {
                                        "minItems": 1,
                                        "maxItems": 100,
                                        "type": "array",
                                        "items": {
                                          "type": "object",
                                          "properties": {
                                            "kind": {
                                              "type": "string",
                                              "const": "program"
                                            },
                                            "key": {
                                              "type": "string",
                                              "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                            },
                                            "version": {
                                              "type": "integer",
                                              "minimum": 1,
                                              "maximum": 9007199254740991
                                            },
                                            "digest": {
                                              "type": "string",
                                              "pattern": "^[a-f0-9]{64}$"
                                            }
                                          },
                                          "required": [
                                            "kind",
                                            "key",
                                            "version",
                                            "digest"
                                          ],
                                          "additionalProperties": false
                                        }
                                      },
                                      "select": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 100
                                      }
                                    },
                                    "required": [
                                      "candidates",
                                      "select"
                                    ],
                                    "additionalProperties": false
                                  }
                                },
                                "required": [
                                  "kind",
                                  "steps",
                                  "prerequisites",
                                  "collection",
                                  "repeatable"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "tier"
                                  },
                                  "currency": {
                                    "type": "string",
                                    "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                  },
                                  "basis": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "lifetime_earned"
                                          }
                                        },
                                        "required": [
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "balance"
                                          }
                                        },
                                        "required": [
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "earned_rolling_days"
                                          },
                                          "days": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "days"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ],
                                    "type": "object"
                                  },
                                  "downgrade_check": {
                                    "type": "string",
                                    "enum": [
                                      "daily",
                                      "monthly",
                                      "never"
                                    ]
                                  },
                                  "levels": {
                                    "minItems": 1,
                                    "maxItems": 1000,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "threshold": {
                                          "type": "string",
                                          "pattern": "^(0|[1-9][0-9]{0,18})$"
                                        },
                                        "display": {
                                          "type": "object",
                                          "properties": {
                                            "title": {
                                              "type": "string",
                                              "maxLength": 255
                                            },
                                            "description": {
                                              "type": "string",
                                              "maxLength": 4096
                                            }
                                          },
                                          "additionalProperties": false
                                        }
                                      },
                                      "required": [
                                        "key",
                                        "threshold",
                                        "display"
                                      ],
                                      "additionalProperties": false
                                    }
                                  },
                                  "occurrence": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "lifetime"
                                          }
                                        },
                                        "required": [
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "season"
                                          }
                                        },
                                        "required": [
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "prestige"
                                          },
                                          "maximum_runs": {
                                            "type": "integer",
                                            "minimum": 1,
                                            "maximum": 9007199254740991
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "maximum_runs"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ],
                                    "type": "object"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "currency",
                                  "basis",
                                  "downgrade_check",
                                  "levels",
                                  "occurrence"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "kind": {
                                    "type": "string",
                                    "const": "leaderboard"
                                  },
                                  "aggregation": {
                                    "type": "string",
                                    "enum": [
                                      "sum",
                                      "max",
                                      "latest_verified"
                                    ]
                                  },
                                  "input": {
                                    "type": "object",
                                    "properties": {
                                      "minimum": {
                                        "type": "string",
                                        "pattern": "^(0|-?[1-9][0-9]{0,18})$"
                                      },
                                      "maximum": {
                                        "type": "string",
                                        "pattern": "^(0|-?[1-9][0-9]{0,18})$"
                                      }
                                    },
                                    "required": [
                                      "minimum",
                                      "maximum"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "order": {
                                    "type": "string",
                                    "enum": [
                                      "ascending",
                                      "descending"
                                    ]
                                  },
                                  "scope": {
                                    "oneOf": [
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "global"
                                          }
                                        },
                                        "required": [
                                          "type"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "segment"
                                          },
                                          "segment": {
                                            "type": "string",
                                            "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "segment"
                                        ],
                                        "additionalProperties": false
                                      },
                                      {
                                        "type": "object",
                                        "properties": {
                                          "type": {
                                            "type": "string",
                                            "const": "group_key"
                                          },
                                          "key": {
                                            "type": "string",
                                            "maxLength": 255,
                                            "pattern": "^event\\.properties\\.[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)*$"
                                          }
                                        },
                                        "required": [
                                          "type",
                                          "key"
                                        ],
                                        "additionalProperties": false
                                      }
                                    ],
                                    "type": "object"
                                  },
                                  "rank": {
                                    "type": "string",
                                    "const": "ordinal"
                                  },
                                  "privacy": {
                                    "type": "object",
                                    "properties": {
                                      "display": {
                                        "type": "string",
                                        "const": "pseudonymous"
                                      },
                                      "opt_out": {
                                        "type": "boolean",
                                        "const": true
                                      },
                                      "anonymous_entries": {
                                        "type": "boolean",
                                        "const": false
                                      }
                                    },
                                    "required": [
                                      "display",
                                      "opt_out",
                                      "anonymous_entries"
                                    ],
                                    "additionalProperties": false
                                  },
                                  "prizes": {
                                    "maxItems": 100,
                                    "type": "array",
                                    "items": {
                                      "type": "object",
                                      "properties": {
                                        "key": {
                                          "type": "string",
                                          "pattern": "^[a-z][a-z0-9_]{0,62}$"
                                        },
                                        "from": {
                                          "type": "integer",
                                          "minimum": 1,
                                          "maximum": 1000
                                        },
                                        "through": {
                                          "type": "integer",
                  