{
  "components": {
    "parameters": {},
    "schemas": {
      "AdminMe": {
        "properties": {
          "capabilities": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "email": {
            "type": "string"
          },
          "locale": {
            "type": "string"
          },
          "mfa": {
            "properties": {
              "enrolled": {
                "type": "boolean"
              },
              "required": {
                "enum": [
                  "enrollment",
                  "verification",
                  null
                ],
                "type": [
                  "string",
                  "null"
                ]
              },
              "verified_at": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "enrolled",
              "verified_at",
              "required"
            ],
            "type": "object"
          },
          "name": {
            "type": "string"
          },
          "permissions": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "permissions_etag": {
            "type": [
              "string",
              "null"
            ]
          },
          "reauth_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "roles": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "session_expires_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "user_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "email",
          "name",
          "locale",
          "roles",
          "permissions",
          "capabilities",
          "mfa",
          "reauth_at",
          "session_expires_at",
          "permissions_etag"
        ],
        "type": "object"
      },
      "AdminSubscription": {
        "allOf": [
          {
            "$ref": "#/components/schemas/MySubscription"
          },
          {
            "properties": {
              "access_version": {
                "type": "integer"
              },
              "auto_renew_failures": {
                "type": "integer"
              },
              "available_actions": {
                "items": {
                  "enum": [
                    "extend",
                    "grant_traffic",
                    "set_limits",
                    "suspend",
                    "resume",
                    "cancel",
                    "reset_usage",
                    "rotate_credential",
                    "activate",
                    "disable_auto_renew"
                  ],
                  "type": "string"
                },
                "type": "array"
              },
              "credential": {
                "properties": {
                  "fingerprint": {
                    "description": "Lowercase hex SHA-256 of the node UUID text",
                    "type": "string"
                  },
                  "rotated_at": {
                    "example": "2026-10-22T08:00:00.000Z",
                    "format": "date-time",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "fingerprint",
                  "rotated_at"
                ],
                "type": "object"
              },
              "device_bonus": {
                "description": "Part of device_limit added by applied device bonuses",
                "type": "integer"
              },
              "link": {
                "properties": {
                  "fingerprint": {
                    "description": "Lowercase hex SHA-256 of the link token",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "issued": {
                    "type": "boolean"
                  },
                  "last_fetched_at": {
                    "example": "2026-10-22T08:00:00.000Z",
                    "format": "date-time",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "rotated_at": {
                    "example": "2026-10-22T08:00:00.000Z",
                    "format": "date-time",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "issued",
                  "fingerprint",
                  "rotated_at",
                  "last_fetched_at"
                ],
                "type": "object"
              },
              "node_tags": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "node_user_id": {
                "type": "integer"
              },
              "note": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "queue_seq": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "suspended_reason": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "updated_at": {
                "example": "2026-10-22T08:00:00.000Z",
                "format": "date-time",
                "type": "string"
              },
              "user_id": {
                "format": "uuid",
                "type": "string"
              }
            },
            "required": [
              "user_id",
              "suspended_reason",
              "queue_seq",
              "node_tags",
              "device_bonus",
              "node_user_id",
              "credential",
              "link",
              "auto_renew_failures",
              "access_version",
              "note",
              "updated_at",
              "available_actions"
            ],
            "type": "object"
          }
        ]
      },
      "AdminSubscriptionCreate": {
        "additionalProperties": false,
        "properties": {
          "activation": {
            "default": "auto",
            "enum": [
              "auto",
              "immediate",
              "queued"
            ],
            "type": "string"
          },
          "note": {
            "maxLength": 500,
            "type": [
              "string",
              "null"
            ]
          },
          "plan_id": {
            "format": "uuid",
            "type": "string"
          },
          "price_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "maxLength": 500,
            "minLength": 1,
            "type": "string"
          },
          "term": {
            "$ref": "#/components/schemas/SubscriptionTerm"
          },
          "user_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "plan_id",
          "reason"
        ],
        "type": "object"
      },
      "AdminSubscriptionExtend": {
        "additionalProperties": false,
        "properties": {
          "reason": {
            "maxLength": 500,
            "minLength": 1,
            "type": "string"
          },
          "term": {
            "$ref": "#/components/schemas/SubscriptionTerm"
          },
          "term_end_at": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "reason"
        ],
        "type": "object"
      },
      "AdminSubscriptionGrantTraffic": {
        "additionalProperties": false,
        "properties": {
          "bytes": {
            "description": "Bonus bytes for the current period",
            "example": "10737418240",
            "pattern": "^[1-9]\\d{0,18}$",
            "type": "string"
          },
          "reason": {
            "maxLength": 500,
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "bytes",
          "reason"
        ],
        "type": "object"
      },
      "AdminSubscriptionLimits": {
        "additionalProperties": false,
        "properties": {
          "device_limit": {
            "description": "Base limit; null = unlimited",
            "maximum": 10000,
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "reason": {
            "maxLength": 500,
            "minLength": 1,
            "type": "string"
          },
          "speed_limit_mbps": {
            "maximum": 1000000,
            "minimum": 1,
            "type": [
              "integer",
              "null"
            ]
          },
          "traffic_quota_bytes": {
            "pattern": "^\\d{1,19}$",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "reason"
        ],
        "type": "object"
      },
      "AdminSubscriptionPage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/AdminSubscription"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "AdminSubscriptionReason": {
        "additionalProperties": false,
        "properties": {
          "reason": {
            "maxLength": 500,
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "reason"
        ],
        "type": "object"
      },
      "AdminUser": {
        "properties": {
          "active_subscriptions": {
            "type": "integer"
          },
          "available_actions": {
            "description": "What the caller may do with this account (advisory; every command re-checks)",
            "items": {
              "enum": [
                "update",
                "activate",
                "disable",
                "ban",
                "revoke_sessions",
                "view_sensitive",
                "reset_mfa"
              ],
              "type": "string"
            },
            "type": "array"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "email": {
            "description": "Masked: a***@example.com",
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "inviter": {
            "properties": {
              "id": {
                "format": "uuid",
                "type": "string"
              },
              "public_id": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "public_id"
            ],
            "type": [
              "object",
              "null"
            ]
          },
          "last_login_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "phone": {
            "description": "Masked",
            "type": [
              "string",
              "null"
            ]
          },
          "public_id": {
            "type": "string"
          },
          "roles": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "staff": {
            "type": "boolean"
          },
          "status": {
            "enum": [
              "active",
              "disabled",
              "banned",
              "deactivating",
              "deleted"
            ],
            "type": "string"
          },
          "two_factor_enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "public_id",
          "email",
          "phone",
          "name",
          "status",
          "roles",
          "staff",
          "two_factor_enabled",
          "created_at",
          "last_login_at",
          "inviter",
          "active_subscriptions",
          "available_actions"
        ],
        "type": "object"
      },
      "AdminUserDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/AdminUser"
          },
          {
            "properties": {
              "email_verified": {
                "type": "boolean"
              },
              "invited_via": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "locale": {
                "type": "string"
              },
              "permissions": {
                "description": "Expanded codes of the roles",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "phone_verified": {
                "type": "boolean"
              },
              "registered_via": {
                "type": "string"
              },
              "sessions": {
                "description": "Unexpired sessions",
                "type": "integer"
              },
              "status_changed_at": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "status_reason": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "time_zone": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "updated_at": {
                "format": "date-time",
                "type": "string"
              }
            },
            "required": [
              "email_verified",
              "phone_verified",
              "locale",
              "time_zone",
              "status_reason",
              "status_changed_at",
              "registered_via",
              "invited_via",
              "updated_at",
              "sessions",
              "permissions"
            ],
            "type": "object"
          }
        ]
      },
      "AdminUserPage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/AdminUser"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "AdminUserPatch": {
        "additionalProperties": false,
        "properties": {
          "email": {
            "description": "Becomes unverified until the user proves it",
            "format": "email",
            "maxLength": 254,
            "type": "string"
          },
          "locale": {
            "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
            "type": "string"
          },
          "name": {
            "maxLength": 64,
            "type": "string"
          },
          "time_zone": {
            "maxLength": 64,
            "minLength": 1,
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "AdminUserSensitive": {
        "properties": {
          "email": {
            "type": "string"
          },
          "email_verified": {
            "type": "boolean"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "phone_number": {
            "type": [
              "string",
              "null"
            ]
          },
          "phone_verified": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "email",
          "email_verified",
          "phone_number",
          "phone_verified"
        ],
        "type": "object"
      },
      "AdminWalletEntry": {
        "allOf": [
          {
            "$ref": "#/components/schemas/WalletEntry"
          },
          {
            "properties": {
              "actor": {
                "properties": {
                  "id": {
                    "format": "uuid",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "type": {
                    "enum": [
                      "system",
                      "user",
                      "staff"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "id"
                ],
                "type": "object"
              },
              "memo": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "operation_key": {
                "type": "string"
              },
              "user_id": {
                "format": "uuid",
                "type": "string"
              }
            },
            "required": [
              "user_id",
              "operation_key",
              "actor",
              "memo"
            ],
            "type": "object"
          }
        ]
      },
      "AdminWalletEntryPage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/AdminWalletEntry"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "AuditEvent": {
        "properties": {
          "action": {
            "type": "string"
          },
          "actor": {
            "properties": {
              "id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "type": {
                "enum": [
                  "user",
                  "staff",
                  "system",
                  "api_key",
                  "server"
                ],
                "type": "string"
              }
            },
            "required": [
              "type",
              "id"
            ],
            "type": "object"
          },
          "category": {
            "enum": [
              "admin",
              "security",
              "billing",
              "subscription",
              "network",
              "system",
              "ops"
            ],
            "type": "string"
          },
          "detail": {
            "additionalProperties": {},
            "description": "Redacted diff or event detail",
            "type": [
              "object",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "ip_masked": {
            "description": "IPv4 /24 or IPv6 /48",
            "type": [
              "string",
              "null"
            ]
          },
          "occurred_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "outcome": {
            "enum": [
              "success",
              "denied",
              "failed"
            ],
            "type": "string"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "request_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "resource": {
            "properties": {
              "id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "type": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "id"
            ],
            "type": "object"
          }
        },
        "required": [
          "id",
          "occurred_at",
          "category",
          "actor",
          "action",
          "resource",
          "outcome",
          "request_id",
          "ip_masked",
          "reason",
          "detail"
        ],
        "type": "object"
      },
      "AuditEventPage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/AuditEvent"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "BulkReportExport": {
        "properties": {
          "created_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "expires_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "filters": {
            "additionalProperties": {},
            "type": "object"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "kind": {
            "enum": [
              "bulk_report"
            ],
            "type": "string"
          },
          "operator_id": {
            "format": "uuid",
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "row_count": {
            "type": [
              "integer",
              "null"
            ]
          },
          "row_limit": {
            "type": "integer"
          },
          "status": {
            "enum": [
              "pending",
              "ready",
              "failed",
              "expired"
            ],
            "type": "string"
          },
          "truncated": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "operator_id",
          "reason",
          "row_limit",
          "filters",
          "status",
          "row_count",
          "truncated",
          "created_at",
          "expires_at",
          "kind"
        ],
        "type": "object"
      },
      "CapChallenge": {
        "properties": {
          "challenge": {
            "properties": {
              "c": {
                "description": "Number of puzzles",
                "type": "integer"
              },
              "d": {
                "description": "Difficulty (hex digits of the SHA-256 prefix)",
                "type": "integer"
              },
              "s": {
                "description": "Salt length",
                "type": "integer"
              }
            },
            "required": [
              "c",
              "s",
              "d"
            ],
            "type": "object"
          },
          "expires": {
            "description": "Epoch milliseconds",
            "type": "integer"
          },
          "token": {
            "description": "Signed challenge (HS256 JWT)",
            "type": "string"
          }
        },
        "required": [
          "challenge",
          "token",
          "expires"
        ],
        "type": "object"
      },
      "CapPass": {
        "properties": {
          "expires": {
            "description": "Epoch milliseconds",
            "type": "integer"
          },
          "success": {
            "enum": [
              true
            ],
            "type": "boolean"
          },
          "token": {
            "description": "One-time pass token: send it in X-Captcha-Response",
            "type": "string"
          }
        },
        "required": [
          "success",
          "token",
          "expires"
        ],
        "type": "object"
      },
      "CapRedeemRequest": {
        "properties": {
          "solutions": {
            "items": {
              "type": "number"
            },
            "maxItems": 1000,
            "minItems": 1,
            "type": "array"
          },
          "token": {
            "maxLength": 4096,
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "token",
          "solutions"
        ],
        "type": "object"
      },
      "CaptchaProviderTestRequest": {
        "additionalProperties": false,
        "properties": {
          "provider": {
            "enum": [
              "turnstile",
              "cap",
              "image"
            ],
            "type": "string"
          }
        },
        "required": [
          "provider"
        ],
        "type": "object"
      },
      "CaptchaProviderTestResult": {
        "properties": {
          "detail": {
            "type": "string"
          },
          "ok": {
            "type": "boolean"
          },
          "provider": {
            "type": "string"
          }
        },
        "required": [
          "provider",
          "ok",
          "detail"
        ],
        "type": "object"
      },
      "CatalogI18n": {
        "additionalProperties": {
          "properties": {
            "_meta": {
              "description": "Read-only origin marker of the locale (machine translation, manual edit)",
              "properties": {
                "origin": {
                  "enum": [
                    "manual",
                    "machine",
                    "builtin"
                  ],
                  "type": "string"
                },
                "provider": {
                  "type": "string"
                }
              },
              "required": [
                "origin"
              ],
              "type": "object"
            },
            "description_md": {
              "type": "string"
            },
            "features": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "name": {
              "type": "string"
            },
            "subtitle": {
              "type": "string"
            }
          },
          "type": "object"
        },
        "type": "object"
      },
      "CatalogI18nInput": {
        "additionalProperties": {
          "additionalProperties": false,
          "properties": {
            "_meta": {},
            "description_md": {
              "maxLength": 20000,
              "type": "string"
            },
            "features": {
              "items": {
                "maxLength": 200,
                "type": "string"
              },
              "maxItems": 20,
              "type": "array"
            },
            "name": {
              "maxLength": 100,
              "type": "string"
            },
            "subtitle": {
              "maxLength": 200,
              "type": "string"
            }
          },
          "type": "object"
        },
        "description": "Full map `{ \"<locale>\": { name, subtitle, description_md, features } }`; replaces the stored one",
        "type": "object"
      },
      "CatalogMoney": {
        "properties": {
          "currency": {
            "pattern": "^[A-Z]{3}$",
            "type": "string"
          },
          "minor": {
            "description": "Amount in minor units as a decimal string",
            "pattern": "^(0|[1-9]\\d{0,17})$",
            "type": "string"
          }
        },
        "required": [
          "currency",
          "minor"
        ],
        "type": "object"
      },
      "CatalogPlan": {
        "properties": {
          "code": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "device_limit": {
            "type": [
              "integer",
              "null"
            ]
          },
          "i18n": {
            "$ref": "#/components/schemas/CatalogI18n"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "node_tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "per_user_limit": {
            "type": [
              "integer",
              "null"
            ]
          },
          "product_id": {
            "format": "uuid",
            "type": "string"
          },
          "renewable_when_off_sale": {
            "type": "boolean"
          },
          "reset_on_renewal": {
            "type": "boolean"
          },
          "reset_policy": {
            "enum": [
              "none",
              "billing_cycle",
              "calendar_month",
              "calendar_year"
            ],
            "type": "string"
          },
          "sort": {
            "type": "integer"
          },
          "source_locale": {
            "type": "string"
          },
          "speed_limit_mbps": {
            "type": [
              "integer",
              "null"
            ]
          },
          "status": {
            "enum": [
              "draft",
              "on_sale",
              "off_sale",
              "retired"
            ],
            "type": "string"
          },
          "stock": {
            "properties": {
              "available": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "reserved": {
                "type": "integer"
              },
              "sold": {
                "type": "integer"
              },
              "total": {
                "description": "null = unlimited",
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "total",
              "sold",
              "reserved",
              "available"
            ],
            "type": "object"
          },
          "traffic_quota_bytes": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": "string"
          },
          "version": {
            "type": "integer"
          },
          "visible": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "product_id",
          "code",
          "source_locale",
          "i18n",
          "status",
          "visible",
          "renewable_when_off_sale",
          "traffic_quota_bytes",
          "speed_limit_mbps",
          "device_limit",
          "reset_policy",
          "reset_on_renewal",
          "node_tags",
          "stock",
          "per_user_limit",
          "sort",
          "created_at",
          "updated_at",
          "version"
        ],
        "type": "object"
      },
      "CatalogPlanCreate": {
        "additionalProperties": false,
        "properties": {
          "code": {
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$",
            "type": "string"
          },
          "device_limit": {
            "description": "null = unlimited",
            "maximum": 10000,
            "minimum": 1,
            "type": [
              "integer",
              "null"
            ]
          },
          "i18n": {
            "$ref": "#/components/schemas/CatalogI18nInput"
          },
          "node_tags": {
            "description": "Granted node tags (at least one)",
            "items": {
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            },
            "maxItems": 64,
            "type": "array"
          },
          "per_user_limit": {
            "maximum": 1000000,
            "minimum": 1,
            "type": [
              "integer",
              "null"
            ]
          },
          "product_id": {
            "format": "uuid",
            "type": "string"
          },
          "renewable_when_off_sale": {
            "type": "boolean"
          },
          "reset_on_renewal": {
            "type": "boolean"
          },
          "reset_policy": {
            "enum": [
              "none",
              "billing_cycle",
              "calendar_month",
              "calendar_year"
            ],
            "type": "string"
          },
          "sort": {
            "maximum": 1000000,
            "minimum": -1000000,
            "type": "integer"
          },
          "source_locale": {
            "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
            "type": "string"
          },
          "speed_limit_mbps": {
            "description": "Mbps; null = unlimited",
            "maximum": 1000000,
            "minimum": 1,
            "type": [
              "integer",
              "null"
            ]
          },
          "stock_total": {
            "description": "null = unlimited",
            "maximum": 2147483647,
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          },
          "traffic_quota_bytes": {
            "description": "Traffic quota in bytes as a decimal string; null = unlimited",
            "pattern": "^[1-9]\\d{0,18}$",
            "type": [
              "string",
              "null"
            ]
          },
          "visible": {
            "type": "boolean"
          }
        },
        "required": [
          "product_id",
          "code",
          "source_locale",
          "i18n",
          "reset_policy",
          "node_tags"
        ],
        "type": "object"
      },
      "CatalogPlanDetail": {
        "properties": {
          "code": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "device_limit": {
            "type": [
              "integer",
              "null"
            ]
          },
          "i18n": {
            "$ref": "#/components/schemas/CatalogI18n"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "node_tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "per_user_limit": {
            "type": [
              "integer",
              "null"
            ]
          },
          "prices": {
            "items": {
              "$ref": "#/components/schemas/CatalogPrice"
            },
            "type": "array"
          },
          "product_id": {
            "format": "uuid",
            "type": "string"
          },
          "renewable_when_off_sale": {
            "type": "boolean"
          },
          "reset_on_renewal": {
            "type": "boolean"
          },
          "reset_policy": {
            "enum": [
              "none",
              "billing_cycle",
              "calendar_month",
              "calendar_year"
            ],
            "type": "string"
          },
          "sort": {
            "type": "integer"
          },
          "source_locale": {
            "type": "string"
          },
          "speed_limit_mbps": {
            "type": [
              "integer",
              "null"
            ]
          },
          "status": {
            "enum": [
              "draft",
              "on_sale",
              "off_sale",
              "retired"
            ],
            "type": "string"
          },
          "stock": {
            "properties": {
              "available": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "reserved": {
                "type": "integer"
              },
              "sold": {
                "type": "integer"
              },
              "total": {
                "description": "null = unlimited",
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "total",
              "sold",
              "reserved",
              "available"
            ],
            "type": "object"
          },
          "traffic_quota_bytes": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": "string"
          },
          "version": {
            "type": "integer"
          },
          "visible": {
            "type": "boolean"
          },
          "warnings": {
            "items": {
              "$ref": "#/components/schemas/CatalogWarning"
            },
            "type": "array"
          }
        },
        "required": [
          "id",
          "product_id",
          "code",
          "source_locale",
          "i18n",
          "status",
          "visible",
          "renewable_when_off_sale",
          "traffic_quota_bytes",
          "speed_limit_mbps",
          "device_limit",
          "reset_policy",
          "reset_on_renewal",
          "node_tags",
          "stock",
          "per_user_limit",
          "sort",
          "created_at",
          "updated_at",
          "version",
          "prices",
          "warnings"
        ],
        "type": "object"
      },
      "CatalogPlanList": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/CatalogPlan"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "CatalogPlanPage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/CatalogPlan"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "CatalogPlanPatch": {
        "additionalProperties": false,
        "description": "Status, stock and order have their own endpoints",
        "properties": {
          "code": {
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$",
            "type": "string"
          },
          "device_limit": {
            "description": "null = unlimited",
            "maximum": 10000,
            "minimum": 1,
            "type": [
              "integer",
              "null"
            ]
          },
          "i18n": {
            "$ref": "#/components/schemas/CatalogI18nInput"
          },
          "node_tags": {
            "description": "Granted node tags (at least one)",
            "items": {
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            },
            "maxItems": 64,
            "type": "array"
          },
          "per_user_limit": {
            "maximum": 1000000,
            "minimum": 1,
            "type": [
              "integer",
              "null"
            ]
          },
          "product_id": {
            "format": "uuid",
            "type": "string"
          },
          "renewable_when_off_sale": {
            "type": "boolean"
          },
          "reset_on_renewal": {
            "type": "boolean"
          },
          "reset_policy": {
            "enum": [
              "none",
              "billing_cycle",
              "calendar_month",
              "calendar_year"
            ],
            "type": "string"
          },
          "sort": {
            "maximum": 1000000,
            "minimum": -1000000,
            "type": "integer"
          },
          "source_locale": {
            "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
            "type": "string"
          },
          "speed_limit_mbps": {
            "description": "Mbps; null = unlimited",
            "maximum": 1000000,
            "minimum": 1,
            "type": [
              "integer",
              "null"
            ]
          },
          "traffic_quota_bytes": {
            "description": "Traffic quota in bytes as a decimal string; null = unlimited",
            "pattern": "^[1-9]\\d{0,18}$",
            "type": [
              "string",
              "null"
            ]
          },
          "visible": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "CatalogPlanReorder": {
        "additionalProperties": false,
        "description": "Every plan of the product, once, in display order",
        "properties": {
          "plan_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "maxItems": 500,
            "minItems": 1,
            "type": "array"
          },
          "product_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "product_id",
          "plan_ids"
        ],
        "type": "object"
      },
      "CatalogPlanSaved": {
        "properties": {
          "code": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "device_limit": {
            "type": [
              "integer",
              "null"
            ]
          },
          "i18n": {
            "$ref": "#/components/schemas/CatalogI18n"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "node_tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "per_user_limit": {
            "type": [
              "integer",
              "null"
            ]
          },
          "product_id": {
            "format": "uuid",
            "type": "string"
          },
          "renewable_when_off_sale": {
            "type": "boolean"
          },
          "reset_on_renewal": {
            "type": "boolean"
          },
          "reset_policy": {
            "enum": [
              "none",
              "billing_cycle",
              "calendar_month",
              "calendar_year"
            ],
            "type": "string"
          },
          "sort": {
            "type": "integer"
          },
          "source_locale": {
            "type": "string"
          },
          "speed_limit_mbps": {
            "type": [
              "integer",
              "null"
            ]
          },
          "status": {
            "enum": [
              "draft",
              "on_sale",
              "off_sale",
              "retired"
            ],
            "type": "string"
          },
          "stock": {
            "properties": {
              "available": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "reserved": {
                "type": "integer"
              },
              "sold": {
                "type": "integer"
              },
              "total": {
                "description": "null = unlimited",
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "total",
              "sold",
              "reserved",
              "available"
            ],
            "type": "object"
          },
          "traffic_quota_bytes": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": "string"
          },
          "version": {
            "type": "integer"
          },
          "visible": {
            "type": "boolean"
          },
          "warnings": {
            "items": {
              "$ref": "#/components/schemas/CatalogWarning"
            },
            "type": "array"
          }
        },
        "required": [
          "id",
          "product_id",
          "code",
          "source_locale",
          "i18n",
          "status",
          "visible",
          "renewable_when_off_sale",
          "traffic_quota_bytes",
          "speed_limit_mbps",
          "device_limit",
          "reset_policy",
          "reset_on_renewal",
          "node_tags",
          "stock",
          "per_user_limit",
          "sort",
          "created_at",
          "updated_at",
          "version",
          "warnings"
        ],
        "type": "object"
      },
      "CatalogPlanStatus": {
        "additionalProperties": false,
        "properties": {
          "renewable_when_off_sale": {
            "type": "boolean"
          },
          "status": {
            "enum": [
              "draft",
              "on_sale",
              "off_sale",
              "retired"
            ],
            "type": "string"
          }
        },
        "required": [
          "status"
        ],
        "type": "object"
      },
      "CatalogPlanStock": {
        "additionalProperties": false,
        "properties": {
          "stock_total": {
            "description": "null = unlimited",
            "maximum": 2147483647,
            "minimum": 0,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "stock_total"
        ],
        "type": "object"
      },
      "CatalogPrice": {
        "properties": {
          "amount": {
            "$ref": "#/components/schemas/CatalogMoney"
          },
          "compare_at": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CatalogMoney"
              },
              {
                "type": [
                  "object",
                  "null"
                ]
              }
            ]
          },
          "created_at": {
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "period_count": {
            "type": "integer"
          },
          "period_unit": {
            "enum": [
              "day",
              "month",
              "year",
              "none"
            ],
            "type": "string"
          },
          "plan_id": {
            "format": "uuid",
            "type": "string"
          },
          "sort": {
            "type": "integer"
          },
          "status": {
            "enum": [
              "active",
              "inactive"
            ],
            "type": "string"
          }
        },
        "required": [
          "id",
          "plan_id",
          "period_unit",
          "period_count",
          "amount",
          "compare_at",
          "status",
          "sort",
          "created_at"
        ],
        "type": "object"
      },
      "CatalogPriceCreate": {
        "additionalProperties": false,
        "properties": {
          "amount": {
            "$ref": "#/components/schemas/CatalogMoney"
          },
          "compare_at": {
            "description": "Struck-through list price",
            "properties": {
              "currency": {
                "pattern": "^[A-Z]{3}$",
                "type": "string"
              },
              "minor": {
                "description": "Amount in minor units as a decimal string",
                "pattern": "^(0|[1-9]\\d{0,17})$",
                "type": "string"
              }
            },
            "required": [
              "currency",
              "minor"
            ],
            "type": [
              "object",
              "null"
            ]
          },
          "period_count": {
            "maximum": 3650,
            "minimum": 1,
            "type": "integer"
          },
          "period_unit": {
            "description": "`none` = permanent (no term)",
            "enum": [
              "day",
              "month",
              "year",
              "none"
            ],
            "type": "string"
          },
          "sort": {
            "maximum": 1000000,
            "minimum": -1000000,
            "type": "integer"
          }
        },
        "required": [
          "period_unit",
          "period_count",
          "amount"
        ],
        "type": "object"
      },
      "CatalogPriceList": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/CatalogPrice"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "CatalogProduct": {
        "properties": {
          "created_at": {
            "type": "string"
          },
          "group_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "i18n": {
            "$ref": "#/components/schemas/CatalogI18n"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "sort": {
            "type": "integer"
          },
          "source_locale": {
            "type": "string"
          },
          "status": {
            "enum": [
              "draft",
              "active",
              "archived"
            ],
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "version": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "slug",
          "group_key",
          "source_locale",
          "i18n",
          "status",
          "sort",
          "created_at",
          "updated_at",
          "version"
        ],
        "type": "object"
      },
      "CatalogProductCreate": {
        "additionalProperties": false,
        "properties": {
          "group_key": {
            "maxLength": 64,
            "minLength": 1,
            "type": [
              "string",
              "null"
            ]
          },
          "i18n": {
            "$ref": "#/components/schemas/CatalogI18nInput"
          },
          "slug": {
            "pattern": "^[a-z0-9][a-z0-9-]{1,63}$",
            "type": "string"
          },
          "sort": {
            "maximum": 1000000,
            "minimum": -1000000,
            "type": "integer"
          },
          "source_locale": {
            "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
            "type": "string"
          },
          "status": {
            "enum": [
              "draft",
              "active"
            ],
            "type": "string"
          }
        },
        "required": [
          "slug",
          "source_locale",
          "i18n"
        ],
        "type": "object"
      },
      "CatalogProductPage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/CatalogProduct"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "CatalogProductPatch": {
        "additionalProperties": false,
        "properties": {
          "group_key": {
            "maxLength": 64,
            "minLength": 1,
            "type": [
              "string",
              "null"
            ]
          },
          "i18n": {
            "$ref": "#/components/schemas/CatalogI18nInput"
          },
          "slug": {
            "pattern": "^[a-z0-9][a-z0-9-]{1,63}$",
            "type": "string"
          },
          "sort": {
            "maximum": 1000000,
            "minimum": -1000000,
            "type": "integer"
          },
          "source_locale": {
            "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
            "type": "string"
          },
          "status": {
            "enum": [
              "draft",
              "active",
              "archived"
            ],
            "type": "string"
          }
        },
        "type": "object"
      },
      "CatalogWarning": {
        "description": "Advice only: the save went through",
        "properties": {
          "code": {
            "enum": [
              "catalog.tags_without_nodes"
            ],
            "type": "string"
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "code",
          "tags"
        ],
        "type": "object"
      },
      "CommerceChannel": {
        "allOf": [
          {
            "$ref": "#/components/schemas/CommercePublicChannel"
          },
          {
            "properties": {
              "config": {
                "additionalProperties": {},
                "type": "object"
              },
              "name": {
                "type": "string"
              },
              "secret_set": {
                "type": "boolean"
              },
              "sort": {
                "type": "integer"
              },
              "status": {
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "name",
              "status",
              "sort",
              "config",
              "secret_set",
              "version"
            ],
            "type": "object"
          }
        ]
      },
      "CommerceOrder": {
        "properties": {
          "balance_applied_minor": {
            "pattern": "^\\d{1,18}$",
            "type": "string"
          },
          "closed_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "discount_minor": {
            "pattern": "^\\d{1,18}$",
            "type": "string"
          },
          "expires_at": {
            "format": "date-time",
            "type": "string"
          },
          "fee_minor": {
            "pattern": "^\\d{1,18}$",
            "type": "string"
          },
          "gift_applied_minor": {
            "pattern": "^\\d{1,18}$",
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "order_no": {
            "type": "string"
          },
          "origin": {
            "type": "string"
          },
          "paid_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "paid_minor": {
            "pattern": "^\\d{1,18}$",
            "type": "string"
          },
          "plan_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "refund_state": {
            "type": "string"
          },
          "refunded_minor": {
            "pattern": "^\\d{1,18}$",
            "type": "string"
          },
          "related": {
            "properties": {
              "order_no": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "subscription_status": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "user_email_masked": {
                "type": "string"
              },
              "user_public_id": {
                "type": "string"
              }
            },
            "required": [
              "user_public_id",
              "user_email_masked",
              "order_no",
              "subscription_status"
            ],
            "type": [
              "object",
              "null"
            ]
          },
          "result_subscription_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "snapshot": {
            "additionalProperties": {},
            "type": "object"
          },
          "status": {
            "type": "string"
          },
          "subtotal_minor": {
            "pattern": "^\\d{1,18}$",
            "type": "string"
          },
          "target_subscription_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "total_minor": {
            "pattern": "^\\d{1,18}$",
            "type": "string"
          },
          "user_id": {
            "format": "uuid",
            "type": "string"
          },
          "version": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "related",
          "order_no",
          "user_id",
          "kind",
          "origin",
          "status",
          "refund_state",
          "currency",
          "subtotal_minor",
          "discount_minor",
          "gift_applied_minor",
          "balance_applied_minor",
          "fee_minor",
          "total_minor",
          "paid_minor",
          "refunded_minor",
          "plan_id",
          "target_subscription_id",
          "result_subscription_id",
          "snapshot",
          "expires_at",
          "paid_at",
          "created_at",
          "closed_at",
          "version"
        ],
        "type": "object"
      },
      "CommercePayment": {
        "properties": {
          "amount_minor": {
            "pattern": "^\\d{1,18}$",
            "type": "string"
          },
          "attempt_no": {
            "type": "integer"
          },
          "channel_id": {
            "format": "uuid",
            "type": "string"
          },
          "checkout": {
            "oneOf": [
              {
                "properties": {
                  "type": {
                    "enum": [
                      "redirect"
                    ],
                    "type": "string"
                  },
                  "url": {
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "url"
                ],
                "type": "object"
              },
              {
                "properties": {
                  "content": {
                    "type": "string"
                  },
                  "type": {
                    "enum": [
                      "qr"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "content"
                ],
                "type": "object"
              },
              {
                "properties": {
                  "fields": {
                    "additionalProperties": {
                      "type": "string"
                    },
                    "type": "object"
                  },
                  "type": {
                    "enum": [
                      "form_post"
                    ],
                    "type": "string"
                  },
                  "url": {
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "url",
                  "fields"
                ],
                "type": "object"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "expires_at": {
            "format": "date-time",
            "type": "string"
          },
          "fx_rate": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "order_id": {
            "format": "uuid",
            "type": "string"
          },
          "provider_payment_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "related": {
            "properties": {
              "order_no": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "subscription_status": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "user_email_masked": {
                "type": "string"
              },
              "user_public_id": {
                "type": "string"
              }
            },
            "required": [
              "user_public_id",
              "user_email_masked",
              "order_no",
              "subscription_status"
            ],
            "type": [
              "object",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "succeeded_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "version": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "related",
          "order_id",
          "channel_id",
          "attempt_no",
          "status",
          "currency",
          "amount_minor",
          "fx_rate",
          "provider_payment_id",
          "checkout",
          "expires_at",
          "succeeded_at",
          "created_at",
          "version"
        ],
        "type": "object"
      },
      "CommercePaymentEvent": {
        "properties": {
          "channel_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "payment_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "provider_event_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "received_at": {
            "format": "date-time",
            "type": "string"
          },
          "reported_amount_minor": {
            "type": [
              "string",
              "null"
            ]
          },
          "reported_currency": {
            "type": [
              "string",
              "null"
            ]
          },
          "reported_status": {
            "type": [
              "string",
              "null"
            ]
          },
          "result": {
            "type": [
              "string",
              "null"
            ]
          },
          "signature_valid": {
            "type": "boolean"
          },
          "source": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "channel_id",
          "payment_id",
          "source",
          "provider_event_id",
          "signature_valid",
          "reported_status",
          "reported_amount_minor",
          "reported_currency",
          "result",
          "received_at"
        ],
        "type": "object"
      },
      "CommercePublicChannel": {
        "properties": {
          "currency": {
            "type": "string"
          },
          "fee_bps": {
            "type": "integer"
          },
          "fee_fixed_minor": {
            "pattern": "^\\d{1,18}$",
            "type": "string"
          },
          "i18n": {
            "additionalProperties": {},
            "type": "object"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "max_amount_minor": {
            "pattern": "^\\d{1,18}$",
            "type": [
              "string",
              "null"
            ]
          },
          "min_amount_minor": {
            "pattern": "^\\d{1,18}$",
            "type": [
              "string",
              "null"
            ]
          },
          "source_locale": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "kind",
          "i18n",
          "source_locale",
          "currency",
          "fee_bps",
          "fee_fixed_minor",
          "min_amount_minor",
          "max_amount_minor"
        ],
        "type": "object"
      },
      "CommerceQuote": {
        "properties": {
          "catalog": {
            "additionalProperties": {},
            "type": [
              "object",
              "null"
            ]
          },
          "coupons": {
            "items": {
              "properties": {
                "applicable": {
                  "type": "boolean"
                },
                "code_id": {
                  "format": "uuid",
                  "type": "string"
                },
                "discount_minor": {
                  "pattern": "^\\d{1,18}$",
                  "type": "string"
                },
                "reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "source": {
                  "type": "string"
                },
                "user_code_id": {
                  "format": "uuid",
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "user_code_id",
                "code_id",
                "source",
                "discount_minor",
                "applicable",
                "reason"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "currency": {
            "type": "string"
          },
          "discount_minor": {
            "pattern": "^\\d{1,18}$",
            "type": "string"
          },
          "fee_minor": {
            "pattern": "^\\d{1,18}$",
            "type": "string"
          },
          "fingerprint": {
            "type": "string"
          },
          "gift_applied_minor": {
            "pattern": "^\\d{1,18}$",
            "type": "string"
          },
          "subtotal_minor": {
            "pattern": "^\\d{1,18}$",
            "type": "string"
          },
          "total_minor": {
            "pattern": "^\\d{1,18}$",
            "type": "string"
          }
        },
        "required": [
          "currency",
          "subtotal_minor",
          "discount_minor",
          "gift_applied_minor",
          "fee_minor",
          "total_minor",
          "fingerprint",
          "coupons",
          "catalog"
        ],
        "type": "object"
      },
      "CommerceReceipt": {
        "properties": {
          "allocations": {
            "items": {
              "properties": {
                "amount_minor": {
                  "type": "string"
                },
                "channel": {},
                "payment_id": {
                  "format": "uuid",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "source": {
                  "enum": [
                    "gift",
                    "balance",
                    "online"
                  ],
                  "type": "string"
                }
              },
              "required": [
                "source",
                "amount_minor",
                "payment_id"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "currency": {
            "type": "string"
          },
          "item": {
            "properties": {
              "catalog": {},
              "discount_minor": {
                "type": "string"
              },
              "fee_minor": {
                "type": "string"
              },
              "plan_name": {
                "type": "string"
              },
              "quantity": {
                "enum": [
                  1
                ],
                "type": "number"
              },
              "unit_price_minor": {
                "type": "string"
              }
            },
            "required": [
              "plan_name",
              "quantity",
              "unit_price_minor",
              "discount_minor",
              "fee_minor"
            ],
            "type": "object"
          },
          "order_id": {
            "format": "uuid",
            "type": "string"
          },
          "order_no": {
            "type": "string"
          },
          "order_status": {
            "type": "string"
          },
          "paid_at": {
            "format": "date-time",
            "type": "string"
          },
          "status": {
            "enum": [
              "paid"
            ],
            "type": "string"
          },
          "total_minor": {
            "type": "string"
          }
        },
        "required": [
          "order_id",
          "order_no",
          "currency",
          "status",
          "paid_at",
          "order_status",
          "item",
          "total_minor",
          "allocations"
        ],
        "type": "object"
      },
      "CommerceRefund": {
        "properties": {
          "amount_minor": {
            "pattern": "^\\d{1,18}$",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "currency": {
            "type": "string"
          },
          "entitlement_action": {
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "method": {
            "type": "string"
          },
          "order_id": {
            "format": "uuid",
            "type": "string"
          },
          "payment_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "reason": {
            "type": "string"
          },
          "refund_no": {
            "type": "string"
          },
          "related": {
            "properties": {
              "order_no": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "subscription_status": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "user_email_masked": {
                "type": "string"
              },
              "user_public_id": {
                "type": "string"
              }
            },
            "required": [
              "user_public_id",
              "user_email_masked",
              "order_no",
              "subscription_status"
            ],
            "type": [
              "object",
              "null"
            ]
          },
          "status": {
            "type": "string"
          },
          "version": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "related",
          "refund_no",
          "order_id",
          "payment_id",
          "method",
          "amount_minor",
          "currency",
          "status",
          "reason",
          "entitlement_action",
          "created_at",
          "version"
        ],
        "type": "object"
      },
      "Coupon": {
        "properties": {
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "counters": {
            "description": "issued: issued coupons; reserved / redeemed: public code uses",
            "properties": {
              "issued": {
                "type": "integer"
              },
              "redeemed": {
                "type": "integer"
              },
              "reserved": {
                "type": "integer"
              }
            },
            "required": [
              "issued",
              "reserved",
              "redeemed"
            ],
            "type": "object"
          },
          "created_at": {
            "type": "string"
          },
          "created_by": {
            "format": "uuid",
            "type": "string"
          },
          "discount": {
            "$ref": "#/components/schemas/CouponDiscount"
          },
          "distribution": {
            "enum": [
              "public",
              "issued"
            ],
            "type": "string"
          },
          "ends_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "i18n": {
            "$ref": "#/components/schemas/CouponI18n"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "max_redemptions": {
            "type": [
              "integer",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "per_user_limit": {
            "type": "integer"
          },
          "recurring": {
            "$ref": "#/components/schemas/CouponRecurring"
          },
          "scope": {
            "$ref": "#/components/schemas/CouponScope"
          },
          "source_locale": {
            "type": "string"
          },
          "starts_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "enum": [
              "active",
              "disabled"
            ],
            "type": "string"
          },
          "valid_days": {
            "type": [
              "integer",
              "null"
            ]
          },
          "version": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "name",
          "distribution",
          "code",
          "status",
          "source_locale",
          "i18n",
          "discount",
          "scope",
          "recurring",
          "valid_days",
          "max_redemptions",
          "per_user_limit",
          "starts_at",
          "ends_at",
          "counters",
          "created_by",
          "created_at",
          "version"
        ],
        "type": "object"
      },
      "CouponCreate": {
        "additionalProperties": false,
        "properties": {
          "code": {
            "description": "Public coupons only: the text typed at checkout (stored upper-case)",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{3,31}$",
            "type": [
              "string",
              "null"
            ]
          },
          "discount": {
            "$ref": "#/components/schemas/CouponDiscountInput"
          },
          "distribution": {
            "enum": [
              "public",
              "issued"
            ],
            "type": "string"
          },
          "ends_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "i18n": {
            "$ref": "#/components/schemas/CouponI18nInput"
          },
          "max_redemptions": {
            "description": "Public: total uses; issued: coupons issued; null = unlimited",
            "maximum": 100000000,
            "minimum": 1,
            "type": [
              "integer",
              "null"
            ]
          },
          "name": {
            "description": "Staff-facing name",
            "maxLength": 64,
            "minLength": 1,
            "type": "string"
          },
          "per_user_limit": {
            "maximum": 1000,
            "minimum": 1,
            "type": "integer"
          },
          "recurring": {
            "$ref": "#/components/schemas/CouponRecurringInput"
          },
          "scope": {
            "$ref": "#/components/schemas/CouponScopeInput"
          },
          "source_locale": {
            "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
            "type": "string"
          },
          "starts_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "enum": [
              "active",
              "disabled"
            ],
            "type": "string"
          },
          "valid_days": {
            "description": "Issued coupons: days from issue",
            "maximum": 3650,
            "minimum": 1,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "name",
          "distribution",
          "source_locale",
          "i18n",
          "discount"
        ],
        "type": "object"
      },
      "CouponDetail": {
        "properties": {
          "code": {
            "type": [
              "string",
              "null"
            ]
          },
          "counters": {
            "description": "issued: issued coupons; reserved / redeemed: public code uses",
            "properties": {
              "issued": {
                "type": "integer"
              },
              "redeemed": {
                "type": "integer"
              },
              "reserved": {
                "type": "integer"
              }
            },
            "required": [
              "issued",
              "reserved",
              "redeemed"
            ],
            "type": "object"
          },
          "created_at": {
            "type": "string"
          },
          "created_by": {
            "format": "uuid",
            "type": "string"
          },
          "discount": {
            "$ref": "#/components/schemas/CouponDiscount"
          },
          "distribution": {
            "enum": [
              "public",
              "issued"
            ],
            "type": "string"
          },
          "ends_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "i18n": {
            "$ref": "#/components/schemas/CouponI18n"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "max_redemptions": {
            "type": [
              "integer",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "per_user_limit": {
            "type": "integer"
          },
          "recurring": {
            "$ref": "#/components/schemas/CouponRecurring"
          },
          "scope": {
            "$ref": "#/components/schemas/CouponScope"
          },
          "source_locale": {
            "type": "string"
          },
          "starts_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "enum": [
              "active",
              "disabled"
            ],
            "type": "string"
          },
          "usage": {
            "description": "Coupons of this definition in wallets, held by open orders, and used",
            "properties": {
              "available": {
                "type": "integer"
              },
              "consumed": {
                "type": "integer"
              },
              "reserved": {
                "type": "integer"
              }
            },
            "required": [
              "available",
              "reserved",
              "consumed"
            ],
            "type": "object"
          },
          "valid_days": {
            "type": [
              "integer",
              "null"
            ]
          },
          "version": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "name",
          "distribution",
          "code",
          "status",
          "source_locale",
          "i18n",
          "discount",
          "scope",
          "recurring",
          "valid_days",
          "max_redemptions",
          "per_user_limit",
          "starts_at",
          "ends_at",
          "counters",
          "created_by",
          "created_at",
          "version",
          "usage"
        ],
        "type": "object"
      },
      "CouponDiscount": {
        "oneOf": [
          {
            "properties": {
              "max_discount": {
                "$ref": "#/components/schemas/GrowthMoney"
              },
              "percent_bps": {
                "type": "integer"
              },
              "type": {
                "enum": [
                  "percent"
                ],
                "type": "string"
              }
            },
            "required": [
              "type",
              "percent_bps",
              "max_discount"
            ],
            "type": "object"
          },
          {
            "properties": {
              "amount": {
                "$ref": "#/components/schemas/GrowthMoney"
              },
              "type": {
                "enum": [
                  "amount"
                ],
                "type": "string"
              }
            },
            "required": [
              "type",
              "amount"
            ],
            "type": "object"
          }
        ]
      },
      "CouponDiscountInput": {
        "oneOf": [
          {
            "additionalProperties": false,
            "properties": {
              "max_discount": {
                "description": "Cap of the discount; null = none",
                "properties": {
                  "currency": {
                    "pattern": "^[A-Z]{3}$",
                    "type": "string"
                  },
                  "minor": {
                    "description": "Amount in minor units as a decimal string",
                    "pattern": "^(0|[1-9]\\d{0,17})$",
                    "type": "string"
                  }
                },
                "required": [
                  "currency",
                  "minor"
                ],
                "type": [
                  "object",
                  "null"
                ]
              },
              "percent_bps": {
                "description": "1000 = 10 % off",
                "maximum": 10000,
                "minimum": 1,
                "type": "integer"
              },
              "type": {
                "enum": [
                  "percent"
                ],
                "type": "string"
              }
            },
            "required": [
              "type",
              "percent_bps"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "amount": {
                "$ref": "#/components/schemas/GrowthMoney"
              },
              "type": {
                "enum": [
                  "amount"
                ],
                "type": "string"
              }
            },
            "required": [
              "type",
              "amount"
            ],
            "type": "object"
          }
        ]
      },
      "CouponI18n": {
        "additionalProperties": {
          "properties": {
            "_meta": {
              "properties": {
                "origin": {
                  "enum": [
                    "manual",
                    "machine",
                    "builtin"
                  ],
                  "type": "string"
                },
                "provider": {
                  "type": "string"
                }
              },
              "required": [
                "origin"
              ],
              "type": "object"
            },
            "description": {
              "type": "string"
            },
            "title": {
              "type": "string"
            }
          },
          "type": "object"
        },
        "type": "object"
      },
      "CouponI18nInput": {
        "additionalProperties": {
          "additionalProperties": false,
          "properties": {
            "_meta": {},
            "description": {
              "maxLength": 1000,
              "type": "string"
            },
            "title": {
              "maxLength": 100,
              "type": "string"
            }
          },
          "type": "object"
        },
        "description": "Full map `{ \"<locale>\": { title, description } }`; replaces the stored one",
        "type": "object"
      },
      "CouponIssue": {
        "additionalProperties": false,
        "properties": {
          "user_ids": {
            "description": "At most 100 users; larger audiences go through a bulk operation",
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "maxItems": 100,
            "minItems": 1,
            "type": "array"
          }
        },
        "required": [
          "user_ids"
        ],
        "type": "object"
      },
      "CouponIssueResult": {
        "description": "Batch result; partial success is not an error",
        "properties": {
          "results": {
            "items": {
              "properties": {
                "error": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "detail": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code"
                  ],
                  "type": "object"
                },
                "id": {
                  "description": "The issued coupon",
                  "format": "uuid",
                  "type": "string"
                },
                "index": {
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "succeeded",
                    "failed"
                  ],
                  "type": "string"
                }
              },
              "required": [
                "index",
                "status"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "summary": {
            "properties": {
              "failed": {
                "type": "integer"
              },
              "succeeded": {
                "type": "integer"
              }
            },
            "required": [
              "succeeded",
              "failed"
            ],
            "type": "object"
          }
        },
        "required": [
          "results",
          "summary"
        ],
        "type": "object"
      },
      "CouponPage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/Coupon"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "CouponPatch": {
        "additionalProperties": false,
        "properties": {
          "code": {
            "description": "Public coupons only",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{3,31}$",
            "type": "string"
          },
          "discount": {
            "$ref": "#/components/schemas/CouponDiscountInput"
          },
          "ends_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "i18n": {
            "$ref": "#/components/schemas/CouponI18nInput"
          },
          "max_redemptions": {
            "description": "Public: total uses; issued: coupons issued; null = unlimited",
            "maximum": 100000000,
            "minimum": 1,
            "type": [
              "integer",
              "null"
            ]
          },
          "name": {
            "description": "Staff-facing name",
            "maxLength": 64,
            "minLength": 1,
            "type": "string"
          },
          "per_user_limit": {
            "maximum": 1000,
            "minimum": 1,
            "type": "integer"
          },
          "recurring": {
            "$ref": "#/components/schemas/CouponRecurringInput"
          },
          "scope": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CouponScopeInput"
              },
              {
                "description": "Replaces the whole scope"
              }
            ]
          },
          "source_locale": {
            "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
            "type": "string"
          },
          "starts_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "description": "`disabled` stops new issue and public use",
            "enum": [
              "active",
              "disabled"
            ],
            "type": "string"
          },
          "valid_days": {
            "description": "Issued coupons: days from issue",
            "maximum": 3650,
            "minimum": 1,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "CouponPeriod": {
        "additionalProperties": false,
        "description": "A price option period, e.g. { unit: \"month\", count: 3 }",
        "properties": {
          "count": {
            "maximum": 3650,
            "minimum": 1,
            "type": "integer"
          },
          "unit": {
            "enum": [
              "day",
              "month",
              "year",
              "none"
            ],
            "type": "string"
          }
        },
        "required": [
          "unit",
          "count"
        ],
        "type": "object"
      },
      "CouponRecurring": {
        "properties": {
          "mode": {
            "enum": [
              "once",
              "periods",
              "forever"
            ],
            "type": "string"
          },
          "periods": {
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "mode",
          "periods"
        ],
        "type": "object"
      },
      "CouponRecurringInput": {
        "additionalProperties": false,
        "description": "once = this order only; periods = the first N billing periods; forever = while subscribed",
        "properties": {
          "mode": {
            "enum": [
              "once",
              "periods",
              "forever"
            ],
            "type": "string"
          },
          "periods": {
            "description": "`periods` mode: billing periods including the first one",
            "maximum": 120,
            "minimum": 2,
            "type": [
              "integer",
              "null"
            ]
          }
        },
        "required": [
          "mode"
        ],
        "type": "object"
      },
      "CouponScope": {
        "properties": {
          "first_order_only": {
            "type": "boolean"
          },
          "min_subtotal": {
            "$ref": "#/components/schemas/GrowthMoney"
          },
          "order_kinds": {
            "items": {
              "enum": [
                "purchase",
                "renewal",
                "traffic_reset",
                "plan_change"
              ],
              "type": "string"
            },
            "type": "array"
          },
          "periods": {
            "items": {
              "properties": {
                "count": {
                  "type": "integer"
                },
                "unit": {
                  "enum": [
                    "day",
                    "month",
                    "year",
                    "none"
                  ],
                  "type": "string"
                }
              },
              "required": [
                "unit",
                "count"
              ],
              "type": "object"
            },
            "type": [
              "array",
              "null"
            ]
          },
          "plan_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": [
              "array",
              "null"
            ]
          }
        },
        "required": [
          "plan_ids",
          "periods",
          "order_kinds",
          "min_subtotal",
          "first_order_only"
        ],
        "type": "object"
      },
      "CouponScopeInput": {
        "additionalProperties": false,
        "properties": {
          "first_order_only": {
            "type": "boolean"
          },
          "min_subtotal": {
            "$ref": "#/components/schemas/GrowthMoney"
          },
          "order_kinds": {
            "description": "Default purchase and renewal; top-ups are never discounted",
            "items": {
              "enum": [
                "purchase",
                "renewal",
                "traffic_reset",
                "plan_change"
              ],
              "type": "string"
            },
            "minItems": 1,
            "type": "array"
          },
          "periods": {
            "description": "null = every period",
            "items": {
              "$ref": "#/components/schemas/CouponPeriod"
            },
            "maxItems": 20,
            "minItems": 1,
            "type": [
              "array",
              "null"
            ]
          },
          "plan_ids": {
            "description": "null = every plan",
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "maxItems": 200,
            "minItems": 1,
            "type": [
              "array",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "File": {
        "properties": {
          "content_type": {
            "description": "Canonical type from content sniffing",
            "type": "string"
          },
          "created_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "deleted_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at": {
            "description": "Upload or verification deadline, restore deadline of a deleted file, export expiry",
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "filename": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "meta": {
            "additionalProperties": {},
            "description": "image {width, height}; package {platform, arch, version}",
            "type": "object"
          },
          "object_key": {
            "type": "string"
          },
          "owner_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "owner_type": {
            "enum": [
              "user",
              "staff",
              "system"
            ],
            "type": "string"
          },
          "purpose": {
            "enum": [
              "site_asset",
              "image",
              "package",
              "ticket_attachment",
              "receipt",
              "export"
            ],
            "type": "string"
          },
          "ready_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "reject_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "sha256": {
            "description": "SHA-256, lower-case hex",
            "pattern": "^[0-9a-f]{64}$",
            "type": [
              "string",
              "null"
            ]
          },
          "size": {
            "description": "Bytes as a decimal string",
            "example": "1048576",
            "pattern": "^\\d{1,15}$",
            "type": "string"
          },
          "status": {
            "enum": [
              "uploading",
              "verifying",
              "ready",
              "rejected",
              "deleted"
            ],
            "type": "string"
          },
          "upload": {
            "$ref": "#/components/schemas/FileUploadState"
          },
          "url": {
            "description": "Public URL, or the authenticated download route of a private file",
            "type": "string"
          },
          "visibility": {
            "enum": [
              "public",
              "private"
            ],
            "type": "string"
          }
        },
        "required": [
          "id",
          "purpose",
          "visibility",
          "status",
          "filename",
          "content_type",
          "size",
          "sha256",
          "url",
          "object_key",
          "meta",
          "reject_reason",
          "owner_type",
          "owner_id",
          "created_at",
          "ready_at",
          "deleted_at",
          "expires_at",
          "upload"
        ],
        "type": "object"
      },
      "FileDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/File"
          },
          {
            "properties": {
              "references": {
                "description": "Possible reference locations",
                "items": {
                  "properties": {
                    "location": {
                      "type": "string"
                    },
                    "source": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "source",
                    "location"
                  ],
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "references"
            ],
            "type": "object"
          }
        ]
      },
      "FilePage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/File"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "FilePartResult": {
        "properties": {
          "etag": {
            "type": "string"
          },
          "part_number": {
            "type": "integer"
          },
          "received_parts": {
            "type": "integer"
          },
          "size": {
            "description": "Bytes as a decimal string",
            "example": "1048576",
            "pattern": "^\\d{1,15}$",
            "type": "string"
          }
        },
        "required": [
          "part_number",
          "etag",
          "size",
          "received_parts"
        ],
        "type": "object"
      },
      "FileUploadComplete": {
        "properties": {
          "parts": {
            "description": "Parts as recorded by the client; when sent they must match the received parts",
            "items": {
              "properties": {
                "etag": {
                  "maxLength": 256,
                  "minLength": 1,
                  "type": "string"
                },
                "part_number": {
                  "maximum": 10000,
                  "minimum": 1,
                  "type": "integer"
                }
              },
              "required": [
                "part_number",
                "etag"
              ],
              "type": "object"
            },
            "maxItems": 10000,
            "type": "array"
          }
        },
        "type": "object"
      },
      "FileUploadCreate": {
        "properties": {
          "content_type": {
            "description": "Declared MIME type (pre-check only)",
            "maxLength": 255,
            "type": [
              "string",
              "null"
            ]
          },
          "filename": {
            "maxLength": 1024,
            "minLength": 1,
            "type": "string"
          },
          "purpose": {
            "enum": [
              "site_asset",
              "image",
              "package",
              "ticket_attachment",
              "receipt"
            ],
            "type": "string"
          },
          "sha256": {
            "description": "SHA-256 of the whole file, verified on completion",
            "pattern": "^[0-9a-f]{64}$",
            "type": [
              "string",
              "null"
            ]
          },
          "size": {
            "description": "Bytes as a decimal string",
            "example": "1048576",
            "pattern": "^\\d{1,15}$",
            "type": "string"
          }
        },
        "required": [
          "purpose",
          "filename",
          "size"
        ],
        "type": "object"
      },
      "FileUploadState": {
        "properties": {
          "expires_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "part_count": {
            "type": "integer"
          },
          "part_size": {
            "description": "null: single part (`parts/1` carries the whole file)",
            "example": "1048576",
            "pattern": "^\\d{1,15}$",
            "type": [
              "string",
              "null"
            ]
          },
          "received_parts": {
            "description": "Parts stored so far; a resuming client sends only the missing ones",
            "items": {
              "properties": {
                "etag": {
                  "type": "string"
                },
                "part_number": {
                  "type": "integer"
                },
                "size": {
                  "description": "Bytes as a decimal string",
                  "example": "1048576",
                  "pattern": "^\\d{1,15}$",
                  "type": "string"
                }
              },
              "required": [
                "part_number",
                "etag",
                "size"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "part_size",
          "part_count",
          "received_parts",
          "expires_at"
        ],
        "type": [
          "object",
          "null"
        ]
      },
      "GrowthMoney": {
        "properties": {
          "currency": {
            "pattern": "^[A-Z]{3}$",
            "type": "string"
          },
          "minor": {
            "description": "Amount in minor units as a decimal string",
            "pattern": "^(0|[1-9]\\d{0,17})$",
            "type": "string"
          }
        },
        "required": [
          "currency",
          "minor"
        ],
        "type": [
          "object",
          "null"
        ]
      },
      "HardwareDevicePolicy": {
        "properties": {
          "mode": {
            "enum": [
              "ip",
              "hwid",
              "both"
            ],
            "type": "string"
          },
          "version": {
            "type": "integer"
          }
        },
        "required": [
          "mode",
          "version"
        ],
        "type": "object"
      },
      "HardwareDevices": {
        "allOf": [
          {
            "$ref": "#/components/schemas/HardwareDevicePolicy"
          },
          {
            "properties": {
              "items": {
                "items": {
                  "properties": {
                    "device_key": {
                      "type": "string"
                    },
                    "expires_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "first_seen_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "hwid_masked": {
                      "type": "string"
                    },
                    "last_seen_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "limited": {
                      "type": "boolean"
                    },
                    "reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "revoked_until": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "device_key",
                    "hwid_masked",
                    "limited",
                    "reason",
                    "first_seen_at",
                    "last_seen_at",
                    "expires_at",
                    "revoked_until"
                  ],
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "items"
            ],
            "type": "object"
          }
        ]
      },
      "Health": {
        "properties": {
          "status": {
            "enum": [
              "ok"
            ],
            "type": "string"
          }
        },
        "required": [
          "status"
        ],
        "type": "object"
      },
      "InboxMessage": {
        "properties": {
          "body_md": {
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "read_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "title",
          "body_md",
          "read_at",
          "created_at"
        ],
        "type": "object"
      },
      "InboxUnreadCount": {
        "properties": {
          "unread_count": {
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "unread_count"
        ],
        "type": "object"
      },
      "InstallRequest": {
        "additionalProperties": false,
        "properties": {
          "install_token": {
            "default": "",
            "maxLength": 1024,
            "type": "string"
          },
          "root": {
            "additionalProperties": false,
            "properties": {
              "email": {
                "format": "email",
                "maxLength": 254,
                "type": "string"
              },
              "locale": {
                "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
                "type": "string"
              },
              "name": {
                "maxLength": 64,
                "minLength": 1,
                "type": "string"
              },
              "password": {
                "maxLength": 128,
                "minLength": 8,
                "type": "string"
              }
            },
            "required": [
              "email",
              "password",
              "name"
            ],
            "type": "object"
          },
          "site": {
            "additionalProperties": false,
            "properties": {
              "currency": {
                "default": "USD",
                "pattern": "^[A-Z]{3}$",
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "source_locale": {
                "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
                "type": "string"
              },
              "timezone": {
                "maxLength": 64,
                "minLength": 1,
                "type": "string"
              }
            },
            "required": [
              "name",
              "timezone"
            ],
            "type": "object"
          }
        },
        "required": [
          "site",
          "root"
        ],
        "type": "object"
      },
      "InstallResponse": {
        "properties": {
          "completed_at": {
            "type": "string"
          },
          "root_user_id": {
            "type": "string"
          },
          "state": {
            "enum": [
              "completed"
            ],
            "type": "string"
          }
        },
        "required": [
          "state",
          "completed_at",
          "root_user_id"
        ],
        "type": "object"
      },
      "InstallStatus": {
        "properties": {
          "completed_at": {
            "description": "ISO-8601; null while pending",
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "enum": [
              "pending",
              "completed"
            ],
            "type": "string"
          },
          "wizard": {
            "description": "What the wizard form needs; null once installed",
            "properties": {
              "defaults": {
                "properties": {
                  "currency": {
                    "type": "string"
                  },
                  "site_name": {
                    "type": "string"
                  },
                  "source_locale": {
                    "type": "string"
                  },
                  "timezone": {
                    "type": "string"
                  }
                },
                "required": [
                  "site_name",
                  "currency",
                  "timezone",
                  "source_locale"
                ],
                "type": "object"
              },
              "master_keys_configured": {
                "type": "boolean"
              },
              "password_policy": {
                "properties": {
                  "max_length": {
                    "type": "integer"
                  },
                  "min_length": {
                    "type": "integer"
                  }
                },
                "required": [
                  "min_length",
                  "max_length"
                ],
                "type": "object"
              }
            },
            "required": [
              "defaults",
              "password_policy",
              "master_keys_configured"
            ],
            "type": [
              "object",
              "null"
            ]
          }
        },
        "required": [
          "state",
          "completed_at",
          "wizard"
        ],
        "type": "object"
      },
      "Invitation": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "expires_at": {
            "format": "date-time",
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "inviter_id": {
            "format": "uuid",
            "type": "string"
          },
          "role": {
            "type": "string"
          },
          "status": {
            "enum": [
              "pending",
              "accepted",
              "rejected",
              "canceled"
            ],
            "type": "string"
          }
        },
        "required": [
          "id",
          "email",
          "role",
          "status",
          "expires_at",
          "inviter_id",
          "created_at"
        ],
        "type": "object"
      },
      "InvitationAccepted": {
        "properties": {
          "changed": {
            "type": "boolean"
          },
          "roles": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "roles",
          "changed"
        ],
        "type": "object"
      },
      "InvitationCreate": {
        "additionalProperties": false,
        "properties": {
          "email": {
            "format": "email",
            "maxLength": 254,
            "type": "string"
          },
          "role": {
            "default": "customer",
            "pattern": "^[a-z][a-z0-9_]{1,31}$",
            "type": "string"
          }
        },
        "required": [
          "email"
        ],
        "type": "object"
      },
      "InvitationList": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/Invitation"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "Job": {
        "properties": {
          "attempts": {
            "type": "integer"
          },
          "created_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "dedupe_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "finished_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "lease_expires_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "max_attempts": {
            "type": "integer"
          },
          "priority": {
            "type": "integer"
          },
          "queue": {
            "enum": [
              "default",
              "heavy"
            ],
            "type": "string"
          },
          "request_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "run_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "status": {
            "enum": [
              "pending",
              "running",
              "succeeded",
              "dead",
              "cancelled"
            ],
            "type": "string"
          },
          "updated_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "kind",
          "queue",
          "status",
          "priority",
          "attempts",
          "max_attempts",
          "run_at",
          "dedupe_key",
          "last_error",
          "request_id",
          "lease_expires_at",
          "created_at",
          "updated_at",
          "finished_at"
        ],
        "type": "object"
      },
      "JobDetail": {
        "description": "Payload redacted by the job kind",
        "properties": {
          "attempts": {
            "type": "integer"
          },
          "created_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "dedupe_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "finished_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "lease_expires_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "max_attempts": {
            "type": "integer"
          },
          "payload": {
            "description": "JSON value"
          },
          "priority": {
            "type": "integer"
          },
          "progress": {
            "description": "JSON value"
          },
          "queue": {
            "enum": [
              "default",
              "heavy"
            ],
            "type": "string"
          },
          "request_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "run_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "status": {
            "enum": [
              "pending",
              "running",
              "succeeded",
              "dead",
              "cancelled"
            ],
            "type": "string"
          },
          "updated_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "kind",
          "queue",
          "status",
          "priority",
          "attempts",
          "max_attempts",
          "run_at",
          "dedupe_key",
          "last_error",
          "request_id",
          "lease_expires_at",
          "created_at",
          "updated_at",
          "finished_at"
        ],
        "type": "object"
      },
      "JobPage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/Job"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "JobReplayResult": {
        "properties": {
          "job": {
            "$ref": "#/components/schemas/JobDetail"
          },
          "outcome": {
            "description": "`superseded`: the dedupe key already had a pending job, so this job was cancelled instead",
            "enum": [
              "requeued",
              "superseded"
            ],
            "type": "string"
          }
        },
        "required": [
          "outcome",
          "job"
        ],
        "type": "object"
      },
      "JobStats": {
        "properties": {
          "kinds": {
            "items": {
              "properties": {
                "dead": {
                  "minimum": 0,
                  "type": "integer"
                },
                "failures_1h": {
                  "minimum": 0,
                  "type": "integer"
                },
                "kind": {
                  "type": "string"
                },
                "oldest_due_seconds": {
                  "minimum": 0,
                  "type": "number"
                },
                "pending": {
                  "minimum": 0,
                  "type": "integer"
                },
                "queue": {
                  "enum": [
                    "default",
                    "heavy"
                  ],
                  "type": "string"
                },
                "running": {
                  "minimum": 0,
                  "type": "integer"
                },
                "superseded_1h": {
                  "minimum": 0,
                  "type": "integer"
                }
              },
              "required": [
                "queue",
                "pending",
                "oldest_due_seconds",
                "running",
                "failures_1h",
                "dead",
                "superseded_1h",
                "kind"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "queues": {
            "items": {
              "properties": {
                "dead": {
                  "minimum": 0,
                  "type": "integer"
                },
                "failures_1h": {
                  "minimum": 0,
                  "type": "integer"
                },
                "oldest_due_seconds": {
                  "minimum": 0,
                  "type": "number"
                },
                "pending": {
                  "minimum": 0,
                  "type": "integer"
                },
                "queue": {
                  "enum": [
                    "default",
                    "heavy"
                  ],
                  "type": "string"
                },
                "running": {
                  "minimum": 0,
                  "type": "integer"
                },
                "superseded_1h": {
                  "minimum": 0,
                  "type": "integer"
                }
              },
              "required": [
                "queue",
                "pending",
                "oldest_due_seconds",
                "running",
                "failures_1h",
                "dead",
                "superseded_1h"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "queues",
          "kinds"
        ],
        "type": "object"
      },
      "LedgerMoney": {
        "properties": {
          "currency": {
            "example": "USD",
            "pattern": "^[A-Z]{3}$",
            "type": "string"
          },
          "minor": {
            "description": "Signed integer in minor units",
            "example": "1999",
            "pattern": "^-?\\d+$",
            "type": "string"
          }
        },
        "required": [
          "currency",
          "minor"
        ],
        "type": "object"
      },
      "MaintenanceState": {
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "retry_after_seconds": {
            "maximum": 86400,
            "minimum": 1,
            "type": "integer"
          },
          "version": {
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "enabled",
          "retry_after_seconds",
          "version"
        ],
        "type": "object"
      },
      "MasterKeyInventory": {
        "properties": {
          "active_version": {
            "type": "integer"
          },
          "auth_wrapped_records": {
            "type": "integer"
          },
          "hardware_live_versions": {
            "additionalProperties": {
              "type": "number"
            },
            "type": "object"
          },
          "hardware_presence_available": {
            "type": "boolean"
          },
          "hardware_versions": {
            "additionalProperties": {
              "type": "number"
            },
            "type": "object"
          },
          "malformed": {
            "type": "integer"
          },
          "old_ciphertexts": {
            "type": "integer"
          },
          "old_version": {
            "type": [
              "integer",
              "null"
            ]
          },
          "retirement_safe": {
            "type": "boolean"
          },
          "sources": {
            "additionalProperties": {
              "type": "number"
            },
            "type": "object"
          },
          "versions": {
            "additionalProperties": {
              "additionalProperties": {
                "type": "number"
              },
              "type": "object"
            },
            "type": "object"
          }
        },
        "required": [
          "active_version",
          "versions",
          "sources",
          "malformed",
          "hardware_versions",
          "hardware_presence_available",
          "hardware_live_versions",
          "auth_wrapped_records",
          "old_version",
          "old_ciphertexts",
          "retirement_safe"
        ],
        "type": "object"
      },
      "Me": {
        "properties": {
          "capabilities": {
            "description": "me.* capabilities of all roles",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "email_verified": {
            "type": "boolean"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "locale": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "public_id": {
            "type": "string"
          },
          "roles": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "staff": {
            "type": "boolean"
          },
          "status": {
            "type": "string"
          },
          "time_zone": {
            "type": [
              "string",
              "null"
            ]
          },
          "two_factor_enabled": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "public_id",
          "email",
          "email_verified",
          "name",
          "locale",
          "time_zone",
          "status",
          "two_factor_enabled",
          "roles",
          "staff",
          "capabilities",
          "created_at"
        ],
        "type": "object"
      },
      "MePatch": {
        "additionalProperties": false,
        "properties": {
          "locale": {
            "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
            "type": "string"
          },
          "name": {
            "maxLength": 64,
            "type": "string"
          },
          "time_zone": {
            "maxLength": 64,
            "minLength": 1,
            "type": [
              "string",
              "null"
            ]
          }
        },
        "type": "object"
      },
      "MyCoupon": {
        "properties": {
          "code": {
            "description": "The public code text, for code uses",
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "type": "string"
          },
          "description": {
            "type": [
              "string",
              "null"
            ]
          },
          "discount": {
            "$ref": "#/components/schemas/CouponDiscount"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "recurring": {
            "$ref": "#/components/schemas/UserCouponRecurring"
          },
          "reserved_order_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "scope": {
            "$ref": "#/components/schemas/CouponScope"
          },
          "source": {
            "enum": [
              "checkout",
              "admin",
              "bulk",
              "registration",
              "referral"
            ],
            "type": "string"
          },
          "status": {
            "enum": [
              "available",
              "reserved",
              "consumed",
              "released",
              "reversed",
              "expired",
              "revoked"
            ],
            "type": "string"
          },
          "subscription_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "title": {
            "type": "string"
          },
          "valid_from": {
            "type": [
              "string",
              "null"
            ]
          },
          "valid_until": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "status",
          "source",
          "discount",
          "scope",
          "recurring",
          "valid_from",
          "valid_until",
          "reserved_order_id",
          "subscription_id",
          "created_at",
          "title",
          "description",
          "code"
        ],
        "type": "object"
      },
      "MyCouponPage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/MyCoupon"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "MySubscription": {
        "properties": {
          "auto_renew": {
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "next_at": {
                "example": "2026-10-22T08:00:00.000Z",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "price_id": {
                "format": "uuid",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "enabled",
              "price_id",
              "next_at"
            ],
            "type": "object"
          },
          "created_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "deliverable": {
            "description": "Whether the subscription is active, within its validity window and below its traffic quota",
            "type": "boolean"
          },
          "end_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "ended_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "entitlement": {
            "properties": {
              "device_limit": {
                "description": "Effective limit (bonuses included); null = unlimited",
                "type": [
                  "integer",
                  "null"
                ]
              },
              "reset_on_renewal": {
                "type": "boolean"
              },
              "reset_policy": {
                "enum": [
                  "none",
                  "billing_cycle",
                  "calendar_month",
                  "calendar_year"
                ],
                "type": "string"
              },
              "speed_limit_mbps": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "traffic_quota_bytes": {
                "description": "null = unlimited",
                "example": "107374182400",
                "pattern": "^\\d{1,19}$",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "traffic_quota_bytes",
              "device_limit",
              "speed_limit_mbps",
              "reset_policy",
              "reset_on_renewal"
            ],
            "type": "object"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "plan": {
            "properties": {
              "code": {
                "type": "string"
              },
              "id": {
                "format": "uuid",
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "names": {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              "price": {
                "properties": {
                  "id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "period_count": {
                    "type": "integer"
                  },
                  "period_unit": {
                    "type": "string"
                  },
                  "perpetual": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "id",
                  "period_unit",
                  "period_count",
                  "perpetual"
                ],
                "type": [
                  "object",
                  "null"
                ]
              },
              "product_name": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "id",
              "code",
              "name",
              "names",
              "product_name",
              "version",
              "price"
            ],
            "type": "object"
          },
          "public_id": {
            "type": "string"
          },
          "queue": {
            "properties": {
              "expected_start_at": {
                "description": "null: after a permanent subscription (never)",
                "example": "2026-10-22T08:00:00.000Z",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "position": {
                "type": "integer"
              }
            },
            "required": [
              "position",
              "expected_start_at"
            ],
            "type": [
              "object",
              "null"
            ]
          },
          "source": {
            "enum": [
              "order",
              "code",
              "admin",
              "trial",
              "apple"
            ],
            "type": "string"
          },
          "status": {
            "enum": [
              "scheduled",
              "active",
              "exhausted",
              "expired",
              "cancelled",
              "refunded"
            ],
            "type": "string"
          },
          "suspended": {
            "type": "boolean"
          },
          "term": {
            "properties": {
              "anchor_at": {
                "example": "2026-10-22T08:00:00.000Z",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "end_at": {
                "example": "2026-10-22T08:00:00.000Z",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "perpetual": {
                "type": "boolean"
              },
              "start_at": {
                "example": "2026-10-22T08:00:00.000Z",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "start_at",
              "end_at",
              "perpetual",
              "anchor_at"
            ],
            "type": "object"
          },
          "usage": {
            "properties": {
              "bonus_bytes": {
                "description": "Bytes as a decimal string",
                "example": "107374182400",
                "pattern": "^\\d{1,19}$",
                "type": "string"
              },
              "download_bytes": {
                "description": "Bytes as a decimal string",
                "example": "107374182400",
                "pattern": "^\\d{1,19}$",
                "type": "string"
              },
              "exhausted_at": {
                "example": "2026-10-22T08:00:00.000Z",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "period_end_at": {
                "example": "2026-10-22T08:00:00.000Z",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "period_seq": {
                "type": "integer"
              },
              "period_start_at": {
                "example": "2026-10-22T08:00:00.000Z",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "upload_bytes": {
                "description": "Bytes as a decimal string",
                "example": "107374182400",
                "pattern": "^\\d{1,19}$",
                "type": "string"
              },
              "used_bytes": {
                "description": "Bytes as a decimal string",
                "example": "107374182400",
                "pattern": "^\\d{1,19}$",
                "type": "string"
              }
            },
            "required": [
              "period_seq",
              "period_start_at",
              "period_end_at",
              "upload_bytes",
              "download_bytes",
              "used_bytes",
              "bonus_bytes",
              "exhausted_at"
            ],
            "type": "object"
          },
          "version": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "public_id",
          "status",
          "suspended",
          "deliverable",
          "source",
          "plan",
          "term",
          "entitlement",
          "usage",
          "queue",
          "auto_renew",
          "ended_at",
          "end_reason",
          "created_at",
          "version"
        ],
        "type": "object"
      },
      "MySubscriptionPage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/MySubscription"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "NetworkAgentToken": {
        "properties": {
          "expires_at": {
            "description": "Enrollment: token expiry. Rotation: end of the old token grace",
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "server_id": {
            "format": "uuid",
            "type": "string"
          },
          "token": {
            "description": "Shown once; null on an idempotent replay",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "server_id",
          "token",
          "expires_at"
        ],
        "type": "object"
      },
      "NetworkInbound": {
        "properties": {
          "billing_multiplier": {
            "example": "1.5000",
            "type": "string"
          },
          "created_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "credential": {
            "additionalProperties": {},
            "description": "Credential form users of this inbound need (derived per protocol from node_secret)",
            "properties": {
              "kind": {
                "enum": [
                  "uuid",
                  "password",
                  "uuid_password",
                  "username_password",
                  "ss2022_key"
                ],
                "type": "string"
              }
            },
            "required": [
              "kind"
            ],
            "type": "object"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "node_count": {
            "type": "integer"
          },
          "params": {
            "additionalProperties": {},
            "description": "Public parameters; stored secrets appear as { \"set\": true }",
            "type": "object"
          },
          "port": {
            "type": "integer"
          },
          "protocol": {
            "enum": [
              "vmess",
              "vless",
              "trojan",
              "shadowsocks",
              "hysteria2",
              "tuic",
              "anytls",
              "naive",
              "socks",
              "http"
            ],
            "type": "string"
          },
          "secret_paths": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "server_id": {
            "format": "uuid",
            "type": "string"
          },
          "status": {
            "enum": [
              "enabled",
              "disabled"
            ],
            "type": "string"
          },
          "transport_layer": {
            "enum": [
              "tcp",
              "udp",
              "tcp_udp"
            ],
            "type": "string"
          },
          "updated_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "version": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "server_id",
          "protocol",
          "port",
          "transport_layer",
          "status",
          "billing_multiplier",
          "params",
          "secret_paths",
          "credential",
          "node_count",
          "created_at",
          "updated_at",
          "version"
        ],
        "type": "object"
      },
      "NetworkInboundInput": {
        "additionalProperties": false,
        "properties": {
          "billing_multiplier": {
            "default": "1",
            "pattern": "^\\d{1,4}(\\.\\d{1,4})?$",
            "type": "string"
          },
          "params": {
            "additionalProperties": {},
            "default": {},
            "description": "Protocol parameters `{ transport?, security?, settings }` (GET /admin/network/protocols has the JSON Schema per protocol). Secrets: omit or send { \"set\": true } to keep, null to clear.",
            "type": "object"
          },
          "port": {
            "maximum": 65535,
            "minimum": 1,
            "type": "integer"
          },
          "protocol": {
            "enum": [
              "vmess",
              "vless",
              "trojan",
              "shadowsocks",
              "hysteria2",
              "tuic",
              "anytls",
              "naive",
              "socks",
              "http"
            ],
            "type": "string"
          },
          "status": {
            "default": "enabled",
            "enum": [
              "enabled",
              "disabled"
            ],
            "type": "string"
          },
          "transport_layer": {
            "description": "Default: the protocol's first allowed layer (e.g. udp for hysteria2)",
            "enum": [
              "tcp",
              "udp",
              "tcp_udp"
            ],
            "type": "string"
          }
        },
        "required": [
          "protocol",
          "port"
        ],
        "type": "object"
      },
      "NetworkInboundList": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/NetworkInbound"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": "null"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "NetworkInboundSecrets": {
        "properties": {
          "inbound_id": {
            "format": "uuid",
            "type": "string"
          },
          "secrets": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object"
          }
        },
        "required": [
          "inbound_id",
          "secrets"
        ],
        "type": "object"
      },
      "NetworkInboundStatusInput": {
        "additionalProperties": false,
        "properties": {
          "status": {
            "enum": [
              "enabled",
              "disabled"
            ],
            "type": "string"
          }
        },
        "required": [
          "status"
        ],
        "type": "object"
      },
      "NetworkNode": {
        "properties": {
          "address_family": {
            "enum": [
              "ipv4",
              "ipv6",
              "dual"
            ],
            "type": "string"
          },
          "client_overrides": {
            "additionalProperties": {},
            "type": "object"
          },
          "connect_host": {
            "type": "string"
          },
          "connect_port": {
            "type": [
              "integer",
              "null"
            ]
          },
          "created_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "inbound_id": {
            "format": "uuid",
            "type": "string"
          },
          "kind": {
            "enum": [
              "direct",
              "relay",
              "cdn"
            ],
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "name_i18n": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object"
          },
          "port": {
            "description": "connect_port, else the inbound port",
            "type": "integer"
          },
          "protocol": {
            "enum": [
              "vmess",
              "vless",
              "trojan",
              "shadowsocks",
              "hysteria2",
              "tuic",
              "anytls",
              "naive",
              "socks",
              "http"
            ],
            "type": "string"
          },
          "region_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "server_id": {
            "format": "uuid",
            "type": "string"
          },
          "server_name": {
            "type": "string"
          },
          "sort": {
            "type": "integer"
          },
          "system_tags": {
            "description": "Derived; filters and groups only, never authorizes",
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "transport_layer": {
            "enum": [
              "tcp",
              "udp",
              "tcp_udp"
            ],
            "type": "string"
          },
          "updated_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "version": {
            "type": "integer"
          },
          "visibility": {
            "enum": [
              "visible",
              "hidden",
              "disabled"
            ],
            "type": "string"
          }
        },
        "required": [
          "id",
          "inbound_id",
          "server_id",
          "server_name",
          "protocol",
          "transport_layer",
          "name",
          "name_i18n",
          "kind",
          "connect_host",
          "connect_port",
          "port",
          "address_family",
          "region_code",
          "tags",
          "system_tags",
          "client_overrides",
          "visibility",
          "sort",
          "created_at",
          "updated_at",
          "version"
        ],
        "type": "object"
      },
      "NetworkNodeInput": {
        "additionalProperties": false,
        "properties": {
          "address_family": {
            "default": "ipv4",
            "enum": [
              "ipv4",
              "ipv6",
              "dual"
            ],
            "type": "string"
          },
          "client_overrides": {
            "additionalProperties": false,
            "default": {},
            "properties": {
              "allow_insecure": {
                "type": "boolean"
              },
              "alpn": {
                "items": {
                  "enum": [
                    "h3",
                    "h2",
                    "http/1.1"
                  ],
                  "type": "string"
                },
                "maxItems": 3,
                "minItems": 1,
                "type": "array"
              },
              "fingerprint": {
                "enum": [
                  "chrome",
                  "firefox",
                  "safari",
                  "ios",
                  "android",
                  "edge",
                  "random",
                  "randomized"
                ],
                "type": "string"
              },
              "host": {
                "maxLength": 253,
                "type": "string"
              },
              "path": {
                "maxLength": 256,
                "pattern": "^\\/[\\x21-\\x7e]*$",
                "type": "string"
              },
              "server_name": {
                "maxLength": 253,
                "type": "string"
              },
              "service_name": {
                "maxLength": 128,
                "minLength": 1,
                "pattern": "^[A-Za-z0-9_./-]+$",
                "type": "string"
              }
            },
            "type": "object"
          },
          "connect_host": {
            "maxLength": 253,
            "type": "string"
          },
          "connect_port": {
            "default": null,
            "maximum": 65535,
            "minimum": 1,
            "type": [
              "integer",
              "null"
            ]
          },
          "inbound_id": {
            "format": "uuid",
            "type": "string"
          },
          "kind": {
            "default": "direct",
            "enum": [
              "direct",
              "relay",
              "cdn"
            ],
            "type": "string"
          },
          "name": {
            "maxLength": 64,
            "minLength": 1,
            "type": "string"
          },
          "name_i18n": {
            "additionalProperties": {
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            },
            "default": {},
            "type": "object"
          },
          "region_code": {
            "default": null,
            "pattern": "^[a-z][a-z0-9-]{0,31}$",
            "type": [
              "string",
              "null"
            ]
          },
          "sort": {
            "default": 0,
            "maximum": 1000000,
            "minimum": -1000000,
            "type": "integer"
          },
          "tags": {
            "default": [],
            "items": {
              "type": "string"
            },
            "maxItems": 64,
            "type": "array"
          },
          "visibility": {
            "default": "visible",
            "enum": [
              "visible",
              "hidden",
              "disabled"
            ],
            "type": "string"
          }
        },
        "required": [
          "inbound_id",
          "name",
          "connect_host"
        ],
        "type": "object"
      },
      "NetworkNodeList": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/NetworkNode"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "NetworkNodePage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/NetworkNode"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "NetworkNodeReorderInput": {
        "additionalProperties": false,
        "properties": {
          "items": {
            "items": {
              "additionalProperties": false,
              "properties": {
                "id": {
                  "format": "uuid",
                  "type": "string"
                },
                "sort": {
                  "maximum": 1000000,
                  "minimum": -1000000,
                  "type": "integer"
                }
              },
              "required": [
                "id",
                "sort"
              ],
              "type": "object"
            },
            "maxItems": 1000,
            "minItems": 1,
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "NetworkNodeReorderResult": {
        "properties": {
          "updated": {
            "type": "integer"
          }
        },
        "required": [
          "updated"
        ],
        "type": "object"
      },
      "NetworkNodeTagsInput": {
        "additionalProperties": false,
        "properties": {
          "add": {
            "default": [],
            "items": {
              "type": "string"
            },
            "maxItems": 64,
            "type": "array"
          },
          "node_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "maxItems": 1000,
            "minItems": 1,
            "type": "array"
          },
          "remove": {
            "default": [],
            "items": {
              "type": "string"
            },
            "maxItems": 64,
            "type": "array"
          }
        },
        "required": [
          "node_ids"
        ],
        "type": "object"
      },
      "NetworkNodeTagsResult": {
        "properties": {
          "updated": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "updated"
        ],
        "type": "object"
      },
      "NetworkProtocolList": {
        "properties": {
          "items": {
            "items": {
              "properties": {
                "params_schema": {
                  "description": "JSON Schema of `params` (input form)"
                },
                "protocol": {
                  "type": "string"
                },
                "secret_paths": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "title": {
                  "type": "string"
                },
                "transport_layers": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                }
              },
              "required": [
                "protocol",
                "title",
                "transport_layers",
                "secret_paths"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "NetworkRepublish": {
        "properties": {
          "changed": {
            "type": "boolean"
          },
          "hash": {
            "type": "string"
          },
          "revision": {
            "type": "integer"
          },
          "server_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "server_id",
          "changed",
          "revision",
          "hash"
        ],
        "type": "object"
      },
      "NetworkRuntimeDefaults": {
        "properties": {
          "runtime": {
            "additionalProperties": {},
            "description": "ip_strategy, dns, outbounds, routing_rules, block_rules",
            "type": "object"
          },
          "version": {
            "description": "network settings version (0 = code defaults)",
            "type": "integer"
          }
        },
        "required": [
          "runtime",
          "version"
        ],
        "type": "object"
      },
      "NetworkRuntimeDefaultsInput": {
        "additionalProperties": false,
        "properties": {
          "runtime": {
            "additionalProperties": false,
            "properties": {
              "block_rules": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "domains": {
                      "default": [],
                      "items": {
                        "maxLength": 253,
                        "minLength": 1,
                        "type": "string"
                      },
                      "maxItems": 1000,
                      "type": "array"
                    },
                    "ips": {
                      "default": [],
                      "items": {
                        "anyOf": [
                          {
                            "format": "ipv4-cidr",
                            "type": "string"
                          },
                          {
                            "format": "ipv6-cidr",
                            "type": "string"
                          },
                          {
                            "format": "ip",
                            "type": "string"
                          },
                          {
                            "format": "ip",
                            "type": "string"
                          }
                        ]
                      },
                      "maxItems": 1000,
                      "type": "array"
                    },
                    "protocols": {
                      "default": [],
                      "items": {
                        "enum": [
                          "http",
                          "tls",
                          "quic",
                          "bittorrent"
                        ],
                        "type": "string"
                      },
                      "maxItems": 4,
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "maxItems": 64,
                "type": "array"
              },
              "dns": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "address": {
                      "maxLength": 253,
                      "minLength": 1,
                      "type": "string"
                    },
                    "domains": {
                      "default": [],
                      "items": {
                        "maxLength": 253,
                        "minLength": 1,
                        "type": "string"
                      },
                      "maxItems": 1000,
                      "type": "array"
                    }
                  },
                  "required": [
                    "address"
                  ],
                  "type": "object"
                },
                "maxItems": 32,
                "type": "array"
              },
              "ip_strategy": {
                "enum": [
                  "as_is",
                  "prefer_ipv4",
                  "prefer_ipv6",
                  "ipv4_only",
                  "ipv6_only"
                ],
                "type": "string"
              },
              "outbounds": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "protocol": {
                      "enum": [
                        "direct",
                        "socks",
                        "http",
                        "shadowsocks",
                        "vless",
                        "vmess",
                        "trojan",
                        "wireguard"
                      ],
                      "type": "string"
                    },
                    "settings": {
                      "additionalProperties": {},
                      "default": {},
                      "type": "object"
                    },
                    "tag": {
                      "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$",
                      "type": "string"
                    }
                  },
                  "required": [
                    "tag",
                    "protocol"
                  ],
                  "type": "object"
                },
                "maxItems": 64,
                "type": "array"
              },
              "routing_rules": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "domains": {
                      "default": [],
                      "items": {
                        "maxLength": 253,
                        "minLength": 1,
                        "type": "string"
                      },
                      "maxItems": 1000,
                      "type": "array"
                    },
                    "ips": {
                      "default": [],
                      "items": {
                        "anyOf": [
                          {
                            "format": "ipv4-cidr",
                            "type": "string"
                          },
                          {
                            "format": "ipv6-cidr",
                            "type": "string"
                          },
                          {
                            "format": "ip",
                            "type": "string"
                          },
                          {
                            "format": "ip",
                            "type": "string"
                          }
                        ]
                      },
                      "maxItems": 1000,
                      "type": "array"
                    },
                    "network": {
                      "enum": [
                        "tcp",
                        "udp",
                        "tcp,udp"
                      ],
                      "type": "string"
                    },
                    "outbound": {
                      "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$",
                      "type": "string"
                    },
                    "ports": {
                      "pattern": "^\\d{1,5}(-\\d{1,5})?(,\\d{1,5}(-\\d{1,5})?)*$",
                      "type": "string"
                    },
                    "protocols": {
                      "default": [],
                      "items": {
                        "enum": [
                          "http",
                          "tls",
                          "quic",
                          "bittorrent"
                        ],
                        "type": "string"
                      },
                      "maxItems": 4,
                      "type": "array"
                    }
                  },
                  "required": [
                    "outbound"
                  ],
                  "type": "object"
                },
                "maxItems": 256,
                "type": "array"
              }
            },
            "required": [
              "ip_strategy",
              "dns",
              "outbounds",
              "routing_rules",
              "block_rules"
            ],
            "type": "object"
          }
        },
        "required": [
          "runtime"
        ],
        "type": "object"
      },
      "NetworkRuntimeOverridesInput": {
        "additionalProperties": false,
        "properties": {
          "overrides": {
            "additionalProperties": false,
            "properties": {
              "block_rules": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "domains": {
                      "default": [],
                      "items": {
                        "maxLength": 253,
                        "minLength": 1,
                        "type": "string"
                      },
                      "maxItems": 1000,
                      "type": "array"
                    },
                    "ips": {
                      "default": [],
                      "items": {
                        "anyOf": [
                          {
                            "format": "ipv4-cidr",
                            "type": "string"
                          },
                          {
                            "format": "ipv6-cidr",
                            "type": "string"
                          },
                          {
                            "format": "ip",
                            "type": "string"
                          },
                          {
                            "format": "ip",
                            "type": "string"
                          }
                        ]
                      },
                      "maxItems": 1000,
                      "type": "array"
                    },
                    "protocols": {
                      "default": [],
                      "items": {
                        "enum": [
                          "http",
                          "tls",
                          "quic",
                          "bittorrent"
                        ],
                        "type": "string"
                      },
                      "maxItems": 4,
                      "type": "array"
                    }
                  },
                  "type": "object"
                },
                "maxItems": 64,
                "type": "array"
              },
              "dns": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "address": {
                      "maxLength": 253,
                      "minLength": 1,
                      "type": "string"
                    },
                    "domains": {
                      "default": [],
                      "items": {
                        "maxLength": 253,
                        "minLength": 1,
                        "type": "string"
                      },
                      "maxItems": 1000,
                      "type": "array"
                    }
                  },
                  "required": [
                    "address"
                  ],
                  "type": "object"
                },
                "maxItems": 32,
                "type": "array"
              },
              "ip_strategy": {
                "enum": [
                  "as_is",
                  "prefer_ipv4",
                  "prefer_ipv6",
                  "ipv4_only",
                  "ipv6_only"
                ],
                "type": "string"
              },
              "outbounds": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "protocol": {
                      "enum": [
                        "direct",
                        "socks",
                        "http",
                        "shadowsocks",
                        "vless",
                        "vmess",
                        "trojan",
                        "wireguard"
                      ],
                      "type": "string"
                    },
                    "settings": {
                      "additionalProperties": {},
                      "default": {},
                      "type": "object"
                    },
                    "tag": {
                      "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$",
                      "type": "string"
                    }
                  },
                  "required": [
                    "tag",
                    "protocol"
                  ],
                  "type": "object"
                },
                "maxItems": 64,
                "type": "array"
              },
              "routing_rules": {
                "items": {
                  "additionalProperties": false,
                  "properties": {
                    "domains": {
                      "default": [],
                      "items": {
                        "maxLength": 253,
                        "minLength": 1,
                        "type": "string"
                      },
                      "maxItems": 1000,
                      "type": "array"
                    },
                    "ips": {
                      "default": [],
                      "items": {
                        "anyOf": [
                          {
                            "format": "ipv4-cidr",
                            "type": "string"
                          },
                          {
                            "format": "ipv6-cidr",
                            "type": "string"
                          },
                          {
                            "format": "ip",
                            "type": "string"
                          },
                          {
                            "format": "ip",
                            "type": "string"
                          }
                        ]
                      },
                      "maxItems": 1000,
                      "type": "array"
                    },
                    "network": {
                      "enum": [
                        "tcp",
                        "udp",
                        "tcp,udp"
                      ],
                      "type": "string"
                    },
                    "outbound": {
                      "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$",
                      "type": "string"
                    },
                    "ports": {
                      "pattern": "^\\d{1,5}(-\\d{1,5})?(,\\d{1,5}(-\\d{1,5})?)*$",
                      "type": "string"
                    },
                    "protocols": {
                      "default": [],
                      "items": {
                        "enum": [
                          "http",
                          "tls",
                          "quic",
                          "bittorrent"
                        ],
                        "type": "string"
                      },
                      "maxItems": 4,
                      "type": "array"
                    }
                  },
                  "required": [
                    "outbound"
                  ],
                  "type": "object"
                },
                "maxItems": 256,
                "type": "array"
              }
            },
            "type": "object"
          }
        },
        "required": [
          "overrides"
        ],
        "type": "object"
      },
      "NetworkServer": {
        "properties": {
          "access_checked_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "access_version": {
            "type": "integer"
          },
          "address": {
            "type": "string"
          },
          "agent": {
            "properties": {
              "enrollment_expires_at": {
                "example": "2026-10-22T08:00:00.000Z",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "last_error": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "last_seen_at": {
                "example": "2026-10-22T08:00:00.000Z",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "previous_token_valid_until": {
                "example": "2026-10-22T08:00:00.000Z",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "program": {
                "additionalProperties": {},
                "type": [
                  "object",
                  "null"
                ]
              },
              "status": {
                "enum": [
                  "pending",
                  "active",
                  "disabled"
                ],
                "type": "string"
              },
              "token_prefix": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "status",
              "token_prefix",
              "previous_token_valid_until",
              "enrollment_expires_at",
              "program",
              "last_seen_at",
              "last_error"
            ],
            "type": "object"
          },
          "applied": {
            "properties": {
              "at": {
                "example": "2026-10-22T08:00:00.000Z",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "hash": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "revision": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "revision",
              "hash",
              "at"
            ],
            "type": "object"
          },
          "country_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "desired": {
            "properties": {
              "hash": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "rendered_at": {
                "example": "2026-10-22T08:00:00.000Z",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "revision": {
                "type": "integer"
              }
            },
            "required": [
              "revision",
              "hash",
              "rendered_at"
            ],
            "type": "object"
          },
          "health": {
            "enum": [
              "unknown",
              "healthy",
              "degraded",
              "offline",
              "config_drift",
              "auth_failed",
              "protocol_conflict"
            ],
            "type": "string"
          },
          "health_changed_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "inbound_count": {
            "type": "integer"
          },
          "ip_geo_status": {
            "enum": [
              "ok",
              "unresolved",
              "manual"
            ],
            "type": "string"
          },
          "last_status": {
            "additionalProperties": {},
            "description": "Latest heartbeat sample (load, speed, connectivity)",
            "type": [
              "object",
              "null"
            ]
          },
          "last_status_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "node_count": {
            "type": "integer"
          },
          "region_code": {
            "type": [
              "string",
              "null"
            ]
          },
          "reported_ipv4": {
            "type": [
              "string",
              "null"
            ]
          },
          "reported_ipv6": {
            "type": [
              "string",
              "null"
            ]
          },
          "runtime_overrides": {
            "additionalProperties": {},
            "description": "Override patch over the network runtime defaults",
            "type": "object"
          },
          "sort": {
            "type": "integer"
          },
          "status": {
            "enum": [
              "active",
              "maintenance",
              "retired"
            ],
            "type": "string"
          },
          "updated_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "version": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "name",
          "region_code",
          "country_code",
          "ip_geo_status",
          "address",
          "status",
          "sort",
          "runtime_overrides",
          "agent",
          "health",
          "health_changed_at",
          "last_status",
          "last_status_at",
          "reported_ipv4",
          "reported_ipv6",
          "desired",
          "applied",
          "access_version",
          "access_checked_at",
          "inbound_count",
          "node_count",
          "created_at",
          "updated_at",
          "version"
        ],
        "type": "object"
      },
      "NetworkServerConfig": {
        "properties": {
          "applied": {
            "properties": {
              "at": {
                "example": "2026-10-22T08:00:00.000Z",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "hash": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "revision": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "required": [
              "revision",
              "hash",
              "at"
            ],
            "type": "object"
          },
          "defaults": {
            "additionalProperties": {},
            "type": "object"
          },
          "desired": {
            "properties": {
              "config": {
                "additionalProperties": {},
                "description": "Secrets appear as { \"$secret\": true }",
                "type": [
                  "object",
                  "null"
                ]
              },
              "hash": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "rendered_at": {
                "example": "2026-10-22T08:00:00.000Z",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "revision": {
                "type": "integer"
              }
            },
            "required": [
              "revision",
              "hash",
              "rendered_at",
              "config"
            ],
            "type": "object"
          },
          "effective": {
            "additionalProperties": {},
            "description": "defaults ⊕ overrides: what the next render sends",
            "type": "object"
          },
          "overrides": {
            "additionalProperties": {},
            "type": "object"
          },
          "server_id": {
            "format": "uuid",
            "type": "string"
          },
          "settings_version": {
            "type": "integer"
          },
          "version": {
            "description": "Server version (If-Match of PUT …/runtime)",
            "type": "integer"
          },
          "warnings": {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        },
        "required": [
          "server_id",
          "version",
          "defaults",
          "settings_version",
          "overrides",
          "effective",
          "desired",
          "applied",
          "warnings"
        ],
        "type": "object"
      },
      "NetworkServerHealth": {
        "properties": {
          "agent_status": {
            "enum": [
              "pending",
              "active",
              "disabled"
            ],
            "type": "string"
          },
          "applied_revision": {
            "type": [
              "integer",
              "null"
            ]
          },
          "current": {
            "properties": {
              "health": {
                "enum": [
                  "unknown",
                  "healthy",
                  "degraded",
                  "offline",
                  "config_drift",
                  "auth_failed",
                  "protocol_conflict"
                ],
                "type": "string"
              },
              "reasons": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            },
            "required": [
              "health",
              "reasons"
            ],
            "type": "object"
          },
          "desired_revision": {
            "type": "integer"
          },
          "health": {
            "enum": [
              "unknown",
              "healthy",
              "degraded",
              "offline",
              "config_drift",
              "auth_failed",
              "protocol_conflict"
            ],
            "type": "string"
          },
          "health_changed_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "inbound_results": {
            "items": {
              "additionalProperties": {},
              "type": "object"
            },
            "type": "array"
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "last_seen_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "last_status": {
            "additionalProperties": {},
            "type": [
              "object",
              "null"
            ]
          },
          "last_usage_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "server_id": {
            "format": "uuid",
            "type": "string"
          },
          "usage_silent": {
            "type": "boolean"
          }
        },
        "required": [
          "server_id",
          "health",
          "health_changed_at",
          "current",
          "agent_status",
          "last_seen_at",
          "desired_revision",
          "applied_revision",
          "inbound_results",
          "last_status",
          "usage_silent",
          "last_usage_at",
          "last_error"
        ],
        "type": "object"
      },
      "NetworkServerInput": {
        "additionalProperties": false,
        "properties": {
          "address": {
            "maxLength": 253,
            "type": "string"
          },
          "country_code": {
            "default": null,
            "pattern": "^[A-Z]{2}$",
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "maxLength": 64,
            "minLength": 1,
            "type": "string"
          },
          "region_code": {
            "default": null,
            "pattern": "^[a-z][a-z0-9-]{0,31}$",
            "type": [
              "string",
              "null"
            ]
          },
          "sort": {
            "default": 0,
            "maximum": 1000000,
            "minimum": -1000000,
            "type": "integer"
          },
          "status": {
            "default": "active",
            "enum": [
              "active",
              "maintenance"
            ],
            "type": "string"
          }
        },
        "required": [
          "name",
          "address"
        ],
        "type": "object"
      },
      "NetworkServerPage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/NetworkServer"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "NetworkServerStats": {
        "properties": {
          "current": {
            "properties": {
              "at": {
                "example": "2026-10-22T08:00:00.000Z",
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "rx_bps": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "tx_bps": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "rx_bps",
              "tx_bps",
              "at"
            ],
            "type": "object"
          },
          "date_from": {
            "type": "string"
          },
          "date_to": {
            "type": "string"
          },
          "days": {
            "items": {
              "properties": {
                "avg_bps": {
                  "description": "(rx + tx) ÷ covered seconds",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "conns_max": {
                  "type": "integer"
                },
                "covered_seconds": {
                  "type": "integer"
                },
                "cpu_avg": {
                  "type": [
                    "number",
                    "null"
                  ]
                },
                "cpu_max": {
                  "type": "number"
                },
                "date": {
                  "type": "string"
                },
                "max_bps": {
                  "description": "Larger per-direction 1-second peak",
                  "type": "string"
                },
                "mem_max": {
                  "type": "number"
                },
                "online_users_max": {
                  "type": "integer"
                },
                "rx_bytes": {
                  "type": "string"
                },
                "samples": {
                  "type": "integer"
                },
                "tx_bytes": {
                  "type": "string"
                }
              },
              "required": [
                "date",
                "samples",
                "covered_seconds",
                "rx_bytes",
                "tx_bytes",
                "avg_bps",
                "max_bps",
                "cpu_avg",
                "cpu_max",
                "mem_max",
                "conns_max",
                "online_users_max"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "max_daily_bytes_30d": {
            "type": "string"
          },
          "max_daily_date": {
            "type": [
              "string",
              "null"
            ]
          },
          "server_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "server_id",
          "date_from",
          "date_to",
          "days",
          "max_daily_bytes_30d",
          "max_daily_date",
          "current"
        ],
        "type": "object"
      },
      "NetworkTagChange": {
        "properties": {
          "nodes": {
            "type": "integer"
          },
          "plans": {
            "type": "integer"
          },
          "servers": {
            "description": "Servers queued for an access recompute",
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "type": "array"
          },
          "sources": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "subscriptions": {
            "type": "integer"
          },
          "target": {
            "type": "string"
          }
        },
        "required": [
          "target",
          "sources",
          "nodes",
          "plans",
          "subscriptions",
          "servers"
        ],
        "type": "object"
      },
      "NetworkTagImpact": {
        "properties": {
          "items": {
            "items": {
              "properties": {
                "active_subscriptions": {
                  "type": "integer"
                },
                "nodes": {
                  "type": "integer"
                },
                "plans": {
                  "type": "integer"
                },
                "subscriptions": {
                  "type": "integer"
                },
                "tag": {
                  "type": "string"
                }
              },
              "required": [
                "tag",
                "nodes",
                "plans",
                "subscriptions",
                "active_subscriptions"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "NetworkTagList": {
        "properties": {
          "items": {
            "items": {
              "properties": {
                "active_subscription_count": {
                  "type": "integer"
                },
                "display": {
                  "description": "Display names and colour from the network settings domain",
                  "properties": {
                    "color": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "names": {
                      "additionalProperties": {
                        "type": "string"
                      },
                      "type": "object"
                    }
                  },
                  "required": [
                    "names",
                    "color"
                  ],
                  "type": [
                    "object",
                    "null"
                  ]
                },
                "health": {
                  "description": "Nodes by their server's health",
                  "properties": {
                    "auth_failed": {
                      "type": "integer"
                    },
                    "config_drift": {
                      "type": "integer"
                    },
                    "degraded": {
                      "type": "integer"
                    },
                    "healthy": {
                      "type": "integer"
                    },
                    "offline": {
                      "type": "integer"
                    },
                    "protocol_conflict": {
                      "type": "integer"
                    },
                    "unknown": {
                      "type": "integer"
                    }
                  },
                  "type": "object"
                },
                "node_count": {
                  "type": "integer"
                },
                "plan_count": {
                  "type": "integer"
                },
                "system": {
                  "description": "Derived tag: filters and groups only, never authorizes",
                  "type": "boolean"
                },
                "tag": {
                  "type": "string"
                }
              },
              "required": [
                "tag",
                "system",
                "node_count",
                "plan_count",
                "active_subscription_count",
                "health",
                "display"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "NetworkTagMergeInput": {
        "additionalProperties": false,
        "properties": {
          "into": {
            "maxLength": 128,
            "type": "string"
          },
          "sources": {
            "items": {
              "maxLength": 128,
              "type": "string"
            },
            "maxItems": 64,
            "minItems": 1,
            "type": "array"
          }
        },
        "required": [
          "sources",
          "into"
        ],
        "type": "object"
      },
      "NetworkTagRenameInput": {
        "additionalProperties": false,
        "properties": {
          "from": {
            "maxLength": 128,
            "type": "string"
          },
          "to": {
            "maxLength": 128,
            "type": "string"
          }
        },
        "required": [
          "from",
          "to"
        ],
        "type": "object"
      },
      "NotificationPreferences": {
        "additionalProperties": false,
        "properties": {
          "billing": {
            "additionalProperties": false,
            "properties": {
              "email": {
                "type": "boolean"
              },
              "inbox": {
                "type": "boolean"
              },
              "sms": {
                "type": "boolean"
              },
              "telegram": {
                "type": "boolean"
              }
            },
            "type": "object"
          },
          "marketing": {
            "additionalProperties": false,
            "properties": {
              "email": {
                "type": "boolean"
              },
              "inbox": {
                "type": "boolean"
              },
              "sms": {
                "type": "boolean"
              },
              "telegram": {
                "type": "boolean"
              }
            },
            "type": "object"
          },
          "ops": {
            "additionalProperties": false,
            "properties": {
              "email": {
                "type": "boolean"
              },
              "inbox": {
                "type": "boolean"
              },
              "sms": {
                "type": "boolean"
              },
              "telegram": {
                "type": "boolean"
              }
            },
            "type": "object"
          }
        },
        "type": "object"
      },
      "NotifyDelivery": {
        "properties": {
          "attempts": {
            "type": "integer"
          },
          "category": {
            "enum": [
              "security",
              "billing",
              "service",
              "marketing",
              "ops"
            ],
            "type": "string"
          },
          "channel": {
            "enum": [
              "email",
              "sms",
              "telegram",
              "inbox"
            ],
            "type": "string"
          },
          "created_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "event_key": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "last_error": {
            "description": "Masked provider errors, one per tried provider",
            "type": [
              "string",
              "null"
            ]
          },
          "next_attempt_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "provider": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_message_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "recipient_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "recipient_type": {
            "enum": [
              "user",
              "staff",
              "address"
            ],
            "type": "string"
          },
          "sent_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "enum": [
              "pending",
              "sending",
              "sent",
              "failed",
              "suppressed",
              "dead"
            ],
            "type": "string"
          },
          "target": {
            "description": "Masked target, e.g. a***@example.com",
            "type": "string"
          },
          "template_key": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "event_key",
          "template_key",
          "category",
          "channel",
          "recipient_type",
          "recipient_id",
          "target",
          "status",
          "attempts",
          "next_attempt_at",
          "provider",
          "provider_message_id",
          "last_error",
          "created_at",
          "sent_at"
        ],
        "type": "object"
      },
      "NotifyDeliveryDetail": {
        "properties": {
          "attempts": {
            "type": "integer"
          },
          "category": {
            "enum": [
              "security",
              "billing",
              "service",
              "marketing",
              "ops"
            ],
            "type": "string"
          },
          "channel": {
            "enum": [
              "email",
              "sms",
              "telegram",
              "inbox"
            ],
            "type": "string"
          },
          "created_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "event_key": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "last_error": {
            "description": "Masked provider errors, one per tried provider",
            "type": [
              "string",
              "null"
            ]
          },
          "locale": {
            "type": [
              "string",
              "null"
            ]
          },
          "next_attempt_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "provider": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_message_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "recipient_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "recipient_type": {
            "enum": [
              "user",
              "staff",
              "address"
            ],
            "type": "string"
          },
          "retryable": {
            "description": "POST …/retry is possible",
            "type": "boolean"
          },
          "sent_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "enum": [
              "pending",
              "sending",
              "sent",
              "failed",
              "suppressed",
              "dead"
            ],
            "type": "string"
          },
          "target": {
            "description": "Masked target, e.g. a***@example.com",
            "type": "string"
          },
          "template_key": {
            "type": "string"
          },
          "time_zone": {
            "type": [
              "string",
              "null"
            ]
          },
          "values": {
            "additionalProperties": {},
            "description": "Template values; sensitive ones as ***",
            "type": "object"
          }
        },
        "required": [
          "id",
          "event_key",
          "template_key",
          "category",
          "channel",
          "recipient_type",
          "recipient_id",
          "target",
          "status",
          "attempts",
          "next_attempt_at",
          "provider",
          "provider_message_id",
          "last_error",
          "created_at",
          "sent_at",
          "locale",
          "time_zone",
          "values",
          "retryable"
        ],
        "type": "object"
      },
      "NotifyDeliveryPage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/NotifyDelivery"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "NotifyTemplate": {
        "properties": {
          "body": {
            "type": "string"
          },
          "builtin": {
            "description": "Built-in text of this locale, if any",
            "properties": {
              "body": {
                "type": "string"
              },
              "subject": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "subject",
              "body"
            ],
            "type": [
              "object",
              "null"
            ]
          },
          "category": {
            "enum": [
              "security",
              "billing",
              "service",
              "marketing",
              "ops"
            ],
            "type": "string"
          },
          "channel": {
            "enum": [
              "email",
              "sms",
              "telegram",
              "inbox"
            ],
            "type": "string"
          },
          "customized": {
            "description": "A stored row overrides the built-in text",
            "type": "boolean"
          },
          "description": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "locale": {
            "type": "string"
          },
          "origin": {
            "enum": [
              "manual",
              "machine",
              "builtin"
            ],
            "type": "string"
          },
          "subject": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "updated_by": {
            "type": [
              "string",
              "null"
            ]
          },
          "variables": {
            "items": {
              "properties": {
                "kind": {
                  "enum": [
                    "text",
                    "url",
                    "number",
                    "datetime",
                    "date",
                    "bytes",
                    "money"
                  ],
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "sample": {
                  "$ref": "#/components/schemas/NotifyVariableValue"
                },
                "sensitive": {
                  "description": "Masked in delivery records, erased after sending",
                  "type": "boolean"
                }
              },
              "required": [
                "name",
                "kind",
                "sensitive",
                "sample"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "version": {
            "description": "0 = the built-in text, never saved (If-Match \"v0\" creates)",
            "type": "integer"
          }
        },
        "required": [
          "key",
          "channel",
          "locale",
          "category",
          "description",
          "subject",
          "body",
          "origin",
          "version",
          "customized",
          "builtin",
          "variables",
          "updated_by",
          "updated_at"
        ],
        "type": "object"
      },
      "NotifyTemplateList": {
        "properties": {
          "has_more": {
            "enum": [
              false
            ],
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/NotifyTemplate"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": "null"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "NotifyTemplateUpdate": {
        "additionalProperties": false,
        "properties": {
          "body": {
            "maxLength": 100000,
            "type": "string"
          },
          "subject": {
            "maxLength": 255,
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "subject",
          "body"
        ],
        "type": "object"
      },
      "NotifyTestSend": {
        "additionalProperties": false,
        "properties": {
          "channel": {
            "default": "email",
            "enum": [
              "email",
              "sms",
              "telegram",
              "inbox"
            ],
            "type": "string"
          },
          "draft": {
            "additionalProperties": false,
            "description": "Unsaved text to render instead of the stored one",
            "properties": {
              "body": {
                "maxLength": 100000,
                "type": "string"
              },
              "subject": {
                "maxLength": 255,
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "subject",
              "body"
            ],
            "type": [
              "object",
              "null"
            ]
          },
          "dry_run": {
            "description": "Render only (preview)",
            "type": "boolean"
          },
          "key": {
            "maxLength": 100,
            "pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*){1,3}$",
            "type": "string"
          },
          "locale": {
            "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
            "type": "string"
          },
          "provider_id": {
            "description": "Send through this provider only (provider test; also requires notify.provider.manage)",
            "maxLength": 32,
            "type": [
              "string",
              "null"
            ]
          },
          "to": {
            "description": "Required unless dry_run; own verified email unless the actor holds notify.provider.manage",
            "format": "email",
            "maxLength": 254,
            "type": [
              "string",
              "null"
            ]
          },
          "values": {
            "additionalProperties": {
              "$ref": "#/components/schemas/NotifyVariableValue"
            },
            "description": "Overrides of the samples",
            "type": "object"
          }
        },
        "required": [
          "key",
          "locale"
        ],
        "type": "object"
      },
      "NotifyTestSendResult": {
        "properties": {
          "attempts": {
            "items": {
              "properties": {
                "error": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "outcome": {
                  "enum": [
                    "sent",
                    "failed",
                    "skipped"
                  ],
                  "type": "string"
                },
                "provider_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "type": {
                  "type": "string"
                }
              },
              "required": [
                "provider_id",
                "type",
                "outcome"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "locale": {
            "description": "Locale of the text used, after fallback",
            "type": "string"
          },
          "message_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "provider_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "rendered": {
            "properties": {
              "html": {
                "type": "string"
              },
              "subject": {
                "type": "string"
              },
              "text": {
                "type": "string"
              }
            },
            "required": [
              "subject",
              "text",
              "html"
            ],
            "type": "object"
          },
          "sent": {
            "description": "null for a dry run",
            "type": [
              "boolean",
              "null"
            ]
          },
          "target": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "rendered",
          "locale",
          "sent",
          "target",
          "provider_id",
          "message_id",
          "attempts"
        ],
        "type": "object"
      },
      "NotifyVariableValue": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "number"
          },
          {
            "properties": {
              "currency": {
                "type": "string"
              },
              "minor": {
                "type": "string"
              }
            },
            "required": [
              "minor",
              "currency"
            ],
            "type": "object"
          }
        ]
      },
      "OpsAlertRoute": {
        "additionalProperties": false,
        "properties": {
          "channels": {
            "items": {
              "enum": [
                "email",
                "sms",
                "telegram",
                "inbox"
              ],
              "type": "string"
            },
            "maxItems": 4,
            "minItems": 1,
            "type": "array"
          },
          "enabled": {
            "type": "boolean"
          },
          "exception_types": {
            "items": {
              "maxLength": 100,
              "minLength": 1,
              "type": "string"
            },
            "maxItems": 100,
            "type": "array"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "name": {
            "maxLength": 100,
            "minLength": 1,
            "type": "string"
          },
          "severities": {
            "items": {
              "enum": [
                "p1",
                "p2",
                "p3"
              ],
              "type": "string"
            },
            "maxItems": 3,
            "minItems": 1,
            "type": "array"
          },
          "staff_ids": {
            "items": {
              "format": "uuid",
              "type": "string"
            },
            "maxItems": 100,
            "minItems": 1,
            "type": "array"
          },
          "throttle_seconds": {
            "maximum": 86400,
            "minimum": 60,
            "type": "integer"
          },
          "version": {
            "type": "integer"
          }
        },
        "required": [
          "name",
          "enabled",
          "exception_types",
          "severities",
          "staff_ids",
          "channels",
          "throttle_seconds",
          "id",
          "version"
        ],
        "type": "object"
      },
      "OpsException": {
        "properties": {
          "events": {
            "description": "First occurrence and append-only handling history",
            "items": {
              "description": "JSON value"
            },
            "type": "array"
          },
          "fingerprint": {
            "type": "string"
          },
          "first_seen_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "last_seen_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "occurrences": {
            "type": "integer"
          },
          "owner_staff_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "resource_refs": {
            "items": {
              "properties": {
                "id": {
                  "type": "string"
                },
                "type": {
                  "type": "string"
                }
              },
              "required": [
                "type",
                "id"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "severity": {
            "enum": [
              "p1",
              "p2",
              "p3"
            ],
            "type": "string"
          },
          "source": {
            "type": "string"
          },
          "status": {
            "enum": [
              "open",
              "acknowledged",
              "muted",
              "resolved"
            ],
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "version": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "fingerprint",
          "source",
          "type",
          "severity",
          "status",
          "owner_staff_id",
          "resource_refs",
          "first_seen_at",
          "last_seen_at",
          "occurrences",
          "events",
          "version"
        ],
        "type": "object"
      },
      "OpsExceptionPage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/OpsException"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "OpsExport": {
        "properties": {
          "created_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "expires_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "filters": {
            "additionalProperties": {},
            "type": "object"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "kind": {
            "enum": [
              "orders",
              "payments",
              "users",
              "usage"
            ],
            "type": "string"
          },
          "operator_id": {
            "format": "uuid",
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "row_count": {
            "type": [
              "integer",
              "null"
            ]
          },
          "row_limit": {
            "type": "integer"
          },
          "status": {
            "enum": [
              "pending",
              "ready",
              "failed",
              "expired"
            ],
            "type": "string"
          },
          "truncated": {
            "type": "boolean"
          }
        },
        "required": [
          "id",
          "kind",
          "operator_id",
          "reason",
          "row_limit",
          "filters",
          "status",
          "row_count",
          "truncated",
          "created_at",
          "expires_at"
        ],
        "type": "object"
      },
      "PermissionCatalogue": {
        "properties": {
          "capabilities": {
            "items": {
              "properties": {
                "code": {
                  "type": "string"
                },
                "phase": {
                  "type": "string"
                }
              },
              "required": [
                "code",
                "phase"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "permissions": {
            "items": {
              "properties": {
                "code": {
                  "type": "string"
                },
                "module": {
                  "type": "string"
                },
                "phase": {
                  "type": "string"
                },
                "sensitive": {
                  "type": "boolean"
                }
              },
              "required": [
                "code",
                "module",
                "phase",
                "sensitive"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "permissions",
          "capabilities"
        ],
        "type": "object"
      },
      "PortalFileUploadCreate": {
        "allOf": [
          {
            "$ref": "#/components/schemas/FileUploadCreate"
          },
          {
            "properties": {
              "purpose": {
                "enum": [
                  "ticket_attachment"
                ],
                "type": "string"
              }
            },
            "type": "object"
          }
        ]
      },
      "Problem": {
        "description": "RFC 9457 problem details. Clients branch on `code`, never on `title` or `detail`.",
        "properties": {
          "code": {
            "description": "Stable `<module>.<reason>` code, see `x-error-codes`",
            "type": "string"
          },
          "current": {
            "additionalProperties": {},
            "description": "Current resource summary, only on 409 concurrency conflicts",
            "type": "object"
          },
          "detail": {
            "type": "string"
          },
          "details": {
            "additionalProperties": {},
            "type": "object"
          },
          "errors": {
            "description": "Per-field validation errors (422)",
            "items": {
              "properties": {
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                }
              },
              "required": [
                "path",
                "code"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "request_id": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "type": {
            "description": "`urn:error:<code>`",
            "type": "string"
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "code",
          "request_id"
        ],
        "type": "object"
      },
      "PublicCatalog": {
        "properties": {
          "locale": {
            "description": "Locale of the texts (also `Content-Language`)",
            "type": "string"
          },
          "products": {
            "items": {
              "$ref": "#/components/schemas/PublicCatalogProduct"
            },
            "type": "array"
          }
        },
        "required": [
          "locale",
          "products"
        ],
        "type": "object"
      },
      "PublicCatalogPlan": {
        "properties": {
          "code": {
            "type": "string"
          },
          "description_md": {
            "type": [
              "string",
              "null"
            ]
          },
          "device_limit": {
            "type": [
              "integer",
              "null"
            ]
          },
          "features": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "per_user_limit": {
            "type": [
              "integer",
              "null"
            ]
          },
          "prices": {
            "items": {
              "$ref": "#/components/schemas/PublicCatalogPrice"
            },
            "type": "array"
          },
          "reset_on_renewal": {
            "type": "boolean"
          },
          "reset_policy": {
            "enum": [
              "none",
              "billing_cycle",
              "calendar_month",
              "calendar_year"
            ],
            "type": "string"
          },
          "sold_out": {
            "type": "boolean"
          },
          "speed_limit_mbps": {
            "type": [
              "integer",
              "null"
            ]
          },
          "subtitle": {
            "type": [
              "string",
              "null"
            ]
          },
          "traffic_quota_bytes": {
            "description": "Bytes per period; null = unlimited",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "code",
          "name",
          "subtitle",
          "description_md",
          "features",
          "traffic_quota_bytes",
          "speed_limit_mbps",
          "device_limit",
          "reset_policy",
          "reset_on_renewal",
          "per_user_limit",
          "sold_out",
          "prices"
        ],
        "type": "object"
      },
      "PublicCatalogPrice": {
        "properties": {
          "amount": {
            "$ref": "#/components/schemas/CatalogMoney"
          },
          "compare_at": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CatalogMoney"
              },
              {
                "type": [
                  "object",
                  "null"
                ]
              }
            ]
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "period_count": {
            "type": "integer"
          },
          "period_unit": {
            "enum": [
              "day",
              "month",
              "year",
              "none"
            ],
            "type": "string"
          }
        },
        "required": [
          "id",
          "period_unit",
          "period_count",
          "amount",
          "compare_at"
        ],
        "type": "object"
      },
      "PublicCatalogProduct": {
        "properties": {
          "description_md": {
            "type": [
              "string",
              "null"
            ]
          },
          "features": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "group_key": {
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "plans": {
            "items": {
              "$ref": "#/components/schemas/PublicCatalogPlan"
            },
            "type": "array"
          },
          "slug": {
            "type": "string"
          },
          "subtitle": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "slug",
          "group_key",
          "name",
          "subtitle",
          "description_md",
          "features",
          "plans"
        ],
        "type": "object"
      },
      "PublicInvitation": {
        "properties": {
          "expires_at": {
            "format": "date-time",
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "inviter": {
            "description": "Masked display name or email of the inviter",
            "type": "string"
          },
          "kind": {
            "enum": [
              "customer",
              "staff"
            ],
            "type": "string"
          },
          "status": {
            "enum": [
              "pending",
              "accepted",
              "rejected",
              "canceled",
              "expired"
            ],
            "type": "string"
          }
        },
        "required": [
          "id",
          "inviter",
          "kind",
          "status",
          "expires_at"
        ],
        "type": "object"
      },
      "Readiness": {
        "properties": {
          "app_schema": {
            "type": "integer"
          },
          "app_schema_required": {
            "type": "integer"
          },
          "checks": {
            "additionalProperties": {
              "additionalProperties": {},
              "properties": {
                "ok": {
                  "type": "boolean"
                }
              },
              "required": [
                "ok"
              ],
              "type": "object"
            },
            "type": "object"
          },
          "db_min_app_schema": {
            "type": [
              "integer",
              "null"
            ]
          },
          "db_version": {
            "type": [
              "integer",
              "null"
            ]
          },
          "installed": {
            "type": [
              "boolean",
              "null"
            ]
          },
          "reason": {
            "description": "database_unavailable, not_migrated, database_too_old, code_too_old, not_installed or a check name",
            "type": "string"
          },
          "status": {
            "enum": [
              "ready",
              "not_ready"
            ],
            "type": "string"
          }
        },
        "required": [
          "status",
          "app_schema",
          "app_schema_required",
          "db_version",
          "db_min_app_schema",
          "installed"
        ],
        "type": "object"
      },
      "ReauthRequest": {
        "oneOf": [
          {
            "properties": {
              "method": {
                "enum": [
                  "password"
                ],
                "type": "string"
              },
              "password": {
                "maxLength": 128,
                "minLength": 1,
                "type": "string"
              }
            },
            "required": [
              "method",
              "password"
            ],
            "type": "object"
          },
          {
            "properties": {
              "code": {
                "pattern": "^\\d{6}$",
                "type": "string"
              },
              "method": {
                "enum": [
                  "totp"
                ],
                "type": "string"
              }
            },
            "required": [
              "method",
              "code"
            ],
            "type": "object"
          }
        ]
      },
      "ReauthResult": {
        "properties": {
          "mfa_verified_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "reauth_at": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "reauth_at",
          "mfa_verified_at"
        ],
        "type": "object"
      },
      "RepairCatalogue": {
        "properties": {
          "items": {
            "items": {
              "properties": {
                "allowed": {
                  "description": "Whether the caller holds the command permission",
                  "type": "boolean"
                },
                "command": {
                  "type": "string"
                },
                "description": {
                  "type": "string"
                },
                "input_schema": {
                  "description": "JSON Schema of `input`"
                },
                "permission": {
                  "type": "string"
                },
                "target_type": {
                  "type": "string"
                },
                "title": {
                  "type": "string"
                }
              },
              "required": [
                "command",
                "title",
                "description",
                "permission",
                "target_type",
                "allowed"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "RepairCommand": {
        "properties": {
          "command": {
            "type": "string"
          },
          "created_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "executed_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "expected_version": {
            "description": "Target fingerprint captured by the preview; send it back to execute",
            "type": [
              "string",
              "null"
            ]
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "input": {
            "description": "JSON value"
          },
          "operator_id": {
            "type": "string"
          },
          "preview_expires_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "request_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "result": {
            "description": "JSON value"
          },
          "status": {
            "enum": [
              "previewed",
              "executing",
              "succeeded",
              "partial",
              "failed",
              "expired"
            ],
            "type": "string"
          },
          "summary": {
            "description": "What execution will do"
          },
          "target": {
            "properties": {
              "id": {
                "type": "string"
              },
              "type": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "id"
            ],
            "type": "object"
          }
        },
        "required": [
          "id",
          "command",
          "target",
          "status",
          "expected_version",
          "reason",
          "operator_id",
          "request_id",
          "preview_expires_at",
          "created_at",
          "executed_at"
        ],
        "type": "object"
      },
      "RepairCommandPage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/RepairCommand"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "Role": {
        "properties": {
          "assignable": {
            "description": "Whether the caller’s codes include all of this role’s",
            "type": "boolean"
          },
          "kind": {
            "enum": [
              "static",
              "protected",
              "preset",
              "custom"
            ],
            "type": "string"
          },
          "permissions": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "role": {
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "role",
          "kind",
          "permissions",
          "assignable",
          "updated_at"
        ],
        "type": "object"
      },
      "RoleCreate": {
        "additionalProperties": false,
        "properties": {
          "permissions": {
            "items": {
              "maxLength": 64,
              "type": "string"
            },
            "maxItems": 200,
            "type": "array"
          },
          "role": {
            "pattern": "^[a-z][a-z0-9_]{1,31}$",
            "type": "string"
          }
        },
        "required": [
          "role",
          "permissions"
        ],
        "type": "object"
      },
      "RoleList": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/Role"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "RoleUpdate": {
        "additionalProperties": false,
        "properties": {
          "permissions": {
            "items": {
              "maxLength": 64,
              "type": "string"
            },
            "maxItems": 200,
            "type": "array"
          }
        },
        "required": [
          "permissions"
        ],
        "type": "object"
      },
      "SessionsRevoked": {
        "properties": {
          "sessions_revoked": {
            "type": "integer"
          }
        },
        "required": [
          "sessions_revoked"
        ],
        "type": "object"
      },
      "SettingsDocument": {
        "properties": {
          "domain": {
            "type": "string"
          },
          "updated_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "value": {
            "additionalProperties": {},
            "description": "Full document; secrets as { \"set\": boolean }",
            "type": "object"
          },
          "version": {
            "description": "0 until the domain is first saved (code defaults)",
            "type": "integer"
          }
        },
        "required": [
          "domain",
          "value",
          "version",
          "updated_at"
        ],
        "type": "object"
      },
      "SettingsDomainList": {
        "properties": {
          "items": {
            "items": {
              "properties": {
                "domain": {
                  "type": "string"
                },
                "owner": {
                  "type": "string"
                },
                "reauth": {
                  "type": "boolean"
                },
                "writable": {
                  "type": "boolean"
                }
              },
              "required": [
                "domain",
                "owner",
                "writable",
                "reauth"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "SettingsRevision": {
        "properties": {
          "base_version": {
            "maximum": 2147483647,
            "minimum": 0,
            "type": "integer"
          },
          "created_at": {
            "type": "string"
          },
          "domain": {
            "type": "string"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "published_at": {
            "type": [
              "string",
              "null"
            ]
          },
          "revision": {
            "maximum": 2147483647,
            "minimum": 0,
            "type": "integer"
          },
          "status": {
            "enum": [
              "draft",
              "published",
              "superseded",
              "rolled_back"
            ],
            "type": "string"
          },
          "value": {
            "additionalProperties": {},
            "type": "object"
          },
          "version": {
            "maximum": 2147483647,
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "domain",
          "revision",
          "version",
          "base_version",
          "status",
          "note",
          "created_at",
          "published_at",
          "value"
        ],
        "type": "object"
      },
      "SettingsRevisionDiff": {
        "properties": {
          "fields": {
            "items": {
              "properties": {
                "after": {},
                "before": {},
                "changed": {
                  "type": "boolean"
                },
                "path": {
                  "type": "string"
                },
                "secret": {
                  "type": "boolean"
                }
              },
              "required": [
                "path",
                "secret",
                "changed"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "published_version": {
            "maximum": 2147483647,
            "minimum": 0,
            "type": "integer"
          }
        },
        "required": [
          "published_version",
          "fields"
        ],
        "type": "object"
      },
      "SettingsUpdate": {
        "additionalProperties": false,
        "properties": {
          "value": {
            "additionalProperties": {},
            "description": "Full document; omitted secrets and { \"set\": … } markers keep the stored secret",
            "type": "object"
          }
        },
        "required": [
          "value"
        ],
        "type": "object"
      },
      "SiteInfo": {
        "properties": {
          "appearance": {
            "properties": {
              "brand_color": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "hero_glass": {
                "type": "boolean"
              },
              "theme_preset": {
                "type": "string"
              }
            },
            "required": [
              "theme_preset",
              "brand_color",
              "hero_glass"
            ],
            "type": "object"
          },
          "captcha": {
            "properties": {
              "scenes": {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              },
              "turnstile_site_key": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "scenes",
              "turnstile_site_key"
            ],
            "type": "object"
          },
          "currency": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "landing": {
            "properties": {
              "cta_body": {
                "type": "string"
              },
              "cta_text": {
                "type": "string"
              },
              "cta_title": {
                "type": "string"
              },
              "features": {
                "items": {
                  "properties": {
                    "description": {
                      "type": "string"
                    },
                    "image": {
                      "properties": {
                        "alt": {
                          "type": "string"
                        },
                        "url": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "url",
                        "alt"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "title": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "title",
                    "description"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "hero_body": {
                "type": "string"
              },
              "hero_media": {
                "oneOf": [
                  {
                    "properties": {
                      "alt": {
                        "type": "string"
                      },
                      "kind": {
                        "enum": [
                          "image"
                        ],
                        "type": "string"
                      },
                      "poster_url": {
                        "type": "string"
                      },
                      "url": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "url",
                      "alt",
                      "kind"
                    ],
                    "type": "object"
                  },
                  {
                    "properties": {
                      "alt": {
                        "type": "string"
                      },
                      "kind": {
                        "enum": [
                          "video"
                        ],
                        "type": "string"
                      },
                      "poster_url": {
                        "type": "string"
                      },
                      "url": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "url",
                      "alt",
                      "kind",
                      "poster_url"
                    ],
                    "type": "object"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "hero_title": {
                "type": "string"
              },
              "steps": {
                "items": {
                  "properties": {
                    "description": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "title",
                    "description"
                  ],
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "hero_title",
              "hero_body",
              "features",
              "steps",
              "cta_title",
              "cta_body",
              "cta_text"
            ],
            "type": [
              "object",
              "null"
            ]
          },
          "locale": {
            "type": "string"
          },
          "locales": {
            "properties": {
              "available": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "source": {
                "type": "string"
              }
            },
            "required": [
              "source",
              "available"
            ],
            "type": "object"
          },
          "logo_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "name": {
            "type": "string"
          },
          "registration": {
            "properties": {
              "mode": {
                "enum": [
                  "open",
                  "invite_only",
                  "closed"
                ],
                "type": "string"
              }
            },
            "required": [
              "mode"
            ],
            "type": "object"
          },
          "seo": {
            "properties": {
              "announcements": {
                "properties": {
                  "description": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  }
                },
                "required": [
                  "title",
                  "description"
                ],
                "type": "object"
              },
              "download": {
                "properties": {
                  "description": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  }
                },
                "required": [
                  "title",
                  "description"
                ],
                "type": "object"
              },
              "features": {
                "properties": {
                  "description": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  }
                },
                "required": [
                  "title",
                  "description"
                ],
                "type": "object"
              },
              "home": {
                "properties": {
                  "description": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  }
                },
                "required": [
                  "title",
                  "description"
                ],
                "type": "object"
              },
              "pricing": {
                "properties": {
                  "description": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  }
                },
                "required": [
                  "title",
                  "description"
                ],
                "type": "object"
              },
              "status": {
                "properties": {
                  "description": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  }
                },
                "required": [
                  "title",
                  "description"
                ],
                "type": "object"
              }
            },
            "type": "object"
          },
          "social_image_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "timezone": {
            "type": "string"
          }
        },
        "required": [
          "name",
          "locale",
          "locales",
          "description",
          "logo_url",
          "social_image_url",
          "landing",
          "seo",
          "currency",
          "timezone",
          "appearance",
          "registration",
          "captcha"
        ],
        "type": "object"
      },
      "Staff": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "email": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "public_id": {
            "type": "string"
          },
          "roles": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "status": {
            "type": "string"
          },
          "two_factor_enabled": {
            "type": "boolean"
          },
          "user_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "public_id",
          "email",
          "name",
          "roles",
          "status",
          "two_factor_enabled",
          "created_at"
        ],
        "type": "object"
      },
      "StaffDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Staff"
          },
          {
            "properties": {
              "assignable_roles": {
                "description": "Roles the caller may grant or remove",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "permissions": {
                "items": {
                  "type": "string"
                },
                "type": "array"
              }
            },
            "required": [
              "permissions",
              "assignable_roles"
            ],
            "type": "object"
          }
        ]
      },
      "StaffList": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/Staff"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "StaffMfaReset": {
        "properties": {
          "sessions_revoked": {
            "type": "integer"
          }
        },
        "required": [
          "sessions_revoked"
        ],
        "type": "object"
      },
      "StaffRoles": {
        "properties": {
          "roles": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "user_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "roles"
        ],
        "type": "object"
      },
      "StaffRolesUpdate": {
        "additionalProperties": false,
        "properties": {
          "roles": {
            "items": {
              "maxLength": 32,
              "type": "string"
            },
            "maxItems": 32,
            "type": "array"
          }
        },
        "required": [
          "roles"
        ],
        "type": "object"
      },
      "SubscriptionEvent": {
        "properties": {
          "actor": {
            "properties": {
              "id": {
                "format": "uuid",
                "type": [
                  "string",
                  "null"
                ]
              },
              "type": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "id"
            ],
            "type": "object"
          },
          "created_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "detail": {
            "additionalProperties": {},
            "type": "object"
          },
          "id": {
            "type": "string"
          },
          "kind": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "kind",
          "actor",
          "detail",
          "created_at"
        ],
        "type": "object"
      },
      "SubscriptionEventPage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/SubscriptionEvent"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "SubscriptionGrant": {
        "properties": {
          "actor": {
            "properties": {
              "id": {
                "format": "uuid",
                "type": [
                  "string",
                  "null"
                ]
              },
              "type": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "id"
            ],
            "type": "object"
          },
          "applied_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "created_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "effect": {
            "enum": [
              "activate_plan",
              "term_extend",
              "traffic_bonus",
              "device_bonus",
              "usage_reset",
              "plan_switch"
            ],
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "idempotency_key": {
            "type": "string"
          },
          "params": {
            "additionalProperties": {},
            "type": "object"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "reverses_grant_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "properties": {
              "id": {
                "type": "string"
              },
              "type": {
                "enum": [
                  "order",
                  "code",
                  "admin",
                  "bulk",
                  "referral",
                  "trial",
                  "apple",
                  "plan_change",
                  "refund"
                ],
                "type": "string"
              }
            },
            "required": [
              "type",
              "id"
            ],
            "type": "object"
          },
          "status": {
            "enum": [
              "pending",
              "applied",
              "reversed"
            ],
            "type": "string"
          },
          "term_end_after": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "term_end_before": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "effect",
          "source",
          "idempotency_key",
          "params",
          "status",
          "applied_at",
          "term_end_before",
          "term_end_after",
          "reverses_grant_id",
          "actor",
          "reason",
          "created_at"
        ],
        "type": "object"
      },
      "SubscriptionGrantPage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/SubscriptionGrant"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "SubscriptionLink": {
        "properties": {
          "rotated_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "token_fingerprint": {
            "type": "string"
          },
          "url": {
            "description": "Subscription URL `https://<subscription host>/s/<token>`",
            "type": "string"
          }
        },
        "required": [
          "url",
          "token_fingerprint",
          "rotated_at"
        ],
        "type": "object"
      },
      "SubscriptionTerm": {
        "anyOf": [
          {
            "additionalProperties": false,
            "properties": {
              "perpetual": {
                "enum": [
                  true
                ],
                "type": "boolean"
              }
            },
            "required": [
              "perpetual"
            ],
            "type": "object"
          },
          {
            "additionalProperties": false,
            "properties": {
              "count": {
                "maximum": 3650,
                "minimum": 1,
                "type": "integer"
              },
              "unit": {
                "enum": [
                  "hour",
                  "day",
                  "month",
                  "year"
                ],
                "type": "string"
              }
            },
            "required": [
              "unit",
              "count"
            ],
            "type": "object"
          },
          {
            "type": "null"
          }
        ],
        "description": "`{ \"perpetual\": true }` or `{ \"unit\": \"month\", \"count\": 1 }`"
      },
      "TranslateRequest": {
        "additionalProperties": false,
        "properties": {
          "id": {
            "example": "0192f0c4-0000-7000-8000-00000000abcd",
            "maxLength": 80,
            "minLength": 1,
            "pattern": "^[A-Za-z0-9_./:-]+$",
            "type": "string"
          },
          "locales": {
            "description": "Target locales; default every enabled locale except the source",
            "items": {
              "example": "en-US",
              "maxLength": 35,
              "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
              "type": "string"
            },
            "maxItems": 32,
            "minItems": 1,
            "type": "array"
          },
          "overwrite": {
            "description": "Retranslate filled locales too (confirmed by the staff member)",
            "type": "boolean"
          },
          "type": {
            "example": "catalog.product",
            "maxLength": 64,
            "pattern": "^[a-z][a-z0-9_]*\\.[a-z][a-z0-9_]*$",
            "type": "string"
          }
        },
        "required": [
          "type",
          "id"
        ],
        "type": "object"
      },
      "TranslateResult": {
        "properties": {
          "id": {
            "type": "string"
          },
          "requested": {
            "items": {
              "properties": {
                "fields": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "job_id": {
                  "description": "null when a pending job already covers it",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "locale": {
                  "type": "string"
                }
              },
              "required": [
                "locale",
                "fields",
                "job_id"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "skipped": {
            "enum": [
              "auto_translate_off",
              "no_provider",
              null
            ],
            "type": [
              "string",
              "null"
            ]
          },
          "source_locale": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "type",
          "id",
          "source_locale",
          "requested",
          "skipped"
        ],
        "type": "object"
      },
      "TranslationAttempt": {
        "properties": {
          "characters": {
            "type": "integer"
          },
          "outcome": {
            "enum": [
              "ok",
              "disabled",
              "not_configured",
              "unsupported_locale",
              "text_too_long",
              "over_budget",
              "quota_exceeded",
              "rate_limited",
              "auth_failed",
              "timeout",
              "failed",
              "invalid_response",
              "placeholder_mismatch"
            ],
            "type": "string"
          },
          "provider_id": {
            "type": "string"
          },
          "status": {
            "description": "HTTP status or provider error code",
            "type": "string"
          },
          "type": {
            "enum": [
              "aliyun",
              "volcengine",
              "youdao",
              "niutrans",
              "caiyun",
              "yandex",
              "workers_ai",
              "microsoft",
              "google",
              "deepl_free",
              "deepl",
              "baidu",
              "tencent",
              "libretranslate",
              "openai_compatible"
            ],
            "type": "string"
          }
        },
        "required": [
          "provider_id",
          "type",
          "outcome"
        ],
        "type": "object"
      },
      "TranslationJob": {
        "properties": {
          "attempts": {
            "type": "integer"
          },
          "attempts_log": {
            "items": {
              "$ref": "#/components/schemas/TranslationAttempt"
            },
            "type": "array"
          },
          "id": {
            "type": "string"
          },
          "last_error": {
            "type": [
              "string",
              "null"
            ]
          },
          "max_attempts": {
            "type": "integer"
          },
          "outcome": {
            "description": "translated, no_provider, needs_manual, retry, gone, source_locale, locale_disabled, nothing_missing, target_changed",
            "type": [
              "string",
              "null"
            ]
          },
          "overwrite": {
            "type": "boolean"
          },
          "provider": {
            "type": [
              "string",
              "null"
            ]
          },
          "run_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "status": {
            "enum": [
              "pending",
              "running",
              "succeeded",
              "dead",
              "cancelled"
            ],
            "type": "string"
          },
          "updated_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "id",
          "status",
          "overwrite",
          "attempts",
          "max_attempts",
          "run_at",
          "updated_at",
          "last_error",
          "outcome",
          "provider",
          "attempts_log"
        ],
        "type": [
          "object",
          "null"
        ]
      },
      "TranslationLocaleStatus": {
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "job": {
            "$ref": "#/components/schemas/TranslationJob"
          },
          "locale": {
            "type": "string"
          },
          "missing_fields": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "origin": {
            "enum": [
              "manual",
              "machine",
              "builtin",
              null
            ],
            "type": [
              "string",
              "null"
            ]
          },
          "provider": {
            "type": [
              "string",
              "null"
            ]
          },
          "state": {
            "enum": [
              "source",
              "complete",
              "missing",
              "translating",
              "failed",
              "needs_manual"
            ],
            "type": "string"
          }
        },
        "required": [
          "locale",
          "enabled",
          "state",
          "origin",
          "provider",
          "missing_fields",
          "job"
        ],
        "type": "object"
      },
      "TranslationOverview": {
        "properties": {
          "auto_translate": {
            "type": "boolean"
          },
          "default_locale": {
            "type": "string"
          },
          "enabled_locales": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "jobs": {
            "properties": {
              "dead": {
                "type": "integer"
              },
              "pending": {
                "type": "integer"
              },
              "running": {
                "type": "integer"
              }
            },
            "required": [
              "pending",
              "running",
              "dead"
            ],
            "type": "object"
          },
          "kind": {
            "enum": [
              "overview"
            ],
            "type": "string"
          },
          "period": {
            "description": "Calendar month (UTC) of the character counts",
            "example": "2026-10",
            "type": "string"
          },
          "providers": {
            "items": {
              "properties": {
                "configured": {
                  "type": "boolean"
                },
                "enabled": {
                  "type": "boolean"
                },
                "id": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "monthly_char_budget": {
                  "description": "Characters per month",
                  "type": [
                    "integer",
                    "null"
                  ]
                },
                "type": {
                  "enum": [
                    "aliyun",
                    "volcengine",
                    "youdao",
                    "niutrans",
                    "caiyun",
                    "yandex",
                    "workers_ai",
                    "microsoft",
                    "google",
                    "deepl_free",
                    "deepl",
                    "baidu",
                    "tencent",
                    "libretranslate",
                    "openai_compatible"
                  ],
                  "type": "string"
                },
                "used_this_month": {
                  "description": "Counted characters (best effort)",
                  "type": [
                    "integer",
                    "null"
                  ]
                }
              },
              "required": [
                "id",
                "type",
                "label",
                "enabled",
                "configured",
                "monthly_char_budget",
                "used_this_month"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "resource_types": {
            "items": {
              "properties": {
                "fields": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "owner": {
                  "type": "string"
                },
                "permission": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "type": {
                  "type": "string"
                }
              },
              "required": [
                "type",
                "owner",
                "fields",
                "permission"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "kind",
          "default_locale",
          "enabled_locales",
          "auto_translate",
          "period",
          "providers",
          "jobs",
          "resource_types"
        ],
        "type": "object"
      },
      "TranslationProviderTest": {
        "additionalProperties": false,
        "properties": {
          "source_locale": {
            "description": "Default: the site default locale",
            "example": "en-US",
            "maxLength": 35,
            "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
            "type": "string"
          },
          "target_locale": {
            "description": "Default: the first other enabled locale",
            "example": "en-US",
            "maxLength": 35,
            "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
            "type": "string"
          },
          "text": {
            "description": "Default: a built-in zh / en sample",
            "maxLength": 2000,
            "minLength": 1,
            "type": "string"
          }
        },
        "type": "object"
      },
      "TranslationProviderTestResult": {
        "properties": {
          "characters": {
            "type": "integer"
          },
          "elapsed_ms": {
            "type": "integer"
          },
          "provider_id": {
            "type": "string"
          },
          "source_locale": {
            "type": "string"
          },
          "target_locale": {
            "type": "string"
          },
          "text": {
            "type": "string"
          },
          "translated": {
            "type": "string"
          },
          "type": {
            "enum": [
              "aliyun",
              "volcengine",
              "youdao",
              "niutrans",
              "caiyun",
              "yandex",
              "workers_ai",
              "microsoft",
              "google",
              "deepl_free",
              "deepl",
              "baidu",
              "tencent",
              "libretranslate",
              "openai_compatible"
            ],
            "type": "string"
          }
        },
        "required": [
          "provider_id",
          "type",
          "source_locale",
          "target_locale",
          "text",
          "translated",
          "characters",
          "elapsed_ms"
        ],
        "type": "object"
      },
      "TranslationResourceStatus": {
        "properties": {
          "fields": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "id": {
            "type": "string"
          },
          "kind": {
            "enum": [
              "resource"
            ],
            "type": "string"
          },
          "locales": {
            "items": {
              "$ref": "#/components/schemas/TranslationLocaleStatus"
            },
            "type": "array"
          },
          "source_locale": {
            "type": "string"
          },
          "type": {
            "type": "string"
          }
        },
        "required": [
          "kind",
          "type",
          "id",
          "source_locale",
          "fields",
          "locales"
        ],
        "type": "object"
      },
      "TranslationStatus": {
        "discriminator": {
          "mapping": {
            "overview": "#/components/schemas/TranslationOverview",
            "resource": "#/components/schemas/TranslationResourceStatus"
          },
          "propertyName": "kind"
        },
        "oneOf": [
          {
            "$ref": "#/components/schemas/TranslationOverview"
          },
          {
            "$ref": "#/components/schemas/TranslationResourceStatus"
          }
        ]
      },
      "UsageDaily": {
        "properties": {
          "items": {
            "items": {
              "properties": {
                "billed_bytes": {
                  "pattern": "^\\d+$",
                  "type": "string"
                },
                "business_date": {
                  "format": "date",
                  "type": "string"
                },
                "download_bytes": {
                  "pattern": "^\\d+$",
                  "type": "string"
                },
                "upload_bytes": {
                  "pattern": "^\\d+$",
                  "type": "string"
                }
              },
              "required": [
                "business_date",
                "upload_bytes",
                "download_bytes",
                "billed_bytes"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "UsageDevices": {
        "properties": {
          "items": {
            "items": {
              "properties": {
                "blocked_until": {
                  "format": "date-time",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "device_key": {
                  "type": "string"
                },
                "first_seen_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "ip_masked": {
                  "type": "string"
                },
                "last_seen_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "limited": {
                  "type": "boolean"
                },
                "reason": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "server_id": {
                  "format": "uuid",
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "device_key",
                "ip_masked",
                "server_id",
                "first_seen_at",
                "last_seen_at",
                "limited",
                "reason",
                "blocked_until"
              ],
              "type": "object"
            },
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "type": "object"
      },
      "UsageKickedDevice": {
        "properties": {
          "blocked_until": {
            "format": "date-time",
            "type": "string"
          }
        },
        "required": [
          "blocked_until"
        ],
        "type": "object"
      },
      "UsageRankings": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "properties": {
                "billed_bytes": {
                  "pattern": "^\\d+$",
                  "type": "string"
                },
                "download_bytes": {
                  "pattern": "^\\d+$",
                  "type": "string"
                },
                "id": {
                  "format": "uuid",
                  "type": "string"
                },
                "upload_bytes": {
                  "pattern": "^\\d+$",
                  "type": "string"
                }
              },
              "required": [
                "id",
                "upload_bytes",
                "download_bytes",
                "billed_bytes"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "items",
          "has_more",
          "next_cursor"
        ],
        "type": "object"
      },
      "UsageReconciliationReport": {
        "properties": {
          "batch_date_from": {
            "format": "date",
            "type": "string"
          },
          "batch_date_to": {
            "format": "date",
            "type": "string"
          },
          "compared_server_days": {
            "type": "integer"
          },
          "compared_subscriptions": {
            "type": "integer"
          },
          "differences": {
            "items": {
              "properties": {
                "actual_billed_bytes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "actual_raw_bytes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "business_date": {
                  "format": "date",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "detail": {
                  "additionalProperties": {},
                  "type": "object"
                },
                "exception_id": {
                  "format": "uuid",
                  "type": "string"
                },
                "expected_billed_bytes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "expected_raw_bytes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "kind": {
                  "enum": [
                    "batch_daily",
                    "subscription_counter",
                    "incomplete_period"
                  ],
                  "type": "string"
                },
                "resource_id": {
                  "format": "uuid",
                  "type": "string"
                }
              },
              "required": [
                "kind",
                "resource_id",
                "business_date",
                "expected_raw_bytes",
                "actual_raw_bytes",
                "expected_billed_bytes",
                "actual_billed_bytes",
                "detail",
                "exception_id"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "incomplete": {
            "items": {
              "properties": {
                "actual_billed_bytes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "actual_raw_bytes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "business_date": {
                  "format": "date",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "detail": {
                  "additionalProperties": {},
                  "type": "object"
                },
                "expected_billed_bytes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "expected_raw_bytes": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "kind": {
                  "enum": [
                    "batch_daily",
                    "subscription_counter",
                    "incomplete_period"
                  ],
                  "type": "string"
                },
                "resource_id": {
                  "format": "uuid",
                  "type": "string"
                }
              },
              "required": [
                "kind",
                "resource_id",
                "business_date",
                "expected_raw_bytes",
                "actual_raw_bytes",
                "expected_billed_bytes",
                "actual_billed_bytes",
                "detail"
              ],
              "type": "object"
            },
            "type": "array"
          },
          "incomplete_subscriptions": {
            "type": "integer"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "timezone": {
            "type": "string"
          },
          "truncated": {
            "type": "boolean"
          }
        },
        "required": [
          "timezone",
          "batch_date_from",
          "batch_date_to",
          "compared_server_days",
          "compared_subscriptions",
          "incomplete_subscriptions",
          "differences",
          "incomplete",
          "truncated",
          "next_cursor"
        ],
        "type": "object"
      },
      "UserCoupon": {
        "properties": {
          "bulk_operation_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "coupon": {
            "properties": {
              "code": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "distribution": {
                "enum": [
                  "public",
                  "issued"
                ],
                "type": "string"
              },
              "id": {
                "format": "uuid",
                "type": "string"
              },
              "name": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "name",
              "distribution",
              "code"
            ],
            "type": "object"
          },
          "created_at": {
            "type": "string"
          },
          "discount": {
            "$ref": "#/components/schemas/CouponDiscount"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "order_id": {
            "description": "Reserving / first consuming order",
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "recurring": {
            "$ref": "#/components/schemas/UserCouponRecurring"
          },
          "reserved_order_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "scope": {
            "$ref": "#/components/schemas/CouponScope"
          },
          "source": {
            "enum": [
              "checkout",
              "admin",
              "bulk",
              "registration",
              "referral"
            ],
            "type": "string"
          },
          "status": {
            "enum": [
              "available",
              "reserved",
              "consumed",
              "released",
              "reversed",
              "expired",
              "revoked"
            ],
            "type": "string"
          },
          "subscription_id": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": "string"
          },
          "user_id": {
            "format": "uuid",
            "type": "string"
          },
          "valid_from": {
            "type": [
              "string",
              "null"
            ]
          },
          "valid_until": {
            "type": [
              "string",
              "null"
            ]
          },
          "version": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "status",
          "source",
          "discount",
          "scope",
          "recurring",
          "valid_from",
          "valid_until",
          "reserved_order_id",
          "subscription_id",
          "created_at",
          "user_id",
          "coupon",
          "order_id",
          "bulk_operation_id",
          "updated_at",
          "version"
        ],
        "type": "object"
      },
      "UserCouponPage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/UserCoupon"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      },
      "UserCouponRecurring": {
        "properties": {
          "mode": {
            "enum": [
              "once",
              "periods",
              "forever"
            ],
            "type": "string"
          },
          "periods": {
            "type": [
              "integer",
              "null"
            ]
          },
          "periods_remaining": {
            "description": "null = unlimited",
            "type": [
              "integer",
              "null"
            ]
          },
          "periods_used": {
            "type": "integer"
          }
        },
        "required": [
          "mode",
          "periods",
          "periods_used",
          "periods_remaining"
        ],
        "type": "object"
      },
      "UserCouponRevoke": {
        "additionalProperties": false,
        "properties": {
          "reason": {
            "description": "Recorded in the audit event",
            "maxLength": 500,
            "minLength": 1,
            "type": "string"
          }
        },
        "required": [
          "reason"
        ],
        "type": "object"
      },
      "UserStatus": {
        "properties": {
          "sessions_revoked": {
            "type": "integer"
          },
          "status": {
            "type": "string"
          },
          "user_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "status",
          "sessions_revoked"
        ],
        "type": "object"
      },
      "UserStatusChange": {
        "additionalProperties": false,
        "properties": {
          "reason": {
            "maxLength": 500,
            "minLength": 1,
            "type": "string"
          },
          "status": {
            "enum": [
              "active",
              "disabled",
              "banned"
            ],
            "type": "string"
          }
        },
        "required": [
          "status",
          "reason"
        ],
        "type": "object"
      },
      "Wallet": {
        "properties": {
          "balances": {
            "properties": {
              "cash": {
                "$ref": "#/components/schemas/LedgerMoney"
              },
              "commission": {
                "$ref": "#/components/schemas/LedgerMoney"
              },
              "commission_pending": {
                "$ref": "#/components/schemas/LedgerMoney"
              },
              "gift": {
                "$ref": "#/components/schemas/LedgerMoney"
              }
            },
            "required": [
              "cash",
              "gift",
              "commission_pending",
              "commission"
            ],
            "type": "object"
          },
          "currency": {
            "example": "USD",
            "pattern": "^[A-Z]{3}$",
            "type": "string"
          },
          "updated_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "user_id": {
            "format": "uuid",
            "type": "string"
          },
          "version": {
            "type": "integer"
          },
          "withdrawal_blocked": {
            "description": "Available commission is negative",
            "type": "boolean"
          }
        },
        "required": [
          "user_id",
          "currency",
          "balances",
          "withdrawal_blocked",
          "version",
          "updated_at"
        ],
        "type": "object"
      },
      "WalletAdjustment": {
        "properties": {
          "amount": {
            "$ref": "#/components/schemas/LedgerMoney"
          },
          "approval_required": {
            "type": "boolean"
          },
          "bucket": {
            "enum": [
              "cash",
              "gift"
            ],
            "type": "string"
          },
          "entry": {
            "$ref": "#/components/schemas/AdminWalletEntry"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "request": {
            "allOf": [
              {
                "$ref": "#/components/schemas/WalletAdjustmentReview"
              },
              {
                "type": [
                  "object",
                  "null"
                ]
              }
            ]
          },
          "status": {
            "enum": [
              "posted",
              "pending",
              "approved",
              "rejected",
              "withdrawn",
              "expired"
            ],
            "type": "string"
          },
          "user_id": {
            "format": "uuid",
            "type": "string"
          },
          "wallet": {
            "$ref": "#/components/schemas/Wallet"
          }
        },
        "required": [
          "id",
          "user_id",
          "bucket",
          "amount",
          "reason",
          "approval_required",
          "status",
          "request",
          "entry",
          "wallet"
        ],
        "type": "object"
      },
      "WalletAdjustmentRequest": {
        "additionalProperties": false,
        "properties": {
          "amount": {
            "additionalProperties": false,
            "properties": {
              "currency": {
                "pattern": "^[A-Z]{3}$",
                "type": "string"
              },
              "minor": {
                "description": "Signed, non-zero: positive credits, negative debits",
                "example": "-500",
                "pattern": "^-?[1-9]\\d{0,17}$",
                "type": "string"
              }
            },
            "required": [
              "currency",
              "minor"
            ],
            "type": "object"
          },
          "bucket": {
            "enum": [
              "cash",
              "gift"
            ],
            "type": "string"
          },
          "reason": {
            "maxLength": 500,
            "minLength": 1,
            "type": "string"
          },
          "user_id": {
            "format": "uuid",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "bucket",
          "amount",
          "reason"
        ],
        "type": "object"
      },
      "WalletAdjustmentReview": {
        "properties": {
          "amount": {
            "$ref": "#/components/schemas/LedgerMoney"
          },
          "bucket": {
            "enum": [
              "cash",
              "gift"
            ],
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "type": "string"
          },
          "decided_at": {
            "format": "date-time",
            "type": [
              "string",
              "null"
            ]
          },
          "decided_by": {
            "format": "uuid",
            "type": [
              "string",
              "null"
            ]
          },
          "decision_reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "entry_id": {
            "type": [
              "string",
              "null"
            ]
          },
          "expires_at": {
            "format": "date-time",
            "type": "string"
          },
          "id": {
            "format": "uuid",
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "requested_by": {
            "format": "uuid",
            "type": "string"
          },
          "status": {
            "enum": [
              "pending",
              "approved",
              "rejected",
              "withdrawn",
              "expired"
            ],
            "type": "string"
          },
          "user_id": {
            "format": "uuid",
            "type": "string"
          },
          "version": {
            "type": "integer"
          }
        },
        "required": [
          "id",
          "user_id",
          "requested_by",
          "bucket",
          "amount",
          "reason",
          "status",
          "expires_at",
          "created_at",
          "version",
          "decided_by",
          "decided_at",
          "decision_reason",
          "entry_id"
        ],
        "type": "object"
      },
      "WalletEntry": {
        "properties": {
          "amount": {
            "$ref": "#/components/schemas/LedgerMoney"
          },
          "balance_after": {
            "$ref": "#/components/schemas/LedgerMoney"
          },
          "bucket": {
            "enum": [
              "cash",
              "gift",
              "commission_pending",
              "commission"
            ],
            "type": "string"
          },
          "created_at": {
            "example": "2026-10-22T08:00:00.000Z",
            "format": "date-time",
            "type": "string"
          },
          "id": {
            "example": "1042",
            "type": "string"
          },
          "kind": {
            "enum": [
              "top_up",
              "order_apply",
              "order_release",
              "order_reapply",
              "order_payment",
              "refund",
              "admin_adjust",
              "gift_grant",
              "commission_accrue",
              "commission_release",
              "commission_reverse",
              "commission_to_cash",
              "withdraw_hold",
              "withdraw_release",
              "commission_withdraw_hold",
              "commission_withdraw_release",
              "commission_withdraw_settle",
              "correction"
            ],
            "type": "string"
          },
          "reference": {
            "properties": {
              "id": {
                "type": "string"
              },
              "type": {
                "type": "string"
              }
            },
            "required": [
              "type",
              "id"
            ],
            "type": "object"
          }
        },
        "required": [
          "id",
          "bucket",
          "kind",
          "amount",
          "balance_after",
          "reference",
          "created_at"
        ],
        "type": "object"
      },
      "WalletEntryPage": {
        "properties": {
          "has_more": {
            "type": "boolean"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/WalletEntry"
            },
            "type": "array"
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "total": {
            "type": "integer"
          }
        },
        "required": [
          "items",
          "next_cursor",
          "has_more"
        ],
        "type": "object"
      }
    }
  },
  "info": {
    "description": "Portal (/api/v1/public, /api/v1/auth, /api/v1/me) and admin (/api/v1/admin) API. Errors are application/problem+json; `x-error-codes` lists every registered code with its HTTP status.",
    "title": "PPanel Edge API",
    "version": "v1"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/v1/admin/access-logs": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "subscription_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "pattern": "^[1-9]\\d{0,18}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "accessed_at": {
                            "type": "string"
                          },
                          "asn": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "carrier": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "client_key": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "id": {
                            "type": "string"
                          },
                          "ip_masked": {
                            "type": "string"
                          },
                          "result": {
                            "type": "string"
                          },
                          "subscription_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "token_fingerprint": {
                            "type": "string"
                          },
                          "user_agent_summary": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "via_node": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "accessed_at",
                          "subscription_id",
                          "token_fingerprint",
                          "client_key",
                          "result",
                          "ip_masked",
                          "user_agent_summary",
                          "asn",
                          "carrier",
                          "via_node"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "has_more",
                    "next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Subscription link access history",
        "tags": [
          "distribution"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "distribution.log.read"
      }
    },
    "/api/v1/admin/alerts": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "$ref": "#/components/schemas/OpsAlertRoute"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Alert routes"
          }
        },
        "summary": "List exception alert routes",
        "tags": [
          "ops"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "ops.exception.read"
      },
      "post": {
        "parameters": [
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "channels": {
                    "items": {
                      "enum": [
                        "email",
                        "sms",
                        "telegram",
                        "inbox"
                      ],
                      "type": "string"
                    },
                    "maxItems": 4,
                    "minItems": 1,
                    "type": "array"
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "exception_types": {
                    "items": {
                      "maxLength": 100,
                      "minLength": 1,
                      "type": "string"
                    },
                    "maxItems": 100,
                    "type": "array"
                  },
                  "name": {
                    "maxLength": 100,
                    "minLength": 1,
                    "type": "string"
                  },
                  "severities": {
                    "items": {
                      "enum": [
                        "p1",
                        "p2",
                        "p3"
                      ],
                      "type": "string"
                    },
                    "maxItems": 3,
                    "minItems": 1,
                    "type": "array"
                  },
                  "staff_ids": {
                    "items": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "maxItems": 100,
                    "minItems": 1,
                    "type": "array"
                  },
                  "throttle_seconds": {
                    "maximum": 86400,
                    "minimum": 60,
                    "type": "integer"
                  }
                },
                "required": [
                  "name",
                  "enabled",
                  "exception_types",
                  "severities",
                  "staff_ids",
                  "channels",
                  "throttle_seconds"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpsAlertRoute"
                }
              }
            },
            "description": "Created route"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Recipients must be active staff"
          }
        },
        "summary": "Create an exception alert route",
        "tags": [
          "ops"
        ],
        "x-audit": "ops.alert.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "ops.exception.manage",
        "x-rate-limit": "ops.manage.user"
      }
    },
    "/api/v1/admin/alerts/{id}": {
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "if-match",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "channels": {
                    "items": {
                      "enum": [
                        "email",
                        "sms",
                        "telegram",
                        "inbox"
                      ],
                      "type": "string"
                    },
                    "maxItems": 4,
                    "minItems": 1,
                    "type": "array"
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "exception_types": {
                    "items": {
                      "maxLength": 100,
                      "minLength": 1,
                      "type": "string"
                    },
                    "maxItems": 100,
                    "type": "array"
                  },
                  "name": {
                    "maxLength": 100,
                    "minLength": 1,
                    "type": "string"
                  },
                  "severities": {
                    "items": {
                      "enum": [
                        "p1",
                        "p2",
                        "p3"
                      ],
                      "type": "string"
                    },
                    "maxItems": 3,
                    "minItems": 1,
                    "type": "array"
                  },
                  "staff_ids": {
                    "items": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "maxItems": 100,
                    "minItems": 1,
                    "type": "array"
                  },
                  "throttle_seconds": {
                    "maximum": 86400,
                    "minimum": 60,
                    "type": "integer"
                  }
                },
                "required": [
                  "name",
                  "enabled",
                  "exception_types",
                  "severities",
                  "staff_ids",
                  "channels",
                  "throttle_seconds"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpsAlertRoute"
                }
              }
            },
            "description": "Updated route",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unknown route"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Stale version"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Recipients must be active staff"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "Update an exception alert route",
        "tags": [
          "ops"
        ],
        "x-audit": "ops.alert.update",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "ops.exception.manage",
        "x-rate-limit": "ops.manage.user"
      }
    },
    "/api/v1/admin/analytics/backfills": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "date_from": {
                    "format": "date",
                    "type": "string"
                  },
                  "date_to": {
                    "format": "date",
                    "type": "string"
                  }
                },
                "required": [
                  "date_from",
                  "date_to"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "definition_version": {
                      "type": "integer"
                    },
                    "job_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "job_id",
                    "definition_version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Analytics report"
          }
        },
        "summary": "Rebuild a business-date range using the current definition",
        "tags": [
          "analytics"
        ],
        "x-audit": "analytics.report.backfill",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "analytics.read",
        "x-rate-limit": "analytics.backfill.user",
        "x-reauth": false
      }
    },
    "/api/v1/admin/analytics/dashboard": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "date_from",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "computed_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "date_from": {
                      "format": "date",
                      "type": "string"
                    },
                    "date_to": {
                      "format": "date",
                      "type": "string"
                    },
                    "definition_version": {
                      "type": "integer"
                    },
                    "orders": {
                      "properties": {
                        "balance_applied_minor": {
                          "pattern": "^\\d+$",
                          "type": "string"
                        },
                        "count": {
                          "type": "integer"
                        },
                        "gift_applied_minor": {
                          "pattern": "^\\d+$",
                          "type": "string"
                        },
                        "paid_minor": {
                          "pattern": "^\\d+$",
                          "type": "string"
                        },
                        "pending_payment": {
                          "type": "integer"
                        },
                        "refunded_minor": {
                          "pattern": "^\\d+$",
                          "type": "string"
                        }
                      },
                      "required": [
                        "count",
                        "paid_minor",
                        "balance_applied_minor",
                        "gift_applied_minor",
                        "refunded_minor",
                        "pending_payment"
                      ],
                      "type": "object"
                    },
                    "payments": {
                      "additionalProperties": {
                        "type": "integer"
                      },
                      "type": "object"
                    },
                    "subscriptions": {
                      "additionalProperties": {
                        "type": "integer"
                      },
                      "type": "object"
                    },
                    "time_zone": {
                      "type": "string"
                    },
                    "traffic": {
                      "properties": {
                        "billed_bytes": {
                          "pattern": "^\\d+$",
                          "type": "string"
                        },
                        "download_bytes": {
                          "pattern": "^\\d+$",
                          "type": "string"
                        },
                        "upload_bytes": {
                          "pattern": "^\\d+$",
                          "type": "string"
                        }
                      },
                      "required": [
                        "upload_bytes",
                        "download_bytes",
                        "billed_bytes"
                      ],
                      "type": "object"
                    },
                    "users": {
                      "properties": {
                        "registered": {
                          "type": "integer"
                        },
                        "total": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "total",
                        "registered"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "definition_version",
                    "computed_at",
                    "time_zone",
                    "currency",
                    "date_from",
                    "date_to",
                    "orders",
                    "users",
                    "subscriptions",
                    "payments",
                    "traffic"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Dashboard"
          }
        },
        "summary": "Dashboard facts by business dates (end exclusive)",
        "tags": [
          "analytics"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "analytics.read"
      }
    },
    "/api/v1/admin/analytics/definitions": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "current_definition": {
                      "additionalProperties": {},
                      "type": "object"
                    },
                    "current_version": {
                      "type": "integer"
                    },
                    "versions": {
                      "items": {
                        "properties": {
                          "definition": {
                            "additionalProperties": {},
                            "type": "object"
                          },
                          "registered_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "version",
                          "definition",
                          "registered_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "current_version",
                    "current_definition",
                    "versions"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Analytics report"
          }
        },
        "summary": "Versioned metric definitions",
        "tags": [
          "analytics"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "analytics.read",
        "x-reauth": false
      }
    },
    "/api/v1/admin/analytics/reports": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "date_from",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "definition_version",
            "required": false,
            "schema": {
              "maximum": 2147483647,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "arpu_minor": {
                      "pattern": "^-?\\d+$",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "comparable": {
                      "type": "boolean"
                    },
                    "complete": {
                      "type": "boolean"
                    },
                    "date_from": {
                      "format": "date",
                      "type": "string"
                    },
                    "date_to": {
                      "format": "date",
                      "type": "string"
                    },
                    "days": {
                      "items": {
                        "properties": {
                          "business_date": {
                            "format": "date",
                            "type": "string"
                          },
                          "computed_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "currency": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "time_zone": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "business_date",
                          "computed_at",
                          "time_zone",
                          "currency"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "definition": {
                      "additionalProperties": {},
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "definition_version": {
                      "type": "integer"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "business_date": {
                            "format": "date",
                            "type": "string"
                          },
                          "computed_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "dimension": {
                            "type": "string"
                          },
                          "metric": {
                            "type": "string"
                          },
                          "time_zone": {
                            "type": "string"
                          },
                          "value": {
                            "pattern": "^-?\\d+$",
                            "type": "string"
                          }
                        },
                        "required": [
                          "business_date",
                          "metric",
                          "dimension",
                          "value",
                          "computed_at",
                          "time_zone",
                          "currency"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "missing_dates": {
                      "items": {
                        "format": "date",
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "totals": {
                      "additionalProperties": {
                        "pattern": "^-?\\d+$",
                        "type": "string"
                      },
                      "type": [
                        "object",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "definition_version",
                    "definition",
                    "date_from",
                    "date_to",
                    "complete",
                    "comparable",
                    "missing_dates",
                    "days",
                    "items",
                    "totals",
                    "arpu_minor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Analytics report"
          }
        },
        "summary": "Daily business metrics (end exclusive)",
        "tags": [
          "analytics"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "analytics.read",
        "x-reauth": false
      }
    },
    "/api/v1/admin/analytics/reports.csv": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "date_from",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "definition_version",
            "required": false,
            "schema": {
              "maximum": 2147483647,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/csv": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "CSV with definition, build metadata and missing-day markers"
          }
        },
        "summary": "Export versioned daily metrics as CSV",
        "tags": [
          "analytics"
        ],
        "x-audit": "analytics.report.export",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "analytics.read",
        "x-reauth": false
      }
    },
    "/api/v1/admin/analytics/traffic-rates": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "server_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "cost_per_gib_minor": {
                            "pattern": "^(0|[1-9]\\d{0,18})$",
                            "type": "string"
                          },
                          "created_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "currency": {
                            "pattern": "^[A-Z]{3}$",
                            "type": "string"
                          },
                          "effective_date": {
                            "format": "date",
                            "type": "string"
                          },
                          "server_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "server_id",
                          "effective_date",
                          "cost_per_gib_minor",
                          "currency",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Tariffs, newest first (up to 100)"
          }
        },
        "summary": "List effective-date traffic tariffs for a server",
        "tags": [
          "analytics"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "analytics.read",
        "x-reauth": false
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "cost_per_gib_minor": {
                    "pattern": "^(0|[1-9]\\d{0,18})$",
                    "type": "string"
                  },
                  "currency": {
                    "pattern": "^[A-Z]{3}$",
                    "type": "string"
                  },
                  "effective_date": {
                    "format": "date",
                    "type": "string"
                  },
                  "server_id": {
                    "format": "uuid",
                    "type": "string"
                  }
                },
                "required": [
                  "server_id",
                  "effective_date",
                  "cost_per_gib_minor",
                  "currency"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "cost_per_gib_minor": {
                      "pattern": "^(0|[1-9]\\d{0,18})$",
                      "type": "string"
                    },
                    "created": {
                      "type": "boolean"
                    },
                    "currency": {
                      "pattern": "^[A-Z]{3}$",
                      "type": "string"
                    },
                    "effective_date": {
                      "format": "date",
                      "type": "string"
                    },
                    "server_id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "server_id",
                    "effective_date",
                    "cost_per_gib_minor",
                    "currency",
                    "created"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Tariff"
          }
        },
        "summary": "Append an immutable traffic tariff; corrections use a new effective date",
        "tags": [
          "analytics"
        ],
        "x-audit": "analytics.traffic_rate.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "network.server.manage",
        "x-reauth": false
      }
    },
    "/api/v1/admin/apple/product-mappings": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "apple_product_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "plan_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "price_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "price_id",
                          "apple_product_id",
                          "plan_id"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "has_more",
                    "next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Apple product to price mappings",
        "tags": [
          "catalog"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "catalog.read",
        "x-reauth": false
      }
    },
    "/api/v1/admin/apple/product-mappings/{priceId}": {
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "priceId",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "apple_product_id": {
                    "maxLength": 255,
                    "minLength": 1,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "expected_apple_product_id": {
                    "maxLength": 255,
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "apple_product_id",
                  "expected_apple_product_id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "apple_product_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "price_id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "price_id",
                    "apple_product_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "409": {
            "description": "Mapping used, stale or duplicated"
          }
        },
        "summary": "Assign an Apple product to a price",
        "tags": [
          "catalog"
        ],
        "x-audit": "catalog.apple_mapping.update",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "catalog.price.manage",
        "x-reauth": false
      }
    },
    "/api/v1/admin/apple/subscriptions": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "environment",
            "required": false,
            "schema": {
              "default": "production",
              "enum": [
                "sandbox",
                "production"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "pattern": "^\\d{1,64}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "auto_renew": {
                            "type": "boolean"
                          },
                          "current_product_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "current_transaction_id": {
                            "pattern": "^\\d{1,64}$",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "environment": {
                            "enum": [
                              "sandbox",
                              "production"
                            ],
                            "type": "string"
                          },
                          "grace_expires_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "last_signed_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "last_synced_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "next_product_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "original_transaction_id": {
                            "pattern": "^\\d{1,64}$",
                            "type": "string"
                          },
                          "state": {
                            "enum": [
                              "pending",
                              "active",
                              "grace",
                              "billing_retry",
                              "expired",
                              "revoked"
                            ],
                            "type": "string"
                          },
                          "subscription_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "user_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "environment",
                          "original_transaction_id",
                          "user_id",
                          "subscription_id",
                          "current_transaction_id",
                          "current_product_id",
                          "next_product_id",
                          "state",
                          "auto_renew",
                          "grace_expires_at",
                          "last_signed_at",
                          "last_synced_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "has_more",
                    "next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Apple external subscriptions",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "commerce.order.read",
        "x-reauth": false
      }
    },
    "/api/v1/admin/apple/subscriptions/{originalTransactionId}/receipts": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "originalTransactionId",
            "required": true,
            "schema": {
              "pattern": "^\\d{1,64}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "environment",
            "required": false,
            "schema": {
              "default": "production",
              "enum": [
                "sandbox",
                "production"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "pattern": "^\\d{1,64}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "currency": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "environment": {
                            "enum": [
                              "sandbox",
                              "production"
                            ],
                            "type": "string"
                          },
                          "expires_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "kind": {
                            "enum": [
                              "external_receipt"
                            ],
                            "type": "string"
                          },
                          "plan_price_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "price_milli": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "product_id": {
                            "type": "string"
                          },
                          "purchase_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "revoked_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "source": {
                            "enum": [
                              "apple"
                            ],
                            "type": "string"
                          },
                          "subscription_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "transaction_id": {
                            "pattern": "^\\d{1,64}$",
                            "type": "string"
                          }
                        },
                        "required": [
                          "source",
                          "kind",
                          "environment",
                          "transaction_id",
                          "product_id",
                          "subscription_id",
                          "plan_price_id",
                          "purchase_at",
                          "expires_at",
                          "revoked_at",
                          "price_milli",
                          "currency"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "has_more",
                    "next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Apple external receipts in original milliunits",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "commerce.order.read",
        "x-reauth": false
      }
    },
    "/api/v1/admin/apple/subscriptions/{originalTransactionId}/sync": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "originalTransactionId",
            "required": true,
            "schema": {
              "pattern": "^\\d{1,64}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "environment": {
                    "enum": [
                      "sandbox",
                      "production"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "environment"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "duplicate": {
                      "type": "boolean"
                    },
                    "stale": {
                      "type": "boolean"
                    },
                    "subscription_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "duplicate",
                    "stale",
                    "subscription_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Query Apple and reconcile the subscription",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.apple.sync",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "commerce.payment.sync",
        "x-reauth": false
      }
    },
    "/api/v1/admin/audit-events": {
      "get": {
        "parameters": [
          {
            "description": "Category; repeat the parameter for several values",
            "in": "query",
            "name": "category",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "admin",
                    "security",
                    "billing",
                    "subscription",
                    "network",
                    "system",
                    "ops"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "admin",
                      "security",
                      "billing",
                      "subscription",
                      "network",
                      "system",
                      "ops"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Category; repeat the parameter for several values"
            }
          },
          {
            "description": "Outcome; repeat the parameter for several values",
            "in": "query",
            "name": "outcome",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "success",
                    "denied",
                    "failed"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "success",
                      "denied",
                      "failed"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Outcome; repeat the parameter for several values"
            }
          },
          {
            "in": "query",
            "name": "actor_type",
            "required": false,
            "schema": {
              "enum": [
                "user",
                "staff",
                "system",
                "api_key",
                "server"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "actor_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "action",
            "required": false,
            "schema": {
              "maxLength": 100,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "resource_type",
            "required": false,
            "schema": {
              "maxLength": 100,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Use with resource_type",
            "in": "query",
            "name": "resource_id",
            "required": false,
            "schema": {
              "description": "Use with resource_type",
              "maxLength": 200,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "request_id",
            "required": false,
            "schema": {
              "maxLength": 128,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Occurred at or after (inclusive)",
            "in": "query",
            "name": "occurred_from",
            "required": false,
            "schema": {
              "description": "Occurred at or after (inclusive)",
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Occurred before (exclusive)",
            "in": "query",
            "name": "occurred_to",
            "required": false,
            "schema": {
              "description": "Occurred before (exclusive)",
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Return `total` (first page only)",
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "description": "Return `total` (first page only)",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditEventPage"
                }
              }
            },
            "description": "A page of audit events"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid filter or cursor"
          }
        },
        "summary": "Query audit events (newest first)",
        "tags": [
          "ops"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "ops.audit.read"
      }
    },
    "/api/v1/admin/audit-events/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "example": "42",
              "pattern": "^[1-9]\\d{0,15}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditEvent"
                }
              }
            },
            "description": "The audit event"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such audit event"
          }
        },
        "summary": "One audit event",
        "tags": [
          "ops"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "ops.audit.read"
      }
    },
    "/api/v1/admin/bulk-operations": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "enum": [
                "compensation",
                "notification",
                "marketing"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "enum": [
                "draft",
                "previewed",
                "scheduled",
                "running",
                "paused",
                "completed",
                "cancelled",
                "failed"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "default": "false",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "approval_required",
            "required": false,
            "schema": {
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "additionalProperties": {},
                        "properties": {
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "version": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "status",
                          "version"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bulk operation"
          }
        },
        "summary": "List bulk operations",
        "tags": [
          "bulk-operations"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "ops.bulk.manage"
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "actions": {
                    "items": {
                      "oneOf": [
                        {
                          "additionalProperties": false,
                          "properties": {
                            "id": {
                              "pattern": "^[a-z][a-z0-9_]{0,31}$",
                              "type": "string"
                            },
                            "period_count": {
                              "maximum": 3650,
                              "minimum": 1,
                              "type": "integer"
                            },
                            "period_unit": {
                              "enum": [
                                "day",
                                "month",
                                "year"
                              ],
                              "type": "string"
                            },
                            "plan_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "term_extend"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "type",
                            "period_unit",
                            "period_count"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "id": {
                              "pattern": "^[a-z][a-z0-9_]{0,31}$",
                              "type": "string"
                            },
                            "plan_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "traffic_bytes": {
                              "pattern": "^[1-9][0-9]{0,17}$",
                              "type": "string"
                            },
                            "type": {
                              "enum": [
                                "traffic_bonus"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "type",
                            "traffic_bytes"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "device_delta": {
                              "maximum": 10000,
                              "minimum": 1,
                              "type": "integer"
                            },
                            "expires_at": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "id": {
                              "pattern": "^[a-z][a-z0-9_]{0,31}$",
                              "type": "string"
                            },
                            "plan_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "device_bonus"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "type",
                            "device_delta"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "code_id": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "id": {
                              "pattern": "^[a-z][a-z0-9_]{0,31}$",
                              "type": "string"
                            },
                            "type": {
                              "enum": [
                                "issue_coupon"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "type",
                            "code_id"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "amount_minor": {
                              "pattern": "^[1-9][0-9]{0,17}$",
                              "type": "string"
                            },
                            "currency": {
                              "pattern": "^[A-Z]{3}$",
                              "type": "string"
                            },
                            "id": {
                              "pattern": "^[a-z][a-z0-9_]{0,31}$",
                              "type": "string"
                            },
                            "type": {
                              "enum": [
                                "gift_credit"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "type",
                            "amount_minor",
                            "currency"
                          ],
                          "type": "object"
                        }
                      ]
                    },
                    "maxItems": 20,
                    "type": "array"
                  },
                  "audience": {
                    "oneOf": [
                      {
                        "additionalProperties": false,
                        "properties": {
                          "emails": {
                            "default": [],
                            "items": {
                              "format": "email",
                              "type": "string"
                            },
                            "maxItems": 10000,
                            "type": "array"
                          },
                          "type": {
                            "enum": [
                              "list"
                            ],
                            "type": "string"
                          },
                          "user_ids": {
                            "default": [],
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "maxItems": 10000,
                            "type": "array"
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "type": "object"
                      },
                      {
                        "additionalProperties": false,
                        "properties": {
                          "created_from": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "created_to": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "has_active_subscription": {
                            "type": "boolean"
                          },
                          "invited_by": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "locale": {
                            "maxLength": 35,
                            "type": "string"
                          },
                          "node_tags": {
                            "items": {
                              "maxLength": 64,
                              "type": "string"
                            },
                            "maxItems": 100,
                            "type": "array"
                          },
                          "plan_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "maxItems": 100,
                            "type": "array"
                          },
                          "server_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "maxItems": 100,
                            "type": "array"
                          },
                          "status": {
                            "items": {
                              "enum": [
                                "active",
                                "disabled",
                                "banned",
                                "deactivating",
                                "deleted"
                              ],
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "subscription_ends_from": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "subscription_ends_to": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "subscription_status": {
                            "items": {
                              "enum": [
                                "scheduled",
                                "active",
                                "exhausted",
                                "expired",
                                "cancelled",
                                "refunded"
                              ],
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "type": {
                            "enum": [
                              "query"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "type": "object"
                      }
                    ]
                  },
                  "kind": {
                    "enum": [
                      "compensation",
                      "notification",
                      "marketing"
                    ],
                    "type": "string"
                  },
                  "name": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "notification": {
                    "additionalProperties": false,
                    "properties": {
                      "channels": {
                        "items": {
                          "enum": [
                            "email",
                            "inbox",
                            "telegram"
                          ],
                          "type": "string"
                        },
                        "maxItems": 3,
                        "minItems": 1,
                        "type": "array"
                      },
                      "template_key": {
                        "pattern": "^[a-z][a-z0-9_.]{1,100}$",
                        "type": "string"
                      },
                      "values": {
                        "additionalProperties": {},
                        "default": {},
                        "type": "object"
                      }
                    },
                    "required": [
                      "template_key",
                      "channels"
                    ],
                    "type": [
                      "object",
                      "null"
                    ]
                  }
                },
                "required": [
                  "name",
                  "kind",
                  "audience",
                  "actions",
                  "notification"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "actions": {
                      "items": {
                        "properties": {
                          "amount_minor": {
                            "type": "string"
                          },
                          "code_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "device_delta": {
                            "type": "number"
                          },
                          "expires_at": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "period_count": {
                            "type": "number"
                          },
                          "period_unit": {
                            "enum": [
                              "day",
                              "month",
                              "year"
                            ],
                            "type": "string"
                          },
                          "plan_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "traffic_bytes": {
                            "type": "string"
                          },
                          "type": {
                            "enum": [
                              "term_extend",
                              "traffic_bonus",
                              "device_bonus",
                              "issue_coupon",
                              "gift_credit"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "type"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "audience": {
                      "oneOf": [
                        {
                          "additionalProperties": false,
                          "properties": {
                            "emails": {
                              "default": [],
                              "items": {
                                "format": "email",
                                "type": "string"
                              },
                              "maxItems": 10000,
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "list"
                              ],
                              "type": "string"
                            },
                            "user_ids": {
                              "default": [],
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 10000,
                              "type": "array"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "created_from": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "created_to": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "has_active_subscription": {
                              "type": "boolean"
                            },
                            "invited_by": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "locale": {
                              "maxLength": 35,
                              "type": "string"
                            },
                            "node_tags": {
                              "items": {
                                "maxLength": 64,
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "plan_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "server_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "status": {
                              "items": {
                                "enum": [
                                  "active",
                                  "disabled",
                                  "banned",
                                  "deactivating",
                                  "deleted"
                                ],
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "subscription_ends_from": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "subscription_ends_to": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "subscription_status": {
                              "items": {
                                "enum": [
                                  "scheduled",
                                  "active",
                                  "exhausted",
                                  "expired",
                                  "cancelled",
                                  "refunded"
                                ],
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "query"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        }
                      ]
                    },
                    "created_by": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "done_count": {
                      "type": "number"
                    },
                    "executed_by": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "failed_count": {
                      "type": "number"
                    },
                    "failures": {
                      "items": {
                        "properties": {
                          "reason": {
                            "type": "string"
                          },
                          "user_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "user_id",
                          "reason"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "compensation",
                        "notification",
                        "marketing"
                      ],
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "notification": {
                      "additionalProperties": false,
                      "properties": {
                        "channels": {
                          "items": {
                            "enum": [
                              "email",
                              "inbox",
                              "telegram"
                            ],
                            "type": "string"
                          },
                          "maxItems": 3,
                          "minItems": 1,
                          "type": "array"
                        },
                        "template_key": {
                          "pattern": "^[a-z][a-z0-9_.]{1,100}$",
                          "type": "string"
                        },
                        "values": {
                          "additionalProperties": {},
                          "default": {},
                          "type": "object"
                        }
                      },
                      "required": [
                        "template_key",
                        "channels"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "preview": {
                      "properties": {
                        "actions": {
                          "items": {
                            "properties": {
                              "amount_minor": {
                                "type": "string"
                              },
                              "code_id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "currency": {
                                "type": "string"
                              },
                              "device_delta": {
                                "type": "number"
                              },
                              "expires_at": {
                                "type": "string"
                              },
                              "id": {
                                "type": "string"
                              },
                              "period_count": {
                                "type": "number"
                              },
                              "period_unit": {
                                "enum": [
                                  "day",
                                  "month",
                                  "year"
                                ],
                                "type": "string"
                              },
                              "plan_ids": {
                                "items": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "type": "array"
                              },
                              "traffic_bytes": {
                                "type": "string"
                              },
                              "type": {
                                "enum": [
                                  "term_extend",
                                  "traffic_bonus",
                                  "device_bonus",
                                  "issue_coupon",
                                  "gift_credit"
                                ],
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "type"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "approval_required": {
                          "type": "boolean"
                        },
                        "approved_at": {
                          "type": "string"
                        },
                        "approved_by": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "at": {
                          "type": "string"
                        },
                        "audience_hash": {
                          "type": "string"
                        },
                        "count": {
                          "type": "number"
                        },
                        "notification_missing_templates": {
                          "items": {
                            "properties": {
                              "channel": {
                                "type": "string"
                              },
                              "locale": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "channel",
                              "locale"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "sample": {
                          "items": {
                            "properties": {
                              "id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "public_id": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "public_id"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        }
                      },
                      "required": [
                        "count",
                        "sample",
                        "at",
                        "actions"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "scheduled_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "skipped_count": {
                      "type": "number"
                    },
                    "status": {
                      "type": "string"
                    },
                    "target_count": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "kind",
                    "scheduled_at",
                    "audience",
                    "actions",
                    "notification",
                    "status",
                    "version",
                    "preview",
                    "target_count",
                    "done_count",
                    "skipped_count",
                    "failed_count",
                    "failures",
                    "created_by",
                    "executed_by"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bulk operation",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Create a draft bulk operation",
        "tags": [
          "bulk-operations"
        ],
        "x-audit": "ops.bulk.create",
        "x-body": "json",
        "x-body-limit": 1048576,
        "x-concurrency": {
          "etag": true
        },
        "x-idempotency": "required",
        "x-permission": "ops.bulk.manage"
      }
    },
    "/api/v1/admin/bulk-operations/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "actions": {
                      "items": {
                        "properties": {
                          "amount_minor": {
                            "type": "string"
                          },
                          "code_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "device_delta": {
                            "type": "number"
                          },
                          "expires_at": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "period_count": {
                            "type": "number"
                          },
                          "period_unit": {
                            "enum": [
                              "day",
                              "month",
                              "year"
                            ],
                            "type": "string"
                          },
                          "plan_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "traffic_bytes": {
                            "type": "string"
                          },
                          "type": {
                            "enum": [
                              "term_extend",
                              "traffic_bonus",
                              "device_bonus",
                              "issue_coupon",
                              "gift_credit"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "type"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "audience": {
                      "oneOf": [
                        {
                          "additionalProperties": false,
                          "properties": {
                            "emails": {
                              "default": [],
                              "items": {
                                "format": "email",
                                "type": "string"
                              },
                              "maxItems": 10000,
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "list"
                              ],
                              "type": "string"
                            },
                            "user_ids": {
                              "default": [],
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 10000,
                              "type": "array"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "created_from": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "created_to": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "has_active_subscription": {
                              "type": "boolean"
                            },
                            "invited_by": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "locale": {
                              "maxLength": 35,
                              "type": "string"
                            },
                            "node_tags": {
                              "items": {
                                "maxLength": 64,
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "plan_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "server_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "status": {
                              "items": {
                                "enum": [
                                  "active",
                                  "disabled",
                                  "banned",
                                  "deactivating",
                                  "deleted"
                                ],
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "subscription_ends_from": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "subscription_ends_to": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "subscription_status": {
                              "items": {
                                "enum": [
                                  "scheduled",
                                  "active",
                                  "exhausted",
                                  "expired",
                                  "cancelled",
                                  "refunded"
                                ],
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "query"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        }
                      ]
                    },
                    "created_by": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "done_count": {
                      "type": "number"
                    },
                    "executed_by": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "failed_count": {
                      "type": "number"
                    },
                    "failures": {
                      "items": {
                        "properties": {
                          "reason": {
                            "type": "string"
                          },
                          "user_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "user_id",
                          "reason"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "compensation",
                        "notification",
                        "marketing"
                      ],
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "notification": {
                      "additionalProperties": false,
                      "properties": {
                        "channels": {
                          "items": {
                            "enum": [
                              "email",
                              "inbox",
                              "telegram"
                            ],
                            "type": "string"
                          },
                          "maxItems": 3,
                          "minItems": 1,
                          "type": "array"
                        },
                        "template_key": {
                          "pattern": "^[a-z][a-z0-9_.]{1,100}$",
                          "type": "string"
                        },
                        "values": {
                          "additionalProperties": {},
                          "default": {},
                          "type": "object"
                        }
                      },
                      "required": [
                        "template_key",
                        "channels"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "preview": {
                      "properties": {
                        "actions": {
                          "items": {
                            "properties": {
                              "amount_minor": {
                                "type": "string"
                              },
                              "code_id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "currency": {
                                "type": "string"
                              },
                              "device_delta": {
                                "type": "number"
                              },
                              "expires_at": {
                                "type": "string"
                              },
                              "id": {
                                "type": "string"
                              },
                              "period_count": {
                                "type": "number"
                              },
                              "period_unit": {
                                "enum": [
                                  "day",
                                  "month",
                                  "year"
                                ],
                                "type": "string"
                              },
                              "plan_ids": {
                                "items": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "type": "array"
                              },
                              "traffic_bytes": {
                                "type": "string"
                              },
                              "type": {
                                "enum": [
                                  "term_extend",
                                  "traffic_bonus",
                                  "device_bonus",
                                  "issue_coupon",
                                  "gift_credit"
                                ],
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "type"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "approval_required": {
                          "type": "boolean"
                        },
                        "approved_at": {
                          "type": "string"
                        },
                        "approved_by": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "at": {
                          "type": "string"
                        },
                        "audience_hash": {
                          "type": "string"
                        },
                        "count": {
                          "type": "number"
                        },
                        "notification_missing_templates": {
                          "items": {
                            "properties": {
                              "channel": {
                                "type": "string"
                              },
                              "locale": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "channel",
                              "locale"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "sample": {
                          "items": {
                            "properties": {
                              "id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "public_id": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "public_id"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        }
                      },
                      "required": [
                        "count",
                        "sample",
                        "at",
                        "actions"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "scheduled_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "skipped_count": {
                      "type": "number"
                    },
                    "status": {
                      "type": "string"
                    },
                    "target_count": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "kind",
                    "scheduled_at",
                    "audience",
                    "actions",
                    "notification",
                    "status",
                    "version",
                    "preview",
                    "target_count",
                    "done_count",
                    "skipped_count",
                    "failed_count",
                    "failures",
                    "created_by",
                    "executed_by"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bulk operation",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Read a bulk operation",
        "tags": [
          "bulk-operations"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "ops.bulk.manage"
      },
      "patch": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "actions": {
                    "items": {
                      "oneOf": [
                        {
                          "additionalProperties": false,
                          "properties": {
                            "id": {
                              "pattern": "^[a-z][a-z0-9_]{0,31}$",
                              "type": "string"
                            },
                            "period_count": {
                              "maximum": 3650,
                              "minimum": 1,
                              "type": "integer"
                            },
                            "period_unit": {
                              "enum": [
                                "day",
                                "month",
                                "year"
                              ],
                              "type": "string"
                            },
                            "plan_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "term_extend"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "type",
                            "period_unit",
                            "period_count"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "id": {
                              "pattern": "^[a-z][a-z0-9_]{0,31}$",
                              "type": "string"
                            },
                            "plan_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "traffic_bytes": {
                              "pattern": "^[1-9][0-9]{0,17}$",
                              "type": "string"
                            },
                            "type": {
                              "enum": [
                                "traffic_bonus"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "type",
                            "traffic_bytes"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "device_delta": {
                              "maximum": 10000,
                              "minimum": 1,
                              "type": "integer"
                            },
                            "expires_at": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "id": {
                              "pattern": "^[a-z][a-z0-9_]{0,31}$",
                              "type": "string"
                            },
                            "plan_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "device_bonus"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "type",
                            "device_delta"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "code_id": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "id": {
                              "pattern": "^[a-z][a-z0-9_]{0,31}$",
                              "type": "string"
                            },
                            "type": {
                              "enum": [
                                "issue_coupon"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "type",
                            "code_id"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "amount_minor": {
                              "pattern": "^[1-9][0-9]{0,17}$",
                              "type": "string"
                            },
                            "currency": {
                              "pattern": "^[A-Z]{3}$",
                              "type": "string"
                            },
                            "id": {
                              "pattern": "^[a-z][a-z0-9_]{0,31}$",
                              "type": "string"
                            },
                            "type": {
                              "enum": [
                                "gift_credit"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "type",
                            "amount_minor",
                            "currency"
                          ],
                          "type": "object"
                        }
                      ]
                    },
                    "maxItems": 20,
                    "type": "array"
                  },
                  "audience": {
                    "oneOf": [
                      {
                        "additionalProperties": false,
                        "properties": {
                          "emails": {
                            "default": [],
                            "items": {
                              "format": "email",
                              "type": "string"
                            },
                            "maxItems": 10000,
                            "type": "array"
                          },
                          "type": {
                            "enum": [
                              "list"
                            ],
                            "type": "string"
                          },
                          "user_ids": {
                            "default": [],
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "maxItems": 10000,
                            "type": "array"
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "type": "object"
                      },
                      {
                        "additionalProperties": false,
                        "properties": {
                          "created_from": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "created_to": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "has_active_subscription": {
                            "type": "boolean"
                          },
                          "invited_by": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "locale": {
                            "maxLength": 35,
                            "type": "string"
                          },
                          "node_tags": {
                            "items": {
                              "maxLength": 64,
                              "type": "string"
                            },
                            "maxItems": 100,
                            "type": "array"
                          },
                          "plan_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "maxItems": 100,
                            "type": "array"
                          },
                          "server_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "maxItems": 100,
                            "type": "array"
                          },
                          "status": {
                            "items": {
                              "enum": [
                                "active",
                                "disabled",
                                "banned",
                                "deactivating",
                                "deleted"
                              ],
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "subscription_ends_from": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "subscription_ends_to": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "subscription_status": {
                            "items": {
                              "enum": [
                                "scheduled",
                                "active",
                                "exhausted",
                                "expired",
                                "cancelled",
                                "refunded"
                              ],
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "type": {
                            "enum": [
                              "query"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "type": "object"
                      }
                    ]
                  },
                  "kind": {
                    "enum": [
                      "compensation",
                      "notification",
                      "marketing"
                    ],
                    "type": "string"
                  },
                  "name": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "notification": {
                    "additionalProperties": false,
                    "properties": {
                      "channels": {
                        "items": {
                          "enum": [
                            "email",
                            "inbox",
                            "telegram"
                          ],
                          "type": "string"
                        },
                        "maxItems": 3,
                        "minItems": 1,
                        "type": "array"
                      },
                      "template_key": {
                        "pattern": "^[a-z][a-z0-9_.]{1,100}$",
                        "type": "string"
                      },
                      "values": {
                        "additionalProperties": {},
                        "default": {},
                        "type": "object"
                      }
                    },
                    "required": [
                      "template_key",
                      "channels"
                    ],
                    "type": [
                      "object",
                      "null"
                    ]
                  }
                },
                "required": [
                  "name",
                  "kind",
                  "audience",
                  "actions",
                  "notification"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "actions": {
                      "items": {
                        "properties": {
                          "amount_minor": {
                            "type": "string"
                          },
                          "code_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "device_delta": {
                            "type": "number"
                          },
                          "expires_at": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "period_count": {
                            "type": "number"
                          },
                          "period_unit": {
                            "enum": [
                              "day",
                              "month",
                              "year"
                            ],
                            "type": "string"
                          },
                          "plan_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "traffic_bytes": {
                            "type": "string"
                          },
                          "type": {
                            "enum": [
                              "term_extend",
                              "traffic_bonus",
                              "device_bonus",
                              "issue_coupon",
                              "gift_credit"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "type"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "audience": {
                      "oneOf": [
                        {
                          "additionalProperties": false,
                          "properties": {
                            "emails": {
                              "default": [],
                              "items": {
                                "format": "email",
                                "type": "string"
                              },
                              "maxItems": 10000,
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "list"
                              ],
                              "type": "string"
                            },
                            "user_ids": {
                              "default": [],
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 10000,
                              "type": "array"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "created_from": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "created_to": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "has_active_subscription": {
                              "type": "boolean"
                            },
                            "invited_by": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "locale": {
                              "maxLength": 35,
                              "type": "string"
                            },
                            "node_tags": {
                              "items": {
                                "maxLength": 64,
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "plan_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "server_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "status": {
                              "items": {
                                "enum": [
                                  "active",
                                  "disabled",
                                  "banned",
                                  "deactivating",
                                  "deleted"
                                ],
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "subscription_ends_from": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "subscription_ends_to": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "subscription_status": {
                              "items": {
                                "enum": [
                                  "scheduled",
                                  "active",
                                  "exhausted",
                                  "expired",
                                  "cancelled",
                                  "refunded"
                                ],
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "query"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        }
                      ]
                    },
                    "created_by": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "done_count": {
                      "type": "number"
                    },
                    "executed_by": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "failed_count": {
                      "type": "number"
                    },
                    "failures": {
                      "items": {
                        "properties": {
                          "reason": {
                            "type": "string"
                          },
                          "user_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "user_id",
                          "reason"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "compensation",
                        "notification",
                        "marketing"
                      ],
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "notification": {
                      "additionalProperties": false,
                      "properties": {
                        "channels": {
                          "items": {
                            "enum": [
                              "email",
                              "inbox",
                              "telegram"
                            ],
                            "type": "string"
                          },
                          "maxItems": 3,
                          "minItems": 1,
                          "type": "array"
                        },
                        "template_key": {
                          "pattern": "^[a-z][a-z0-9_.]{1,100}$",
                          "type": "string"
                        },
                        "values": {
                          "additionalProperties": {},
                          "default": {},
                          "type": "object"
                        }
                      },
                      "required": [
                        "template_key",
                        "channels"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "preview": {
                      "properties": {
                        "actions": {
                          "items": {
                            "properties": {
                              "amount_minor": {
                                "type": "string"
                              },
                              "code_id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "currency": {
                                "type": "string"
                              },
                              "device_delta": {
                                "type": "number"
                              },
                              "expires_at": {
                                "type": "string"
                              },
                              "id": {
                                "type": "string"
                              },
                              "period_count": {
                                "type": "number"
                              },
                              "period_unit": {
                                "enum": [
                                  "day",
                                  "month",
                                  "year"
                                ],
                                "type": "string"
                              },
                              "plan_ids": {
                                "items": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "type": "array"
                              },
                              "traffic_bytes": {
                                "type": "string"
                              },
                              "type": {
                                "enum": [
                                  "term_extend",
                                  "traffic_bonus",
                                  "device_bonus",
                                  "issue_coupon",
                                  "gift_credit"
                                ],
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "type"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "approval_required": {
                          "type": "boolean"
                        },
                        "approved_at": {
                          "type": "string"
                        },
                        "approved_by": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "at": {
                          "type": "string"
                        },
                        "audience_hash": {
                          "type": "string"
                        },
                        "count": {
                          "type": "number"
                        },
                        "notification_missing_templates": {
                          "items": {
                            "properties": {
                              "channel": {
                                "type": "string"
                              },
                              "locale": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "channel",
                              "locale"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "sample": {
                          "items": {
                            "properties": {
                              "id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "public_id": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "public_id"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        }
                      },
                      "required": [
                        "count",
                        "sample",
                        "at",
                        "actions"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "scheduled_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "skipped_count": {
                      "type": "number"
                    },
                    "status": {
                      "type": "string"
                    },
                    "target_count": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "kind",
                    "scheduled_at",
                    "audience",
                    "actions",
                    "notification",
                    "status",
                    "version",
                    "preview",
                    "target_count",
                    "done_count",
                    "skipped_count",
                    "failed_count",
                    "failures",
                    "created_by",
                    "executed_by"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bulk operation",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          }
        },
        "summary": "Edit a draft and invalidate its preview",
        "tags": [
          "bulk-operations"
        ],
        "x-audit": "ops.bulk.update",
        "x-body": "json",
        "x-body-limit": 1048576,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "ops.bulk.manage"
      }
    },
    "/api/v1/admin/bulk-operations/{id}/approve": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "actions": {
                      "items": {
                        "properties": {
                          "amount_minor": {
                            "type": "string"
                          },
                          "code_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "device_delta": {
                            "type": "number"
                          },
                          "expires_at": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "period_count": {
                            "type": "number"
                          },
                          "period_unit": {
                            "enum": [
                              "day",
                              "month",
                              "year"
                            ],
                            "type": "string"
                          },
                          "plan_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "traffic_bytes": {
                            "type": "string"
                          },
                          "type": {
                            "enum": [
                              "term_extend",
                              "traffic_bonus",
                              "device_bonus",
                              "issue_coupon",
                              "gift_credit"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "type"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "audience": {
                      "oneOf": [
                        {
                          "additionalProperties": false,
                          "properties": {
                            "emails": {
                              "default": [],
                              "items": {
                                "format": "email",
                                "type": "string"
                              },
                              "maxItems": 10000,
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "list"
                              ],
                              "type": "string"
                            },
                            "user_ids": {
                              "default": [],
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 10000,
                              "type": "array"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "created_from": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "created_to": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "has_active_subscription": {
                              "type": "boolean"
                            },
                            "invited_by": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "locale": {
                              "maxLength": 35,
                              "type": "string"
                            },
                            "node_tags": {
                              "items": {
                                "maxLength": 64,
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "plan_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "server_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "status": {
                              "items": {
                                "enum": [
                                  "active",
                                  "disabled",
                                  "banned",
                                  "deactivating",
                                  "deleted"
                                ],
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "subscription_ends_from": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "subscription_ends_to": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "subscription_status": {
                              "items": {
                                "enum": [
                                  "scheduled",
                                  "active",
                                  "exhausted",
                                  "expired",
                                  "cancelled",
                                  "refunded"
                                ],
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "query"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        }
                      ]
                    },
                    "created_by": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "done_count": {
                      "type": "number"
                    },
                    "executed_by": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "failed_count": {
                      "type": "number"
                    },
                    "failures": {
                      "items": {
                        "properties": {
                          "reason": {
                            "type": "string"
                          },
                          "user_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "user_id",
                          "reason"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "compensation",
                        "notification",
                        "marketing"
                      ],
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "notification": {
                      "additionalProperties": false,
                      "properties": {
                        "channels": {
                          "items": {
                            "enum": [
                              "email",
                              "inbox",
                              "telegram"
                            ],
                            "type": "string"
                          },
                          "maxItems": 3,
                          "minItems": 1,
                          "type": "array"
                        },
                        "template_key": {
                          "pattern": "^[a-z][a-z0-9_.]{1,100}$",
                          "type": "string"
                        },
                        "values": {
                          "additionalProperties": {},
                          "default": {},
                          "type": "object"
                        }
                      },
                      "required": [
                        "template_key",
                        "channels"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "preview": {
                      "properties": {
                        "actions": {
                          "items": {
                            "properties": {
                              "amount_minor": {
                                "type": "string"
                              },
                              "code_id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "currency": {
                                "type": "string"
                              },
                              "device_delta": {
                                "type": "number"
                              },
                              "expires_at": {
                                "type": "string"
                              },
                              "id": {
                                "type": "string"
                              },
                              "period_count": {
                                "type": "number"
                              },
                              "period_unit": {
                                "enum": [
                                  "day",
                                  "month",
                                  "year"
                                ],
                                "type": "string"
                              },
                              "plan_ids": {
                                "items": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "type": "array"
                              },
                              "traffic_bytes": {
                                "type": "string"
                              },
                              "type": {
                                "enum": [
                                  "term_extend",
                                  "traffic_bonus",
                                  "device_bonus",
                                  "issue_coupon",
                                  "gift_credit"
                                ],
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "type"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "approval_required": {
                          "type": "boolean"
                        },
                        "approved_at": {
                          "type": "string"
                        },
                        "approved_by": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "at": {
                          "type": "string"
                        },
                        "audience_hash": {
                          "type": "string"
                        },
                        "count": {
                          "type": "number"
                        },
                        "notification_missing_templates": {
                          "items": {
                            "properties": {
                              "channel": {
                                "type": "string"
                              },
                              "locale": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "channel",
                              "locale"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "sample": {
                          "items": {
                            "properties": {
                              "id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "public_id": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "public_id"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        }
                      },
                      "required": [
                        "count",
                        "sample",
                        "at",
                        "actions"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "scheduled_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "skipped_count": {
                      "type": "number"
                    },
                    "status": {
                      "type": "string"
                    },
                    "target_count": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "kind",
                    "scheduled_at",
                    "audience",
                    "actions",
                    "notification",
                    "status",
                    "version",
                    "preview",
                    "target_count",
                    "done_count",
                    "skipped_count",
                    "failed_count",
                    "failures",
                    "created_by",
                    "executed_by"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bulk operation",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          }
        },
        "summary": "Approve the current preview as a second staff member",
        "tags": [
          "bulk-operations"
        ],
        "x-audit": "ops.bulk.approve",
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "ops.bulk.execute",
        "x-reauth": true
      }
    },
    "/api/v1/admin/bulk-operations/{id}/cancel": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "actions": {
                      "items": {
                        "properties": {
                          "amount_minor": {
                            "type": "string"
                          },
                          "code_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "device_delta": {
                            "type": "number"
                          },
                          "expires_at": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "period_count": {
                            "type": "number"
                          },
                          "period_unit": {
                            "enum": [
                              "day",
                              "month",
                              "year"
                            ],
                            "type": "string"
                          },
                          "plan_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "traffic_bytes": {
                            "type": "string"
                          },
                          "type": {
                            "enum": [
                              "term_extend",
                              "traffic_bonus",
                              "device_bonus",
                              "issue_coupon",
                              "gift_credit"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "type"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "audience": {
                      "oneOf": [
                        {
                          "additionalProperties": false,
                          "properties": {
                            "emails": {
                              "default": [],
                              "items": {
                                "format": "email",
                                "type": "string"
                              },
                              "maxItems": 10000,
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "list"
                              ],
                              "type": "string"
                            },
                            "user_ids": {
                              "default": [],
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 10000,
                              "type": "array"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "created_from": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "created_to": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "has_active_subscription": {
                              "type": "boolean"
                            },
                            "invited_by": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "locale": {
                              "maxLength": 35,
                              "type": "string"
                            },
                            "node_tags": {
                              "items": {
                                "maxLength": 64,
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "plan_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "server_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "status": {
                              "items": {
                                "enum": [
                                  "active",
                                  "disabled",
                                  "banned",
                                  "deactivating",
                                  "deleted"
                                ],
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "subscription_ends_from": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "subscription_ends_to": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "subscription_status": {
                              "items": {
                                "enum": [
                                  "scheduled",
                                  "active",
                                  "exhausted",
                                  "expired",
                                  "cancelled",
                                  "refunded"
                                ],
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "query"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        }
                      ]
                    },
                    "created_by": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "done_count": {
                      "type": "number"
                    },
                    "executed_by": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "failed_count": {
                      "type": "number"
                    },
                    "failures": {
                      "items": {
                        "properties": {
                          "reason": {
                            "type": "string"
                          },
                          "user_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "user_id",
                          "reason"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "compensation",
                        "notification",
                        "marketing"
                      ],
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "notification": {
                      "additionalProperties": false,
                      "properties": {
                        "channels": {
                          "items": {
                            "enum": [
                              "email",
                              "inbox",
                              "telegram"
                            ],
                            "type": "string"
                          },
                          "maxItems": 3,
                          "minItems": 1,
                          "type": "array"
                        },
                        "template_key": {
                          "pattern": "^[a-z][a-z0-9_.]{1,100}$",
                          "type": "string"
                        },
                        "values": {
                          "additionalProperties": {},
                          "default": {},
                          "type": "object"
                        }
                      },
                      "required": [
                        "template_key",
                        "channels"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "preview": {
                      "properties": {
                        "actions": {
                          "items": {
                            "properties": {
                              "amount_minor": {
                                "type": "string"
                              },
                              "code_id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "currency": {
                                "type": "string"
                              },
                              "device_delta": {
                                "type": "number"
                              },
                              "expires_at": {
                                "type": "string"
                              },
                              "id": {
                                "type": "string"
                              },
                              "period_count": {
                                "type": "number"
                              },
                              "period_unit": {
                                "enum": [
                                  "day",
                                  "month",
                                  "year"
                                ],
                                "type": "string"
                              },
                              "plan_ids": {
                                "items": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "type": "array"
                              },
                              "traffic_bytes": {
                                "type": "string"
                              },
                              "type": {
                                "enum": [
                                  "term_extend",
                                  "traffic_bonus",
                                  "device_bonus",
                                  "issue_coupon",
                                  "gift_credit"
                                ],
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "type"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "approval_required": {
                          "type": "boolean"
                        },
                        "approved_at": {
                          "type": "string"
                        },
                        "approved_by": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "at": {
                          "type": "string"
                        },
                        "audience_hash": {
                          "type": "string"
                        },
                        "count": {
                          "type": "number"
                        },
                        "notification_missing_templates": {
                          "items": {
                            "properties": {
                              "channel": {
                                "type": "string"
                              },
                              "locale": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "channel",
                              "locale"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "sample": {
                          "items": {
                            "properties": {
                              "id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "public_id": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "public_id"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        }
                      },
                      "required": [
                        "count",
                        "sample",
                        "at",
                        "actions"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "scheduled_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "skipped_count": {
                      "type": "number"
                    },
                    "status": {
                      "type": "string"
                    },
                    "target_count": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "kind",
                    "scheduled_at",
                    "audience",
                    "actions",
                    "notification",
                    "status",
                    "version",
                    "preview",
                    "target_count",
                    "done_count",
                    "skipped_count",
                    "failed_count",
                    "failures",
                    "created_by",
                    "executed_by"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bulk operation",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          }
        },
        "summary": "cancel a bulk operation with If-Match",
        "tags": [
          "bulk-operations"
        ],
        "x-audit": "ops.bulk.cancel",
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "ops.bulk.manage"
      }
    },
    "/api/v1/admin/bulk-operations/{id}/execute": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "actions": {
                      "items": {
                        "properties": {
                          "amount_minor": {
                            "type": "string"
                          },
                          "code_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "device_delta": {
                            "type": "number"
                          },
                          "expires_at": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "period_count": {
                            "type": "number"
                          },
                          "period_unit": {
                            "enum": [
                              "day",
                              "month",
                              "year"
                            ],
                            "type": "string"
                          },
                          "plan_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "traffic_bytes": {
                            "type": "string"
                          },
                          "type": {
                            "enum": [
                              "term_extend",
                              "traffic_bonus",
                              "device_bonus",
                              "issue_coupon",
                              "gift_credit"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "type"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "audience": {
                      "oneOf": [
                        {
                          "additionalProperties": false,
                          "properties": {
                            "emails": {
                              "default": [],
                              "items": {
                                "format": "email",
                                "type": "string"
                              },
                              "maxItems": 10000,
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "list"
                              ],
                              "type": "string"
                            },
                            "user_ids": {
                              "default": [],
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 10000,
                              "type": "array"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "created_from": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "created_to": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "has_active_subscription": {
                              "type": "boolean"
                            },
                            "invited_by": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "locale": {
                              "maxLength": 35,
                              "type": "string"
                            },
                            "node_tags": {
                              "items": {
                                "maxLength": 64,
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "plan_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "server_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "status": {
                              "items": {
                                "enum": [
                                  "active",
                                  "disabled",
                                  "banned",
                                  "deactivating",
                                  "deleted"
                                ],
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "subscription_ends_from": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "subscription_ends_to": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "subscription_status": {
                              "items": {
                                "enum": [
                                  "scheduled",
                                  "active",
                                  "exhausted",
                                  "expired",
                                  "cancelled",
                                  "refunded"
                                ],
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "query"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        }
                      ]
                    },
                    "created_by": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "done_count": {
                      "type": "number"
                    },
                    "executed_by": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "failed_count": {
                      "type": "number"
                    },
                    "failures": {
                      "items": {
                        "properties": {
                          "reason": {
                            "type": "string"
                          },
                          "user_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "user_id",
                          "reason"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "compensation",
                        "notification",
                        "marketing"
                      ],
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "notification": {
                      "additionalProperties": false,
                      "properties": {
                        "channels": {
                          "items": {
                            "enum": [
                              "email",
                              "inbox",
                              "telegram"
                            ],
                            "type": "string"
                          },
                          "maxItems": 3,
                          "minItems": 1,
                          "type": "array"
                        },
                        "template_key": {
                          "pattern": "^[a-z][a-z0-9_.]{1,100}$",
                          "type": "string"
                        },
                        "values": {
                          "additionalProperties": {},
                          "default": {},
                          "type": "object"
                        }
                      },
                      "required": [
                        "template_key",
                        "channels"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "preview": {
                      "properties": {
                        "actions": {
                          "items": {
                            "properties": {
                              "amount_minor": {
                                "type": "string"
                              },
                              "code_id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "currency": {
                                "type": "string"
                              },
                              "device_delta": {
                                "type": "number"
                              },
                              "expires_at": {
                                "type": "string"
                              },
                              "id": {
                                "type": "string"
                              },
                              "period_count": {
                                "type": "number"
                              },
                              "period_unit": {
                                "enum": [
                                  "day",
                                  "month",
                                  "year"
                                ],
                                "type": "string"
                              },
                              "plan_ids": {
                                "items": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "type": "array"
                              },
                              "traffic_bytes": {
                                "type": "string"
                              },
                              "type": {
                                "enum": [
                                  "term_extend",
                                  "traffic_bonus",
                                  "device_bonus",
                                  "issue_coupon",
                                  "gift_credit"
                                ],
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "type"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "approval_required": {
                          "type": "boolean"
                        },
                        "approved_at": {
                          "type": "string"
                        },
                        "approved_by": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "at": {
                          "type": "string"
                        },
                        "audience_hash": {
                          "type": "string"
                        },
                        "count": {
                          "type": "number"
                        },
                        "notification_missing_templates": {
                          "items": {
                            "properties": {
                              "channel": {
                                "type": "string"
                              },
                              "locale": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "channel",
                              "locale"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "sample": {
                          "items": {
                            "properties": {
                              "id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "public_id": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "public_id"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        }
                      },
                      "required": [
                        "count",
                        "sample",
                        "at",
                        "actions"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "scheduled_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "skipped_count": {
                      "type": "number"
                    },
                    "status": {
                      "type": "string"
                    },
                    "target_count": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "kind",
                    "scheduled_at",
                    "audience",
                    "actions",
                    "notification",
                    "status",
                    "version",
                    "preview",
                    "target_count",
                    "done_count",
                    "skipped_count",
                    "failed_count",
                    "failures",
                    "created_by",
                    "executed_by"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bulk operation",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          }
        },
        "summary": "Execute the preview (If-Match, reauthentication and action permissions)",
        "tags": [
          "bulk-operations"
        ],
        "x-audit": "ops.bulk.execute",
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "ops.bulk.manage",
        "x-reauth": true
      }
    },
    "/api/v1/admin/bulk-operations/{id}/failures.csv": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Failure CSV"
          }
        },
        "summary": "Download all failed recipients",
        "tags": [
          "bulk-operations"
        ],
        "x-audit": "ops.bulk.export_failures",
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "ops.bulk.manage"
      }
    },
    "/api/v1/admin/bulk-operations/{id}/pause": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "actions": {
                      "items": {
                        "properties": {
                          "amount_minor": {
                            "type": "string"
                          },
                          "code_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "device_delta": {
                            "type": "number"
                          },
                          "expires_at": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "period_count": {
                            "type": "number"
                          },
                          "period_unit": {
                            "enum": [
                              "day",
                              "month",
                              "year"
                            ],
                            "type": "string"
                          },
                          "plan_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "traffic_bytes": {
                            "type": "string"
                          },
                          "type": {
                            "enum": [
                              "term_extend",
                              "traffic_bonus",
                              "device_bonus",
                              "issue_coupon",
                              "gift_credit"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "type"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "audience": {
                      "oneOf": [
                        {
                          "additionalProperties": false,
                          "properties": {
                            "emails": {
                              "default": [],
                              "items": {
                                "format": "email",
                                "type": "string"
                              },
                              "maxItems": 10000,
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "list"
                              ],
                              "type": "string"
                            },
                            "user_ids": {
                              "default": [],
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 10000,
                              "type": "array"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "created_from": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "created_to": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "has_active_subscription": {
                              "type": "boolean"
                            },
                            "invited_by": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "locale": {
                              "maxLength": 35,
                              "type": "string"
                            },
                            "node_tags": {
                              "items": {
                                "maxLength": 64,
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "plan_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "server_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "status": {
                              "items": {
                                "enum": [
                                  "active",
                                  "disabled",
                                  "banned",
                                  "deactivating",
                                  "deleted"
                                ],
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "subscription_ends_from": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "subscription_ends_to": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "subscription_status": {
                              "items": {
                                "enum": [
                                  "scheduled",
                                  "active",
                                  "exhausted",
                                  "expired",
                                  "cancelled",
                                  "refunded"
                                ],
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "query"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        }
                      ]
                    },
                    "created_by": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "done_count": {
                      "type": "number"
                    },
                    "executed_by": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "failed_count": {
                      "type": "number"
                    },
                    "failures": {
                      "items": {
                        "properties": {
                          "reason": {
                            "type": "string"
                          },
                          "user_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "user_id",
                          "reason"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "compensation",
                        "notification",
                        "marketing"
                      ],
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "notification": {
                      "additionalProperties": false,
                      "properties": {
                        "channels": {
                          "items": {
                            "enum": [
                              "email",
                              "inbox",
                              "telegram"
                            ],
                            "type": "string"
                          },
                          "maxItems": 3,
                          "minItems": 1,
                          "type": "array"
                        },
                        "template_key": {
                          "pattern": "^[a-z][a-z0-9_.]{1,100}$",
                          "type": "string"
                        },
                        "values": {
                          "additionalProperties": {},
                          "default": {},
                          "type": "object"
                        }
                      },
                      "required": [
                        "template_key",
                        "channels"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "preview": {
                      "properties": {
                        "actions": {
                          "items": {
                            "properties": {
                              "amount_minor": {
                                "type": "string"
                              },
                              "code_id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "currency": {
                                "type": "string"
                              },
                              "device_delta": {
                                "type": "number"
                              },
                              "expires_at": {
                                "type": "string"
                              },
                              "id": {
                                "type": "string"
                              },
                              "period_count": {
                                "type": "number"
                              },
                              "period_unit": {
                                "enum": [
                                  "day",
                                  "month",
                                  "year"
                                ],
                                "type": "string"
                              },
                              "plan_ids": {
                                "items": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "type": "array"
                              },
                              "traffic_bytes": {
                                "type": "string"
                              },
                              "type": {
                                "enum": [
                                  "term_extend",
                                  "traffic_bonus",
                                  "device_bonus",
                                  "issue_coupon",
                                  "gift_credit"
                                ],
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "type"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "approval_required": {
                          "type": "boolean"
                        },
                        "approved_at": {
                          "type": "string"
                        },
                        "approved_by": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "at": {
                          "type": "string"
                        },
                        "audience_hash": {
                          "type": "string"
                        },
                        "count": {
                          "type": "number"
                        },
                        "notification_missing_templates": {
                          "items": {
                            "properties": {
                              "channel": {
                                "type": "string"
                              },
                              "locale": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "channel",
                              "locale"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "sample": {
                          "items": {
                            "properties": {
                              "id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "public_id": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "public_id"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        }
                      },
                      "required": [
                        "count",
                        "sample",
                        "at",
                        "actions"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "scheduled_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "skipped_count": {
                      "type": "number"
                    },
                    "status": {
                      "type": "string"
                    },
                    "target_count": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "kind",
                    "scheduled_at",
                    "audience",
                    "actions",
                    "notification",
                    "status",
                    "version",
                    "preview",
                    "target_count",
                    "done_count",
                    "skipped_count",
                    "failed_count",
                    "failures",
                    "created_by",
                    "executed_by"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bulk operation",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          }
        },
        "summary": "pause a bulk operation with If-Match",
        "tags": [
          "bulk-operations"
        ],
        "x-audit": "ops.bulk.pause",
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "ops.bulk.manage"
      }
    },
    "/api/v1/admin/bulk-operations/{id}/preview": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "actions": {
                      "items": {
                        "properties": {
                          "amount_minor": {
                            "type": "string"
                          },
                          "code_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "device_delta": {
                            "type": "number"
                          },
                          "expires_at": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "period_count": {
                            "type": "number"
                          },
                          "period_unit": {
                            "enum": [
                              "day",
                              "month",
                              "year"
                            ],
                            "type": "string"
                          },
                          "plan_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "traffic_bytes": {
                            "type": "string"
                          },
                          "type": {
                            "enum": [
                              "term_extend",
                              "traffic_bonus",
                              "device_bonus",
                              "issue_coupon",
                              "gift_credit"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "type"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "audience": {
                      "oneOf": [
                        {
                          "additionalProperties": false,
                          "properties": {
                            "emails": {
                              "default": [],
                              "items": {
                                "format": "email",
                                "type": "string"
                              },
                              "maxItems": 10000,
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "list"
                              ],
                              "type": "string"
                            },
                            "user_ids": {
                              "default": [],
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 10000,
                              "type": "array"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "created_from": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "created_to": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "has_active_subscription": {
                              "type": "boolean"
                            },
                            "invited_by": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "locale": {
                              "maxLength": 35,
                              "type": "string"
                            },
                            "node_tags": {
                              "items": {
                                "maxLength": 64,
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "plan_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "server_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "status": {
                              "items": {
                                "enum": [
                                  "active",
                                  "disabled",
                                  "banned",
                                  "deactivating",
                                  "deleted"
                                ],
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "subscription_ends_from": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "subscription_ends_to": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "subscription_status": {
                              "items": {
                                "enum": [
                                  "scheduled",
                                  "active",
                                  "exhausted",
                                  "expired",
                                  "cancelled",
                                  "refunded"
                                ],
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "query"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        }
                      ]
                    },
                    "created_by": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "done_count": {
                      "type": "number"
                    },
                    "executed_by": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "failed_count": {
                      "type": "number"
                    },
                    "failures": {
                      "items": {
                        "properties": {
                          "reason": {
                            "type": "string"
                          },
                          "user_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "user_id",
                          "reason"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "compensation",
                        "notification",
                        "marketing"
                      ],
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "notification": {
                      "additionalProperties": false,
                      "properties": {
                        "channels": {
                          "items": {
                            "enum": [
                              "email",
                              "inbox",
                              "telegram"
                            ],
                            "type": "string"
                          },
                          "maxItems": 3,
                          "minItems": 1,
                          "type": "array"
                        },
                        "template_key": {
                          "pattern": "^[a-z][a-z0-9_.]{1,100}$",
                          "type": "string"
                        },
                        "values": {
                          "additionalProperties": {},
                          "default": {},
                          "type": "object"
                        }
                      },
                      "required": [
                        "template_key",
                        "channels"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "preview": {
                      "properties": {
                        "actions": {
                          "items": {
                            "properties": {
                              "amount_minor": {
                                "type": "string"
                              },
                              "code_id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "currency": {
                                "type": "string"
                              },
                              "device_delta": {
                                "type": "number"
                              },
                              "expires_at": {
                                "type": "string"
                              },
                              "id": {
                                "type": "string"
                              },
                              "period_count": {
                                "type": "number"
                              },
                              "period_unit": {
                                "enum": [
                                  "day",
                                  "month",
                                  "year"
                                ],
                                "type": "string"
                              },
                              "plan_ids": {
                                "items": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "type": "array"
                              },
                              "traffic_bytes": {
                                "type": "string"
                              },
                              "type": {
                                "enum": [
                                  "term_extend",
                                  "traffic_bonus",
                                  "device_bonus",
                                  "issue_coupon",
                                  "gift_credit"
                                ],
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "type"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "approval_required": {
                          "type": "boolean"
                        },
                        "approved_at": {
                          "type": "string"
                        },
                        "approved_by": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "at": {
                          "type": "string"
                        },
                        "audience_hash": {
                          "type": "string"
                        },
                        "count": {
                          "type": "number"
                        },
                        "notification_missing_templates": {
                          "items": {
                            "properties": {
                              "channel": {
                                "type": "string"
                              },
                              "locale": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "channel",
                              "locale"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "sample": {
                          "items": {
                            "properties": {
                              "id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "public_id": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "public_id"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        }
                      },
                      "required": [
                        "count",
                        "sample",
                        "at",
                        "actions"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "scheduled_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "skipped_count": {
                      "type": "number"
                    },
                    "status": {
                      "type": "string"
                    },
                    "target_count": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "kind",
                    "scheduled_at",
                    "audience",
                    "actions",
                    "notification",
                    "status",
                    "version",
                    "preview",
                    "target_count",
                    "done_count",
                    "skipped_count",
                    "failed_count",
                    "failures",
                    "created_by",
                    "executed_by"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bulk operation",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          }
        },
        "summary": "Preview audience and effects",
        "tags": [
          "bulk-operations"
        ],
        "x-audit": "ops.bulk.preview",
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "ops.bulk.manage"
      }
    },
    "/api/v1/admin/bulk-operations/{id}/receipts": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "effects": {
                            "items": {
                              "properties": {
                                "action_id": {
                                  "type": "string"
                                },
                                "device_delta": {
                                  "type": "number"
                                },
                                "effect_id": {
                                  "type": "string"
                                },
                                "gift_minor": {
                                  "type": "string"
                                },
                                "reversible": {
                                  "type": "boolean"
                                },
                                "status": {
                                  "enum": [
                                    "applied",
                                    "pending",
                                    "consumed",
                                    "reversed"
                                  ],
                                  "type": "string"
                                },
                                "term_ms": {
                                  "type": "string"
                                },
                                "traffic_bytes": {
                                  "type": "string"
                                },
                                "type": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "action_id",
                                "effect_id",
                                "type",
                                "status",
                                "reversible",
                                "gift_minor",
                                "traffic_bytes",
                                "term_ms",
                                "device_delta"
                              ],
                              "type": "object"
                            },
                            "type": "array"
                          },
                          "notifications": {
                            "items": {
                              "properties": {
                                "channel": {
                                  "type": "string"
                                },
                                "reason": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "status": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "channel",
                                "status",
                                "reason"
                              ],
                              "type": "object"
                            },
                            "type": "array"
                          },
                          "reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reversal": {
                            "properties": {
                              "effects": {
                                "items": {
                                  "properties": {
                                    "action_id": {
                                      "type": "string"
                                    },
                                    "effect_id": {
                                      "type": "string"
                                    },
                                    "reason": {
                                      "type": [
                                        "string",
                                        "null"
                                      ]
                                    },
                                    "status": {
                                      "enum": [
                                        "reversed",
                                        "skipped",
                                        "failed"
                                      ],
                                      "type": "string"
                                    },
                                    "type": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "action_id",
                                    "effect_id",
                                    "type",
                                    "status",
                                    "reason"
                                  ],
                                  "type": "object"
                                },
                                "type": "array"
                              },
                              "reason": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "status": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "status",
                              "reason",
                              "effects"
                            ],
                            "type": [
                              "object",
                              "null"
                            ]
                          },
                          "status": {
                            "type": "string"
                          },
                          "user_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "user_id",
                          "status",
                          "reason",
                          "notifications",
                          "effects",
                          "reversal"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bulk operation"
          }
        },
        "summary": "Read detailed per-user receipts and reversal eligibility (200 users per page)",
        "tags": [
          "bulk-operations"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "ops.bulk.manage"
      }
    },
    "/api/v1/admin/bulk-operations/{id}/report": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "actions": {
                      "items": {
                        "properties": {
                          "applied_effects": {
                            "type": "number"
                          },
                          "consumed_effects": {
                            "type": "number"
                          },
                          "failed_users": {
                            "type": "number"
                          },
                          "id": {
                            "type": "string"
                          },
                          "pending_effects": {
                            "type": "number"
                          },
                          "reversed_effects": {
                            "type": "number"
                          },
                          "reversible_effects": {
                            "type": "number"
                          },
                          "skipped_users": {
                            "type": "number"
                          },
                          "succeeded_users": {
                            "type": "number"
                          },
                          "type": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "type",
                          "succeeded_users",
                          "failed_users",
                          "skipped_users",
                          "applied_effects",
                          "pending_effects",
                          "consumed_effects",
                          "reversed_effects",
                          "reversible_effects"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "audience_size": {
                      "type": "number"
                    },
                    "channels": {
                      "additionalProperties": {
                        "additionalProperties": {
                          "type": "number"
                        },
                        "type": "object"
                      },
                      "type": "object"
                    },
                    "counts": {
                      "additionalProperties": {
                        "type": "number"
                      },
                      "type": "object"
                    },
                    "deliveries": {
                      "additionalProperties": {
                        "type": "number"
                      },
                      "type": "object"
                    },
                    "generated_at": {
                      "type": "string"
                    },
                    "operation": {
                      "properties": {
                        "actions": {
                          "items": {
                            "properties": {
                              "amount_minor": {
                                "type": "string"
                              },
                              "code_id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "currency": {
                                "type": "string"
                              },
                              "device_delta": {
                                "type": "number"
                              },
                              "expires_at": {
                                "type": "string"
                              },
                              "id": {
                                "type": "string"
                              },
                              "period_count": {
                                "type": "number"
                              },
                              "period_unit": {
                                "enum": [
                                  "day",
                                  "month",
                                  "year"
                                ],
                                "type": "string"
                              },
                              "plan_ids": {
                                "items": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "type": "array"
                              },
                              "traffic_bytes": {
                                "type": "string"
                              },
                              "type": {
                                "enum": [
                                  "term_extend",
                                  "traffic_bonus",
                                  "device_bonus",
                                  "issue_coupon",
                                  "gift_credit"
                                ],
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "type"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "audience": {
                          "oneOf": [
                            {
                              "additionalProperties": false,
                              "properties": {
                                "emails": {
                                  "default": [],
                                  "items": {
                                    "format": "email",
                                    "type": "string"
                                  },
                                  "maxItems": 10000,
                                  "type": "array"
                                },
                                "type": {
                                  "enum": [
                                    "list"
                                  ],
                                  "type": "string"
                                },
                                "user_ids": {
                                  "default": [],
                                  "items": {
                                    "format": "uuid",
                                    "type": "string"
                                  },
                                  "maxItems": 10000,
                                  "type": "array"
                                }
                              },
                              "required": [
                                "type"
                              ],
                              "type": "object"
                            },
                            {
                              "additionalProperties": false,
                              "properties": {
                                "created_from": {
                                  "format": "date-time",
                                  "type": "string"
                                },
                                "created_to": {
                                  "format": "date-time",
                                  "type": "string"
                                },
                                "has_active_subscription": {
                                  "type": "boolean"
                                },
                                "invited_by": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "locale": {
                                  "maxLength": 35,
                                  "type": "string"
                                },
                                "node_tags": {
                                  "items": {
                                    "maxLength": 64,
                                    "type": "string"
                                  },
                                  "maxItems": 100,
                                  "type": "array"
                                },
                                "plan_ids": {
                                  "items": {
                                    "format": "uuid",
                                    "type": "string"
                                  },
                                  "maxItems": 100,
                                  "type": "array"
                                },
                                "server_ids": {
                                  "items": {
                                    "format": "uuid",
                                    "type": "string"
                                  },
                                  "maxItems": 100,
                                  "type": "array"
                                },
                                "status": {
                                  "items": {
                                    "enum": [
                                      "active",
                                      "disabled",
                                      "banned",
                                      "deactivating",
                                      "deleted"
                                    ],
                                    "type": "string"
                                  },
                                  "type": "array"
                                },
                                "subscription_ends_from": {
                                  "format": "date-time",
                                  "type": "string"
                                },
                                "subscription_ends_to": {
                                  "format": "date-time",
                                  "type": "string"
                                },
                                "subscription_status": {
                                  "items": {
                                    "enum": [
                                      "scheduled",
                                      "active",
                                      "exhausted",
                                      "expired",
                                      "cancelled",
                                      "refunded"
                                    ],
                                    "type": "string"
                                  },
                                  "type": "array"
                                },
                                "type": {
                                  "enum": [
                                    "query"
                                  ],
                                  "type": "string"
                                }
                              },
                              "required": [
                                "type"
                              ],
                              "type": "object"
                            }
                          ]
                        },
                        "created_by": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "done_count": {
                          "type": "number"
                        },
                        "executed_by": {
                          "format": "uuid",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "failed_count": {
                          "type": "number"
                        },
                        "failures": {
                          "items": {
                            "properties": {
                              "reason": {
                                "type": "string"
                              },
                              "user_id": {
                                "format": "uuid",
                                "type": "string"
                              }
                            },
                            "required": [
                              "user_id",
                              "reason"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "id": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "kind": {
                          "enum": [
                            "compensation",
                            "notification",
                            "marketing"
                          ],
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "notification": {
                          "additionalProperties": false,
                          "properties": {
                            "channels": {
                              "items": {
                                "enum": [
                                  "email",
                                  "inbox",
                                  "telegram"
                                ],
                                "type": "string"
                              },
                              "maxItems": 3,
                              "minItems": 1,
                              "type": "array"
                            },
                            "template_key": {
                              "pattern": "^[a-z][a-z0-9_.]{1,100}$",
                              "type": "string"
                            },
                            "values": {
                              "additionalProperties": {},
                              "default": {},
                              "type": "object"
                            }
                          },
                          "required": [
                            "template_key",
                            "channels"
                          ],
                          "type": [
                            "object",
                            "null"
                          ]
                        },
                        "preview": {
                          "properties": {
                            "actions": {
                              "items": {
                                "properties": {
                                  "amount_minor": {
                                    "type": "string"
                                  },
                                  "code_id": {
                                    "format": "uuid",
                                    "type": "string"
                                  },
                                  "currency": {
                                    "type": "string"
                                  },
                                  "device_delta": {
                                    "type": "number"
                                  },
                                  "expires_at": {
                                    "type": "string"
                                  },
                                  "id": {
                                    "type": "string"
                                  },
                                  "period_count": {
                                    "type": "number"
                                  },
                                  "period_unit": {
                                    "enum": [
                                      "day",
                                      "month",
                                      "year"
                                    ],
                                    "type": "string"
                                  },
                                  "plan_ids": {
                                    "items": {
                                      "format": "uuid",
                                      "type": "string"
                                    },
                                    "type": "array"
                                  },
                                  "traffic_bytes": {
                                    "type": "string"
                                  },
                                  "type": {
                                    "enum": [
                                      "term_extend",
                                      "traffic_bonus",
                                      "device_bonus",
                                      "issue_coupon",
                                      "gift_credit"
                                    ],
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "type"
                                ],
                                "type": "object"
                              },
                              "type": "array"
                            },
                            "approval_required": {
                              "type": "boolean"
                            },
                            "approved_at": {
                              "type": "string"
                            },
                            "approved_by": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "at": {
                              "type": "string"
                            },
                            "audience_hash": {
                              "type": "string"
                            },
                            "count": {
                              "type": "number"
                            },
                            "notification_missing_templates": {
                              "items": {
                                "properties": {
                                  "channel": {
                                    "type": "string"
                                  },
                                  "locale": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "channel",
                                  "locale"
                                ],
                                "type": "object"
                              },
                              "type": "array"
                            },
                            "sample": {
                              "items": {
                                "properties": {
                                  "id": {
                                    "format": "uuid",
                                    "type": "string"
                                  },
                                  "public_id": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "id",
                                  "public_id"
                                ],
                                "type": "object"
                              },
                              "type": "array"
                            }
                          },
                          "required": [
                            "count",
                            "sample",
                            "at",
                            "actions"
                          ],
                          "type": [
                            "object",
                            "null"
                          ]
                        },
                        "scheduled_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "skipped_count": {
                          "type": "number"
                        },
                        "status": {
                          "type": "string"
                        },
                        "target_count": {
                          "type": [
                            "number",
                            "null"
                          ]
                        },
                        "version": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "kind",
                        "scheduled_at",
                        "audience",
                        "actions",
                        "notification",
                        "status",
                        "version",
                        "preview",
                        "target_count",
                        "done_count",
                        "skipped_count",
                        "failed_count",
                        "failures",
                        "created_by",
                        "executed_by"
                      ],
                      "type": "object"
                    },
                    "receipt_count": {
                      "type": "number"
                    },
                    "totals": {
                      "properties": {
                        "issued": {
                          "additionalProperties": {
                            "type": "string"
                          },
                          "type": "object"
                        },
                        "reversed": {
                          "additionalProperties": {
                            "type": "string"
                          },
                          "type": "object"
                        },
                        "reversible": {
                          "additionalProperties": {
                            "type": "string"
                          },
                          "type": "object"
                        }
                      },
                      "required": [
                        "issued",
                        "reversed",
                        "reversible"
                      ],
                      "type": "object"
                    },
                    "users": {
                      "properties": {
                        "failed": {
                          "type": "number"
                        },
                        "partially_reversed": {
                          "type": "number"
                        },
                        "pending": {
                          "type": "number"
                        },
                        "reversed": {
                          "type": "number"
                        },
                        "skipped": {
                          "type": "number"
                        },
                        "succeeded": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "succeeded",
                        "failed",
                        "skipped",
                        "pending",
                        "reversed",
                        "partially_reversed"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "operation",
                    "counts",
                    "deliveries",
                    "channels",
                    "audience_size",
                    "receipt_count",
                    "users",
                    "actions",
                    "totals",
                    "generated_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bulk operation"
          }
        },
        "summary": "Audience, action counts and exact totals reconciled from effect records",
        "tags": [
          "bulk-operations"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "ops.bulk.manage"
      }
    },
    "/api/v1/admin/bulk-operations/{id}/resume": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "actions": {
                      "items": {
                        "properties": {
                          "amount_minor": {
                            "type": "string"
                          },
                          "code_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "device_delta": {
                            "type": "number"
                          },
                          "expires_at": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "period_count": {
                            "type": "number"
                          },
                          "period_unit": {
                            "enum": [
                              "day",
                              "month",
                              "year"
                            ],
                            "type": "string"
                          },
                          "plan_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "traffic_bytes": {
                            "type": "string"
                          },
                          "type": {
                            "enum": [
                              "term_extend",
                              "traffic_bonus",
                              "device_bonus",
                              "issue_coupon",
                              "gift_credit"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "type"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "audience": {
                      "oneOf": [
                        {
                          "additionalProperties": false,
                          "properties": {
                            "emails": {
                              "default": [],
                              "items": {
                                "format": "email",
                                "type": "string"
                              },
                              "maxItems": 10000,
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "list"
                              ],
                              "type": "string"
                            },
                            "user_ids": {
                              "default": [],
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 10000,
                              "type": "array"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "created_from": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "created_to": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "has_active_subscription": {
                              "type": "boolean"
                            },
                            "invited_by": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "locale": {
                              "maxLength": 35,
                              "type": "string"
                            },
                            "node_tags": {
                              "items": {
                                "maxLength": 64,
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "plan_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "server_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "status": {
                              "items": {
                                "enum": [
                                  "active",
                                  "disabled",
                                  "banned",
                                  "deactivating",
                                  "deleted"
                                ],
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "subscription_ends_from": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "subscription_ends_to": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "subscription_status": {
                              "items": {
                                "enum": [
                                  "scheduled",
                                  "active",
                                  "exhausted",
                                  "expired",
                                  "cancelled",
                                  "refunded"
                                ],
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "query"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        }
                      ]
                    },
                    "created_by": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "done_count": {
                      "type": "number"
                    },
                    "executed_by": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "failed_count": {
                      "type": "number"
                    },
                    "failures": {
                      "items": {
                        "properties": {
                          "reason": {
                            "type": "string"
                          },
                          "user_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "user_id",
                          "reason"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "compensation",
                        "notification",
                        "marketing"
                      ],
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "notification": {
                      "additionalProperties": false,
                      "properties": {
                        "channels": {
                          "items": {
                            "enum": [
                              "email",
                              "inbox",
                              "telegram"
                            ],
                            "type": "string"
                          },
                          "maxItems": 3,
                          "minItems": 1,
                          "type": "array"
                        },
                        "template_key": {
                          "pattern": "^[a-z][a-z0-9_.]{1,100}$",
                          "type": "string"
                        },
                        "values": {
                          "additionalProperties": {},
                          "default": {},
                          "type": "object"
                        }
                      },
                      "required": [
                        "template_key",
                        "channels"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "preview": {
                      "properties": {
                        "actions": {
                          "items": {
                            "properties": {
                              "amount_minor": {
                                "type": "string"
                              },
                              "code_id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "currency": {
                                "type": "string"
                              },
                              "device_delta": {
                                "type": "number"
                              },
                              "expires_at": {
                                "type": "string"
                              },
                              "id": {
                                "type": "string"
                              },
                              "period_count": {
                                "type": "number"
                              },
                              "period_unit": {
                                "enum": [
                                  "day",
                                  "month",
                                  "year"
                                ],
                                "type": "string"
                              },
                              "plan_ids": {
                                "items": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "type": "array"
                              },
                              "traffic_bytes": {
                                "type": "string"
                              },
                              "type": {
                                "enum": [
                                  "term_extend",
                                  "traffic_bonus",
                                  "device_bonus",
                                  "issue_coupon",
                                  "gift_credit"
                                ],
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "type"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "approval_required": {
                          "type": "boolean"
                        },
                        "approved_at": {
                          "type": "string"
                        },
                        "approved_by": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "at": {
                          "type": "string"
                        },
                        "audience_hash": {
                          "type": "string"
                        },
                        "count": {
                          "type": "number"
                        },
                        "notification_missing_templates": {
                          "items": {
                            "properties": {
                              "channel": {
                                "type": "string"
                              },
                              "locale": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "channel",
                              "locale"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "sample": {
                          "items": {
                            "properties": {
                              "id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "public_id": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "public_id"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        }
                      },
                      "required": [
                        "count",
                        "sample",
                        "at",
                        "actions"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "scheduled_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "skipped_count": {
                      "type": "number"
                    },
                    "status": {
                      "type": "string"
                    },
                    "target_count": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "kind",
                    "scheduled_at",
                    "audience",
                    "actions",
                    "notification",
                    "status",
                    "version",
                    "preview",
                    "target_count",
                    "done_count",
                    "skipped_count",
                    "failed_count",
                    "failures",
                    "created_by",
                    "executed_by"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bulk operation",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          }
        },
        "summary": "resume a bulk operation with If-Match",
        "tags": [
          "bulk-operations"
        ],
        "x-audit": "ops.bulk.resume",
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "ops.bulk.manage"
      }
    },
    "/api/v1/admin/bulk-operations/{id}/reversal": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "reversal": {
                      "properties": {
                        "counts": {
                          "additionalProperties": {
                            "type": "number"
                          },
                          "type": "object"
                        },
                        "executed_by": {
                          "format": "uuid",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "finished_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "operation_id": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "preview": {
                          "properties": {
                            "already_reversed": {
                              "type": "integer"
                            },
                            "at": {
                              "type": "string"
                            },
                            "batch_version": {
                              "type": "integer"
                            },
                            "effects": {
                              "type": "integer"
                            },
                            "eligible": {
                              "type": "integer"
                            },
                            "expires_at": {
                              "type": "string"
                            },
                            "fingerprint": {
                              "type": "string"
                            },
                            "gift_minor": {
                              "type": "string"
                            },
                            "retained": {
                              "type": "integer"
                            },
                            "term_ms": {
                              "type": "string"
                            },
                            "traffic_bytes": {
                              "type": "string"
                            },
                            "users": {
                              "type": "integer"
                            }
                          },
                          "required": [
                            "batch_version",
                            "fingerprint",
                            "at",
                            "expires_at",
                            "users",
                            "effects",
                            "eligible",
                            "retained",
                            "already_reversed",
                            "gift_minor",
                            "traffic_bytes",
                            "term_ms"
                          ],
                          "type": "object"
                        },
                        "recoverable": {
                          "type": "boolean"
                        },
                        "requested_by": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "started_at": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "status": {
                          "enum": [
                            "previewed",
                            "running",
                            "completed",
                            "failed"
                          ],
                          "type": "string"
                        },
                        "version": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "operation_id",
                        "status",
                        "version",
                        "requested_by",
                        "executed_by",
                        "started_at",
                        "finished_at",
                        "counts",
                        "recoverable",
                        "preview"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "reversal"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Reversal, or null before preview"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Permission required"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such batch"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid batch identifier"
          }
        },
        "summary": "Read persisted reversal preview and per-user progress",
        "tags": [
          "bulk-operations"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "ops.bulk.manage"
      }
    },
    "/api/v1/admin/bulk-operations/{id}/reversal/execute": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "counts": {
                      "additionalProperties": {
                        "type": "number"
                      },
                      "type": "object"
                    },
                    "executed_by": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "finished_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "operation_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "preview": {
                      "properties": {
                        "already_reversed": {
                          "type": "integer"
                        },
                        "at": {
                          "type": "string"
                        },
                        "batch_version": {
                          "type": "integer"
                        },
                        "effects": {
                          "type": "integer"
                        },
                        "eligible": {
                          "type": "integer"
                        },
                        "expires_at": {
                          "type": "string"
                        },
                        "fingerprint": {
                          "type": "string"
                        },
                        "gift_minor": {
                          "type": "string"
                        },
                        "retained": {
                          "type": "integer"
                        },
                        "term_ms": {
                          "type": "string"
                        },
                        "traffic_bytes": {
                          "type": "string"
                        },
                        "users": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "batch_version",
                        "fingerprint",
                        "at",
                        "expires_at",
                        "users",
                        "effects",
                        "eligible",
                        "retained",
                        "already_reversed",
                        "gift_minor",
                        "traffic_bytes",
                        "term_ms"
                      ],
                      "type": "object"
                    },
                    "recoverable": {
                      "type": "boolean"
                    },
                    "requested_by": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "started_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "enum": [
                        "previewed",
                        "running",
                        "completed",
                        "failed"
                      ],
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "operation_id",
                    "status",
                    "version",
                    "requested_by",
                    "executed_by",
                    "started_at",
                    "finished_at",
                    "counts",
                    "recoverable",
                    "preview"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Durable batch reversal",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Permission or reauthentication required"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such batch"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Preview expired, changed or invalid state"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid batch identifier"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "Execute or resume the previewed reversal with reauthentication and every business permission",
        "tags": [
          "bulk-operations"
        ],
        "x-audit": "ops.bulk.reverse_execute",
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "ops.bulk.manage",
        "x-reauth": true
      }
    },
    "/api/v1/admin/bulk-operations/{id}/reversal/preview": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "counts": {
                      "additionalProperties": {
                        "type": "number"
                      },
                      "type": "object"
                    },
                    "executed_by": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "finished_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "operation_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "preview": {
                      "properties": {
                        "already_reversed": {
                          "type": "integer"
                        },
                        "at": {
                          "type": "string"
                        },
                        "batch_version": {
                          "type": "integer"
                        },
                        "effects": {
                          "type": "integer"
                        },
                        "eligible": {
                          "type": "integer"
                        },
                        "expires_at": {
                          "type": "string"
                        },
                        "fingerprint": {
                          "type": "string"
                        },
                        "gift_minor": {
                          "type": "string"
                        },
                        "retained": {
                          "type": "integer"
                        },
                        "term_ms": {
                          "type": "string"
                        },
                        "traffic_bytes": {
                          "type": "string"
                        },
                        "users": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "batch_version",
                        "fingerprint",
                        "at",
                        "expires_at",
                        "users",
                        "effects",
                        "eligible",
                        "retained",
                        "already_reversed",
                        "gift_minor",
                        "traffic_bytes",
                        "term_ms"
                      ],
                      "type": "object"
                    },
                    "recoverable": {
                      "type": "boolean"
                    },
                    "requested_by": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "started_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "enum": [
                        "previewed",
                        "running",
                        "completed",
                        "failed"
                      ],
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "operation_id",
                    "status",
                    "version",
                    "requested_by",
                    "executed_by",
                    "started_at",
                    "finished_at",
                    "counts",
                    "recoverable",
                    "preview"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Durable batch reversal",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Permission or reauthentication required"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such batch"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Preview expired, changed or invalid state"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid batch identifier"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "Preview reversal of the remaining successful receipts (ten-minute validity)",
        "tags": [
          "bulk-operations"
        ],
        "x-audit": "ops.bulk.reverse_preview",
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "ops.bulk.manage"
      }
    },
    "/api/v1/admin/bulk-operations/{id}/schedule": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "scheduled_at": {
                    "format": "date-time",
                    "type": "string"
                  }
                },
                "required": [
                  "scheduled_at"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "actions": {
                      "items": {
                        "properties": {
                          "amount_minor": {
                            "type": "string"
                          },
                          "code_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "device_delta": {
                            "type": "number"
                          },
                          "expires_at": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "period_count": {
                            "type": "number"
                          },
                          "period_unit": {
                            "enum": [
                              "day",
                              "month",
                              "year"
                            ],
                            "type": "string"
                          },
                          "plan_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "traffic_bytes": {
                            "type": "string"
                          },
                          "type": {
                            "enum": [
                              "term_extend",
                              "traffic_bonus",
                              "device_bonus",
                              "issue_coupon",
                              "gift_credit"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "type"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "audience": {
                      "oneOf": [
                        {
                          "additionalProperties": false,
                          "properties": {
                            "emails": {
                              "default": [],
                              "items": {
                                "format": "email",
                                "type": "string"
                              },
                              "maxItems": 10000,
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "list"
                              ],
                              "type": "string"
                            },
                            "user_ids": {
                              "default": [],
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 10000,
                              "type": "array"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "created_from": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "created_to": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "has_active_subscription": {
                              "type": "boolean"
                            },
                            "invited_by": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "locale": {
                              "maxLength": 35,
                              "type": "string"
                            },
                            "node_tags": {
                              "items": {
                                "maxLength": 64,
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "plan_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "server_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "type": "array"
                            },
                            "status": {
                              "items": {
                                "enum": [
                                  "active",
                                  "disabled",
                                  "banned",
                                  "deactivating",
                                  "deleted"
                                ],
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "subscription_ends_from": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "subscription_ends_to": {
                              "format": "date-time",
                              "type": "string"
                            },
                            "subscription_status": {
                              "items": {
                                "enum": [
                                  "scheduled",
                                  "active",
                                  "exhausted",
                                  "expired",
                                  "cancelled",
                                  "refunded"
                                ],
                                "type": "string"
                              },
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "query"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        }
                      ]
                    },
                    "created_by": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "done_count": {
                      "type": "number"
                    },
                    "executed_by": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "failed_count": {
                      "type": "number"
                    },
                    "failures": {
                      "items": {
                        "properties": {
                          "reason": {
                            "type": "string"
                          },
                          "user_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "user_id",
                          "reason"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "compensation",
                        "notification",
                        "marketing"
                      ],
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "notification": {
                      "additionalProperties": false,
                      "properties": {
                        "channels": {
                          "items": {
                            "enum": [
                              "email",
                              "inbox",
                              "telegram"
                            ],
                            "type": "string"
                          },
                          "maxItems": 3,
                          "minItems": 1,
                          "type": "array"
                        },
                        "template_key": {
                          "pattern": "^[a-z][a-z0-9_.]{1,100}$",
                          "type": "string"
                        },
                        "values": {
                          "additionalProperties": {},
                          "default": {},
                          "type": "object"
                        }
                      },
                      "required": [
                        "template_key",
                        "channels"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "preview": {
                      "properties": {
                        "actions": {
                          "items": {
                            "properties": {
                              "amount_minor": {
                                "type": "string"
                              },
                              "code_id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "currency": {
                                "type": "string"
                              },
                              "device_delta": {
                                "type": "number"
                              },
                              "expires_at": {
                                "type": "string"
                              },
                              "id": {
                                "type": "string"
                              },
                              "period_count": {
                                "type": "number"
                              },
                              "period_unit": {
                                "enum": [
                                  "day",
                                  "month",
                                  "year"
                                ],
                                "type": "string"
                              },
                              "plan_ids": {
                                "items": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "type": "array"
                              },
                              "traffic_bytes": {
                                "type": "string"
                              },
                              "type": {
                                "enum": [
                                  "term_extend",
                                  "traffic_bonus",
                                  "device_bonus",
                                  "issue_coupon",
                                  "gift_credit"
                                ],
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "type"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "approval_required": {
                          "type": "boolean"
                        },
                        "approved_at": {
                          "type": "string"
                        },
                        "approved_by": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "at": {
                          "type": "string"
                        },
                        "audience_hash": {
                          "type": "string"
                        },
                        "count": {
                          "type": "number"
                        },
                        "notification_missing_templates": {
                          "items": {
                            "properties": {
                              "channel": {
                                "type": "string"
                              },
                              "locale": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "channel",
                              "locale"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "sample": {
                          "items": {
                            "properties": {
                              "id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "public_id": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "public_id"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        }
                      },
                      "required": [
                        "count",
                        "sample",
                        "at",
                        "actions"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "scheduled_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "skipped_count": {
                      "type": "number"
                    },
                    "status": {
                      "type": "string"
                    },
                    "target_count": {
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "kind",
                    "scheduled_at",
                    "audience",
                    "actions",
                    "notification",
                    "status",
                    "version",
                    "preview",
                    "target_count",
                    "done_count",
                    "skipped_count",
                    "failed_count",
                    "failures",
                    "created_by",
                    "executed_by"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bulk operation",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "status",
                    "title",
                    "type",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Command refused"
          }
        },
        "summary": "Schedule a frozen, approved audience",
        "tags": [
          "bulk-operations"
        ],
        "x-audit": "ops.bulk.schedule",
        "x-body": "json",
        "x-body-limit": 1048576,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "ops.bulk.manage",
        "x-reauth": true
      }
    },
    "/api/v1/admin/catalog/change-paths": {
      "put": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "direction": {
                    "enum": [
                      "upgrade",
                      "downgrade"
                    ],
                    "type": "string"
                  },
                  "enabled": {
                    "type": "boolean"
                  },
                  "source_price_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "target_price_id": {
                    "format": "uuid",
                    "type": "string"
                  }
                },
                "required": [
                  "source_price_id",
                  "target_price_id",
                  "direction",
                  "enabled"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "ok": {
                      "enum": [
                        true
                      ],
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Subscription not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Quote, path or version changed"
          }
        },
        "summary": "Configure a price-option change path",
        "tags": [
          "catalog"
        ],
        "x-audit": "catalog.change_path.configure",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "catalog.price.manage",
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/admin/catalog/paid-reset-pricing": {
      "put": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "minimum_minor": {
                    "pattern": "^\\d{1,18}$",
                    "type": "string"
                  },
                  "plan_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "price_minor": {
                    "pattern": "^\\d{1,18}$",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "prorata": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "plan_id",
                  "price_minor",
                  "prorata",
                  "minimum_minor"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "ok": {
                      "enum": [
                        true
                      ],
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Subscription not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Quote, path or version changed"
          }
        },
        "summary": "Configure reset base price, pro-rata pricing and minimum",
        "tags": [
          "catalog"
        ],
        "x-audit": "catalog.paid_reset.configure",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "catalog.price.manage",
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/admin/catalog/plans": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "product_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Status; repeat the parameter for several values",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "draft",
                    "on_sale",
                    "off_sale",
                    "retired"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "draft",
                      "on_sale",
                      "off_sale",
                      "retired"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Status; repeat the parameter for several values"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Return `total` (first page only)",
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "description": "Return `total` (first page only)",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogPlanPage"
                }
              }
            },
            "description": "A page of plans (sort, id)"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid filter or cursor"
          }
        },
        "summary": "List plans",
        "tags": [
          "catalog"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "catalog.read"
      },
      "post": {
        "parameters": [
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CatalogPlanCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogPlanSaved"
                }
              }
            },
            "description": "The plan with tag warnings, with ETag",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "catalog.plan_code_taken or an Idempotency-Key conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed (tags, product, source-locale name)"
          }
        },
        "summary": "Create a plan (draft)",
        "tags": [
          "catalog"
        ],
        "x-audit": "catalog.plan.create",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-concurrency": {
          "etag": true
        },
        "x-idempotency": "required",
        "x-permission": "catalog.plan.manage"
      }
    },
    "/api/v1/admin/catalog/plans/reorder": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CatalogPlanReorder"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogPlanList"
                }
              }
            },
            "description": "The plans of the product in their new order"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "The product has no plans"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "catalog.reorder_mismatch: not exactly the plans of the product"
          }
        },
        "summary": "Set the display order of the plans of a product",
        "tags": [
          "catalog"
        ],
        "x-audit": "catalog.plan.reorder",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "optional",
        "x-permission": "catalog.plan.manage"
      }
    },
    "/api/v1/admin/catalog/plans/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogPlanDetail"
                }
              }
            },
            "description": "The plan, with ETag",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such plan"
          }
        },
        "summary": "One plan with its price options and tag warnings",
        "tags": [
          "catalog"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "catalog.read"
      },
      "patch": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CatalogPlanPatch"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogPlanSaved"
                }
              }
            },
            "description": "The plan with tag warnings, with ETag",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such plan"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current) or catalog.plan_code_taken"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed (tags, product, reset policy vs a permanent price)"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Edit a plan (If-Match); sold entitlements keep their snapshots",
        "tags": [
          "catalog"
        ],
        "x-audit": "catalog.plan.update",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "catalog.plan.manage"
      }
    },
    "/api/v1/admin/catalog/plans/{id}/prices": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogPriceList"
                }
              }
            },
            "description": "Active options first"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such plan"
          }
        },
        "summary": "Price options of a plan",
        "tags": [
          "catalog"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "catalog.read"
      },
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CatalogPriceCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogPrice"
                }
              }
            },
            "description": "The new option"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such plan"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "catalog.price_period_taken or an Idempotency-Key conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed (site currency, permanent price vs the reset policy)"
          }
        },
        "summary": "Add a price option",
        "tags": [
          "catalog"
        ],
        "x-audit": "catalog.price.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "catalog.price.manage"
      }
    },
    "/api/v1/admin/catalog/plans/{id}/prices/{priceId}": {
      "delete": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "priceId",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such price option"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "catalog.price_referenced: an order or an auto-renew setting refers to it; deactivate instead"
          }
        },
        "summary": "Delete a price option nothing refers to",
        "tags": [
          "catalog"
        ],
        "x-audit": "catalog.price.delete",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional",
        "x-permission": "catalog.price.manage"
      }
    },
    "/api/v1/admin/catalog/plans/{id}/prices/{priceId}/deactivate": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "priceId",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogPrice"
                }
              }
            },
            "description": "The option (inactive)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such price option"
          }
        },
        "summary": "Deactivate a price option",
        "tags": [
          "catalog"
        ],
        "x-audit": "catalog.price.deactivate",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional",
        "x-permission": "catalog.price.manage"
      }
    },
    "/api/v1/admin/catalog/plans/{id}/status": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CatalogPlanStatus"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogPlanSaved"
                }
              }
            },
            "description": "The plan, with ETag",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such plan"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict or catalog.status_transition_invalid"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Change the sale status (If-Match)",
        "tags": [
          "catalog"
        ],
        "x-audit": "catalog.plan.status",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "catalog.plan.manage"
      }
    },
    "/api/v1/admin/catalog/plans/{id}/stock": {
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CatalogPlanStock"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogPlanSaved"
                }
              }
            },
            "description": "The plan, with ETag",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such plan"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict or catalog.stock_below_committed"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Set the stock total (If-Match); null = unlimited",
        "tags": [
          "catalog"
        ],
        "x-audit": "catalog.plan.stock",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "catalog.plan.manage"
      }
    },
    "/api/v1/admin/catalog/products": {
      "get": {
        "parameters": [
          {
            "description": "Status; repeat the parameter for several values",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "draft",
                    "active",
                    "archived"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "draft",
                      "active",
                      "archived"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Status; repeat the parameter for several values"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Return `total` (first page only)",
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "description": "Return `total` (first page only)",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogProductPage"
                }
              }
            },
            "description": "A page of products (sort, id)"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid filter or cursor"
          }
        },
        "summary": "List products",
        "tags": [
          "catalog"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "catalog.read"
      },
      "post": {
        "parameters": [
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CatalogProductCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogProduct"
                }
              }
            },
            "description": "The product, with ETag",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "catalog.slug_taken or an Idempotency-Key conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          }
        },
        "summary": "Create a product",
        "tags": [
          "catalog"
        ],
        "x-audit": "catalog.product.create",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-concurrency": {
          "etag": true
        },
        "x-idempotency": "required",
        "x-permission": "catalog.product.manage"
      }
    },
    "/api/v1/admin/catalog/products/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogProduct"
                }
              }
            },
            "description": "The product, with ETag",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such product"
          }
        },
        "summary": "One product",
        "tags": [
          "catalog"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "catalog.read"
      },
      "patch": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CatalogProductPatch"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CatalogProduct"
                }
              }
            },
            "description": "The product, with ETag",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such product"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current) or catalog.slug_taken"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Update a product (If-Match); status `archived` archives it",
        "tags": [
          "catalog"
        ],
        "x-audit": "catalog.product.update",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "catalog.product.manage"
      }
    },
    "/api/v1/admin/content/announcements": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "enum": [
                "draft",
                "published",
                "archived"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "default": "false",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "audience": {
                            "oneOf": [
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "type": {
                                    "enum": [
                                      "all"
                                    ],
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "type"
                                ],
                                "type": "object"
                              },
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "type": {
                                    "enum": [
                                      "active_subscription"
                                    ],
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "type"
                                ],
                                "type": "object"
                              },
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "type": {
                                    "enum": [
                                      "no_subscription"
                                    ],
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "type"
                                ],
                                "type": "object"
                              },
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "plan_ids": {
                                    "items": {
                                      "format": "uuid",
                                      "type": "string"
                                    },
                                    "maxItems": 100,
                                    "minItems": 1,
                                    "type": "array"
                                  },
                                  "type": {
                                    "enum": [
                                      "plans"
                                    ],
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "type",
                                  "plan_ids"
                                ],
                                "type": "object"
                              }
                            ]
                          },
                          "created_by": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "expire_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "i18n": {
                            "additionalProperties": {
                              "additionalProperties": false,
                              "properties": {
                                "_meta": {
                                  "additionalProperties": false,
                                  "properties": {
                                    "origin": {
                                      "enum": [
                                        "manual",
                                        "machine",
                                        "builtin"
                                      ],
                                      "type": "string"
                                    },
                                    "provider": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "origin"
                                  ],
                                  "type": "object"
                                },
                                "body_md": {
                                  "maxLength": 100000,
                                  "type": "string"
                                },
                                "title": {
                                  "maxLength": 500,
                                  "type": "string"
                                }
                              },
                              "required": [
                                "title",
                                "body_md"
                              ],
                              "type": "object"
                            },
                            "type": "object"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "kind": {
                            "enum": [
                              "normal",
                              "important",
                              "maintenance"
                            ],
                            "type": "string"
                          },
                          "pinned": {
                            "type": "boolean"
                          },
                          "popup": {
                            "type": "boolean"
                          },
                          "publish_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "source_locale": {
                            "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
                            "type": "string"
                          },
                          "status": {
                            "enum": [
                              "draft",
                              "published",
                              "archived"
                            ],
                            "type": "string"
                          },
                          "updated_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "source_locale",
                          "i18n",
                          "kind",
                          "pinned",
                          "popup",
                          "audience",
                          "status",
                          "publish_at",
                          "expire_at",
                          "id",
                          "created_by",
                          "updated_at",
                          "version"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "summary": "List announcements",
        "tags": [
          "announcements"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "support.announcement.manage"
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "audience": {
                    "oneOf": [
                      {
                        "additionalProperties": false,
                        "properties": {
                          "type": {
                            "enum": [
                              "all"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "type": "object"
                      },
                      {
                        "additionalProperties": false,
                        "properties": {
                          "type": {
                            "enum": [
                              "active_subscription"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "type": "object"
                      },
                      {
                        "additionalProperties": false,
                        "properties": {
                          "type": {
                            "enum": [
                              "no_subscription"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "type": "object"
                      },
                      {
                        "additionalProperties": false,
                        "properties": {
                          "plan_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "maxItems": 100,
                            "minItems": 1,
                            "type": "array"
                          },
                          "type": {
                            "enum": [
                              "plans"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "plan_ids"
                        ],
                        "type": "object"
                      }
                    ]
                  },
                  "expire_at": {
                    "format": "date-time",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "i18n": {
                    "additionalProperties": {
                      "additionalProperties": false,
                      "properties": {
                        "_meta": {
                          "additionalProperties": false,
                          "properties": {
                            "origin": {
                              "enum": [
                                "manual",
                                "machine",
                                "builtin"
                              ],
                              "type": "string"
                            },
                            "provider": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "origin"
                          ],
                          "type": "object"
                        },
                        "body_md": {
                          "maxLength": 100000,
                          "type": "string"
                        },
                        "title": {
                          "maxLength": 500,
                          "type": "string"
                        }
                      },
                      "required": [
                        "title",
                        "body_md"
                      ],
                      "type": "object"
                    },
                    "type": "object"
                  },
                  "kind": {
                    "enum": [
                      "normal",
                      "important",
                      "maintenance"
                    ],
                    "type": "string"
                  },
                  "pinned": {
                    "type": "boolean"
                  },
                  "popup": {
                    "type": "boolean"
                  },
                  "publish_at": {
                    "format": "date-time",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "source_locale": {
                    "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
                    "type": "string"
                  },
                  "status": {
                    "enum": [
                      "draft",
                      "published",
                      "archived"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "source_locale",
                  "i18n",
                  "kind",
                  "pinned",
                  "popup",
                  "audience",
                  "status",
                  "publish_at",
                  "expire_at"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "audience": {
                      "oneOf": [
                        {
                          "additionalProperties": false,
                          "properties": {
                            "type": {
                              "enum": [
                                "all"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "type": {
                              "enum": [
                                "active_subscription"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "type": {
                              "enum": [
                                "no_subscription"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "plan_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "minItems": 1,
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "plans"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "plan_ids"
                          ],
                          "type": "object"
                        }
                      ]
                    },
                    "created_by": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "expire_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "i18n": {
                      "additionalProperties": {
                        "additionalProperties": false,
                        "properties": {
                          "_meta": {
                            "additionalProperties": false,
                            "properties": {
                              "origin": {
                                "enum": [
                                  "manual",
                                  "machine",
                                  "builtin"
                                ],
                                "type": "string"
                              },
                              "provider": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "origin"
                            ],
                            "type": "object"
                          },
                          "body_md": {
                            "maxLength": 100000,
                            "type": "string"
                          },
                          "title": {
                            "maxLength": 500,
                            "type": "string"
                          }
                        },
                        "required": [
                          "title",
                          "body_md"
                        ],
                        "type": "object"
                      },
                      "type": "object"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "normal",
                        "important",
                        "maintenance"
                      ],
                      "type": "string"
                    },
                    "pinned": {
                      "type": "boolean"
                    },
                    "popup": {
                      "type": "boolean"
                    },
                    "publish_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source_locale": {
                      "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
                      "type": "string"
                    },
                    "status": {
                      "enum": [
                        "draft",
                        "published",
                        "archived"
                      ],
                      "type": "string"
                    },
                    "updated_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "source_locale",
                    "i18n",
                    "kind",
                    "pinned",
                    "popup",
                    "audience",
                    "status",
                    "publish_at",
                    "expire_at",
                    "id",
                    "created_by",
                    "updated_at",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid content"
          }
        },
        "summary": "Create an announcement",
        "tags": [
          "announcements"
        ],
        "x-audit": "support.announcement.create",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-concurrency": {
          "etag": true
        },
        "x-idempotency": "required",
        "x-permission": "support.announcement.manage"
      }
    },
    "/api/v1/admin/content/announcements/{id}": {
      "delete": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Version conflict"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "Delete an announcement with If-Match",
        "tags": [
          "announcements"
        ],
        "x-audit": "support.announcement.delete",
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "support.announcement.manage"
      },
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "audience": {
                      "oneOf": [
                        {
                          "additionalProperties": false,
                          "properties": {
                            "type": {
                              "enum": [
                                "all"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "type": {
                              "enum": [
                                "active_subscription"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "type": {
                              "enum": [
                                "no_subscription"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "plan_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "minItems": 1,
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "plans"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "plan_ids"
                          ],
                          "type": "object"
                        }
                      ]
                    },
                    "created_by": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "expire_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "i18n": {
                      "additionalProperties": {
                        "additionalProperties": false,
                        "properties": {
                          "_meta": {
                            "additionalProperties": false,
                            "properties": {
                              "origin": {
                                "enum": [
                                  "manual",
                                  "machine",
                                  "builtin"
                                ],
                                "type": "string"
                              },
                              "provider": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "origin"
                            ],
                            "type": "object"
                          },
                          "body_md": {
                            "maxLength": 100000,
                            "type": "string"
                          },
                          "title": {
                            "maxLength": 500,
                            "type": "string"
                          }
                        },
                        "required": [
                          "title",
                          "body_md"
                        ],
                        "type": "object"
                      },
                      "type": "object"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "normal",
                        "important",
                        "maintenance"
                      ],
                      "type": "string"
                    },
                    "pinned": {
                      "type": "boolean"
                    },
                    "popup": {
                      "type": "boolean"
                    },
                    "publish_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source_locale": {
                      "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
                      "type": "string"
                    },
                    "status": {
                      "enum": [
                        "draft",
                        "published",
                        "archived"
                      ],
                      "type": "string"
                    },
                    "updated_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "source_locale",
                    "i18n",
                    "kind",
                    "pinned",
                    "popup",
                    "audience",
                    "status",
                    "publish_at",
                    "expire_at",
                    "id",
                    "created_by",
                    "updated_at",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not found"
          }
        },
        "summary": "Announcement editor",
        "tags": [
          "announcements"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "support.announcement.manage"
      },
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "audience": {
                    "oneOf": [
                      {
                        "additionalProperties": false,
                        "properties": {
                          "type": {
                            "enum": [
                              "all"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "type": "object"
                      },
                      {
                        "additionalProperties": false,
                        "properties": {
                          "type": {
                            "enum": [
                              "active_subscription"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "type": "object"
                      },
                      {
                        "additionalProperties": false,
                        "properties": {
                          "type": {
                            "enum": [
                              "no_subscription"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "type"
                        ],
                        "type": "object"
                      },
                      {
                        "additionalProperties": false,
                        "properties": {
                          "plan_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "maxItems": 100,
                            "minItems": 1,
                            "type": "array"
                          },
                          "type": {
                            "enum": [
                              "plans"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "plan_ids"
                        ],
                        "type": "object"
                      }
                    ]
                  },
                  "expire_at": {
                    "format": "date-time",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "i18n": {
                    "additionalProperties": {
                      "additionalProperties": false,
                      "properties": {
                        "_meta": {
                          "additionalProperties": false,
                          "properties": {
                            "origin": {
                              "enum": [
                                "manual",
                                "machine",
                                "builtin"
                              ],
                              "type": "string"
                            },
                            "provider": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "origin"
                          ],
                          "type": "object"
                        },
                        "body_md": {
                          "maxLength": 100000,
                          "type": "string"
                        },
                        "title": {
                          "maxLength": 500,
                          "type": "string"
                        }
                      },
                      "required": [
                        "title",
                        "body_md"
                      ],
                      "type": "object"
                    },
                    "type": "object"
                  },
                  "kind": {
                    "enum": [
                      "normal",
                      "important",
                      "maintenance"
                    ],
                    "type": "string"
                  },
                  "pinned": {
                    "type": "boolean"
                  },
                  "popup": {
                    "type": "boolean"
                  },
                  "publish_at": {
                    "format": "date-time",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "source_locale": {
                    "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
                    "type": "string"
                  },
                  "status": {
                    "enum": [
                      "draft",
                      "published",
                      "archived"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "source_locale",
                  "i18n",
                  "kind",
                  "pinned",
                  "popup",
                  "audience",
                  "status",
                  "publish_at",
                  "expire_at"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "audience": {
                      "oneOf": [
                        {
                          "additionalProperties": false,
                          "properties": {
                            "type": {
                              "enum": [
                                "all"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "type": {
                              "enum": [
                                "active_subscription"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "type": {
                              "enum": [
                                "no_subscription"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type"
                          ],
                          "type": "object"
                        },
                        {
                          "additionalProperties": false,
                          "properties": {
                            "plan_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 100,
                              "minItems": 1,
                              "type": "array"
                            },
                            "type": {
                              "enum": [
                                "plans"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "plan_ids"
                          ],
                          "type": "object"
                        }
                      ]
                    },
                    "created_by": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "expire_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "i18n": {
                      "additionalProperties": {
                        "additionalProperties": false,
                        "properties": {
                          "_meta": {
                            "additionalProperties": false,
                            "properties": {
                              "origin": {
                                "enum": [
                                  "manual",
                                  "machine",
                                  "builtin"
                                ],
                                "type": "string"
                              },
                              "provider": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "origin"
                            ],
                            "type": "object"
                          },
                          "body_md": {
                            "maxLength": 100000,
                            "type": "string"
                          },
                          "title": {
                            "maxLength": 500,
                            "type": "string"
                          }
                        },
                        "required": [
                          "title",
                          "body_md"
                        ],
                        "type": "object"
                      },
                      "type": "object"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "normal",
                        "important",
                        "maintenance"
                      ],
                      "type": "string"
                    },
                    "pinned": {
                      "type": "boolean"
                    },
                    "popup": {
                      "type": "boolean"
                    },
                    "publish_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source_locale": {
                      "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
                      "type": "string"
                    },
                    "status": {
                      "enum": [
                        "draft",
                        "published",
                        "archived"
                      ],
                      "type": "string"
                    },
                    "updated_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "source_locale",
                    "i18n",
                    "kind",
                    "pinned",
                    "popup",
                    "audience",
                    "status",
                    "publish_at",
                    "expire_at",
                    "id",
                    "created_by",
                    "updated_at",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Version conflict"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "Replace an announcement with If-Match",
        "tags": [
          "announcements"
        ],
        "x-audit": "support.announcement.update",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "support.announcement.manage"
      }
    },
    "/api/v1/admin/content/docs": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "category",
            "required": false,
            "schema": {
              "maxLength": 80,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "enum": [
                "draft",
                "published",
                "archived"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "maxLength": 4096,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "default": "false",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "category": {
                            "type": "string"
                          },
                          "i18n": {
                            "additionalProperties": {
                              "additionalProperties": false,
                              "properties": {
                                "_meta": {
                                  "additionalProperties": false,
                                  "properties": {
                                    "origin": {
                                      "enum": [
                                        "manual",
                                        "machine",
                                        "builtin"
                                      ],
                                      "type": "string"
                                    },
                                    "provider": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "origin"
                                  ],
                                  "type": "object"
                                },
                                "body_md": {
                                  "maxLength": 100000,
                                  "type": "string"
                                },
                                "title": {
                                  "maxLength": 500,
                                  "type": "string"
                                }
                              },
                              "required": [
                                "title",
                                "body_md"
                              ],
                              "type": "object"
                            },
                            "type": "object"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "sort": {
                            "type": "integer"
                          },
                          "source_locale": {
                            "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
                            "type": "string"
                          },
                          "status": {
                            "enum": [
                              "draft",
                              "published",
                              "archived"
                            ],
                            "type": "string"
                          },
                          "updated_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "id",
                          "slug",
                          "category",
                          "source_locale",
                          "i18n",
                          "status",
                          "sort",
                          "updated_at",
                          "version"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "summary": "List knowledge base articles",
        "tags": [
          "docs"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "support.doc.manage",
        "x-rate-limit": "support.docs",
        "x-reauth": false
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "category": {
                    "maxLength": 80,
                    "minLength": 1,
                    "type": "string"
                  },
                  "i18n": {
                    "additionalProperties": {
                      "additionalProperties": false,
                      "properties": {
                        "_meta": {
                          "additionalProperties": false,
                          "properties": {
                            "origin": {
                              "enum": [
                                "manual",
                                "machine",
                                "builtin"
                              ],
                              "type": "string"
                            },
                            "provider": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "origin"
                          ],
                          "type": "object"
                        },
                        "body_md": {
                          "maxLength": 100000,
                          "type": "string"
                        },
                        "title": {
                          "maxLength": 500,
                          "type": "string"
                        }
                      },
                      "required": [
                        "title",
                        "body_md"
                      ],
                      "type": "object"
                    },
                    "type": "object"
                  },
                  "slug": {
                    "maxLength": 150,
                    "minLength": 1,
                    "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
                    "type": "string"
                  },
                  "sort": {
                    "maximum": 2147483647,
                    "minimum": -2147483648,
                    "type": "integer"
                  },
                  "source_locale": {
                    "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
                    "type": "string"
                  },
                  "status": {
                    "enum": [
                      "draft",
                      "published",
                      "archived"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "slug",
                  "category",
                  "source_locale",
                  "i18n",
                  "status",
                  "sort"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "category": {
                      "type": "string"
                    },
                    "i18n": {
                      "additionalProperties": {
                        "additionalProperties": false,
                        "properties": {
                          "_meta": {
                            "additionalProperties": false,
                            "properties": {
                              "origin": {
                                "enum": [
                                  "manual",
                                  "machine",
                                  "builtin"
                                ],
                                "type": "string"
                              },
                              "provider": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "origin"
                            ],
                            "type": "object"
                          },
                          "body_md": {
                            "maxLength": 100000,
                            "type": "string"
                          },
                          "title": {
                            "maxLength": 500,
                            "type": "string"
                          }
                        },
                        "required": [
                          "title",
                          "body_md"
                        ],
                        "type": "object"
                      },
                      "type": "object"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "sort": {
                      "type": "integer"
                    },
                    "source_locale": {
                      "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
                      "type": "string"
                    },
                    "status": {
                      "enum": [
                        "draft",
                        "published",
                        "archived"
                      ],
                      "type": "string"
                    },
                    "updated_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "slug",
                    "category",
                    "source_locale",
                    "i18n",
                    "status",
                    "sort",
                    "updated_at",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Version or slug conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid document"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "Create an article",
        "tags": [
          "docs"
        ],
        "x-audit": "support.doc.create",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-concurrency": {
          "etag": true
        },
        "x-idempotency": "required",
        "x-permission": "support.doc.manage",
        "x-rate-limit": "support.docs",
        "x-reauth": false
      }
    },
    "/api/v1/admin/content/docs/{id}": {
      "delete": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Version or slug conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid document"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "Delete an article",
        "tags": [
          "docs"
        ],
        "x-audit": "support.doc.delete",
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "support.doc.manage",
        "x-rate-limit": "support.docs",
        "x-reauth": false
      },
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "category": {
                      "type": "string"
                    },
                    "i18n": {
                      "additionalProperties": {
                        "additionalProperties": false,
                        "properties": {
                          "_meta": {
                            "additionalProperties": false,
                            "properties": {
                              "origin": {
                                "enum": [
                                  "manual",
                                  "machine",
                                  "builtin"
                                ],
                                "type": "string"
                              },
                              "provider": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "origin"
                            ],
                            "type": "object"
                          },
                          "body_md": {
                            "maxLength": 100000,
                            "type": "string"
                          },
                          "title": {
                            "maxLength": 500,
                            "type": "string"
                          }
                        },
                        "required": [
                          "title",
                          "body_md"
                        ],
                        "type": "object"
                      },
                      "type": "object"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "sort": {
                      "type": "integer"
                    },
                    "source_locale": {
                      "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
                      "type": "string"
                    },
                    "status": {
                      "enum": [
                        "draft",
                        "published",
                        "archived"
                      ],
                      "type": "string"
                    },
                    "updated_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "slug",
                    "category",
                    "source_locale",
                    "i18n",
                    "status",
                    "sort",
                    "updated_at",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Version or slug conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid document"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "Knowledge base editor",
        "tags": [
          "docs"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "support.doc.manage",
        "x-rate-limit": "support.docs",
        "x-reauth": false
      },
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "category": {
                    "maxLength": 80,
                    "minLength": 1,
                    "type": "string"
                  },
                  "i18n": {
                    "additionalProperties": {
                      "additionalProperties": false,
                      "properties": {
                        "_meta": {
                          "additionalProperties": false,
                          "properties": {
                            "origin": {
                              "enum": [
                                "manual",
                                "machine",
                                "builtin"
                              ],
                              "type": "string"
                            },
                            "provider": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "origin"
                          ],
                          "type": "object"
                        },
                        "body_md": {
                          "maxLength": 100000,
                          "type": "string"
                        },
                        "title": {
                          "maxLength": 500,
                          "type": "string"
                        }
                      },
                      "required": [
                        "title",
                        "body_md"
                      ],
                      "type": "object"
                    },
                    "type": "object"
                  },
                  "slug": {
                    "maxLength": 150,
                    "minLength": 1,
                    "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
                    "type": "string"
                  },
                  "sort": {
                    "maximum": 2147483647,
                    "minimum": -2147483648,
                    "type": "integer"
                  },
                  "source_locale": {
                    "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
                    "type": "string"
                  },
                  "status": {
                    "enum": [
                      "draft",
                      "published",
                      "archived"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "slug",
                  "category",
                  "source_locale",
                  "i18n",
                  "status",
                  "sort"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "category": {
                      "type": "string"
                    },
                    "i18n": {
                      "additionalProperties": {
                        "additionalProperties": false,
                        "properties": {
                          "_meta": {
                            "additionalProperties": false,
                            "properties": {
                              "origin": {
                                "enum": [
                                  "manual",
                                  "machine",
                                  "builtin"
                                ],
                                "type": "string"
                              },
                              "provider": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "origin"
                            ],
                            "type": "object"
                          },
                          "body_md": {
                            "maxLength": 100000,
                            "type": "string"
                          },
                          "title": {
                            "maxLength": 500,
                            "type": "string"
                          }
                        },
                        "required": [
                          "title",
                          "body_md"
                        ],
                        "type": "object"
                      },
                      "type": "object"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "sort": {
                      "type": "integer"
                    },
                    "source_locale": {
                      "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
                      "type": "string"
                    },
                    "status": {
                      "enum": [
                        "draft",
                        "published",
                        "archived"
                      ],
                      "type": "string"
                    },
                    "updated_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "slug",
                    "category",
                    "source_locale",
                    "i18n",
                    "status",
                    "sort",
                    "updated_at",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Version or slug conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid document"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "Replace an article",
        "tags": [
          "docs"
        ],
        "x-audit": "support.doc.update",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "support.doc.manage",
        "x-rate-limit": "support.docs",
        "x-reauth": false
      }
    },
    "/api/v1/admin/distribution/canaries/{clientKey}/{action}": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "clientKey",
            "required": true,
            "schema": {
              "enum": [
                "mihomo",
                "sing_box@1.11",
                "sing_box@1.12",
                "sing_box@1.13",
                "uri_base64",
                "hiddify",
                "stash",
                "surge",
                "quantumult_x",
                "loon",
                "surfboard",
                "shadowrocket"
              ],
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "action",
            "required": true,
            "schema": {
              "enum": [
                "promote",
                "rollback"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "policy": {
                      "additionalProperties": false,
                      "properties": {
                        "canaries": {
                          "default": [],
                          "items": {
                            "additionalProperties": false,
                            "properties": {
                              "client": {
                                "enum": [
                                  "mihomo",
                                  "sing_box@1.11",
                                  "sing_box@1.12",
                                  "sing_box@1.13",
                                  "uri_base64",
                                  "hiddify",
                                  "stash",
                                  "surge",
                                  "quantumult_x",
                                  "loon",
                                  "surfboard",
                                  "shadowrocket"
                                ],
                                "type": "string"
                              },
                              "percentage_bps": {
                                "maximum": 10000,
                                "minimum": 0,
                                "type": "integer"
                              },
                              "subscription_ids": {
                                "default": [],
                                "items": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "maxItems": 1000,
                                "type": "array"
                              },
                              "template_id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "user_ids": {
                                "default": [],
                                "items": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "maxItems": 1000,
                                "type": "array"
                              }
                            },
                            "required": [
                              "client",
                              "template_id",
                              "percentage_bps"
                            ],
                            "type": "object"
                          },
                          "maxItems": 50,
                          "type": "array"
                        },
                        "rules": {
                          "default": [],
                          "items": {
                            "additionalProperties": false,
                            "properties": {
                              "client": {
                                "enum": [
                                  "mihomo",
                                  "sing_box@1.11",
                                  "sing_box@1.12",
                                  "sing_box@1.13",
                                  "uri_base64",
                                  "hiddify",
                                  "stash",
                                  "surge",
                                  "quantumult_x",
                                  "loon",
                                  "surfboard",
                                  "shadowrocket"
                                ],
                                "type": "string"
                              },
                              "id": {
                                "pattern": "^[a-z0-9_-]{1,64}$",
                                "type": "string"
                              },
                              "max_version": {
                                "pattern": "^\\d{1,6}\\.\\d{1,6}(?:\\.\\d{1,6})?$",
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "min_version": {
                                "pattern": "^\\d{1,6}\\.\\d{1,6}(?:\\.\\d{1,6})?$",
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "template_id": {
                                "format": "uuid",
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "client",
                              "min_version",
                              "max_version",
                              "template_id"
                            ],
                            "type": "object"
                          },
                          "maxItems": 200,
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "policy",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Promote a canary to all subscriptions or roll it back",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.canary.finish",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional",
        "x-permission": "distribution.template.manage",
        "x-reauth": false
      }
    },
    "/api/v1/admin/distribution/carriers": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "asns": {
                            "items": {
                              "maximum": 2147483647,
                              "minimum": 1,
                              "type": "integer"
                            },
                            "maxItems": 1000,
                            "type": "array"
                          },
                          "hidden": {
                            "default": false,
                            "type": "boolean"
                          },
                          "key": {
                            "pattern": "^[a-z0-9_-]{1,64}$",
                            "type": "string"
                          },
                          "merge_into": {
                            "default": null,
                            "pattern": "^[a-z0-9_-]{1,64}$",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "name": {
                            "maxLength": 200,
                            "minLength": 1,
                            "type": "string"
                          }
                        },
                        "required": [
                          "key",
                          "name",
                          "asns"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "stats": {
                      "additionalProperties": {},
                      "type": "object"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "items",
                    "stats",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Observed carriers and preserved operator overrides",
        "tags": [
          "distribution"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "distribution.filter.manage"
      },
      "put": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "items": {
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "asns": {
                          "items": {
                            "maximum": 2147483647,
                            "minimum": 1,
                            "type": "integer"
                          },
                          "maxItems": 1000,
                          "type": "array"
                        },
                        "hidden": {
                          "default": false,
                          "type": "boolean"
                        },
                        "key": {
                          "pattern": "^[a-z0-9_-]{1,64}$",
                          "type": "string"
                        },
                        "merge_into": {
                          "default": null,
                          "pattern": "^[a-z0-9_-]{1,64}$",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "name": {
                          "maxLength": 200,
                          "minLength": 1,
                          "type": "string"
                        }
                      },
                      "required": [
                        "key",
                        "name",
                        "asns"
                      ],
                      "type": "object"
                    },
                    "maxItems": 2000,
                    "type": "array"
                  }
                },
                "required": [
                  "items"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "asns": {
                            "items": {
                              "maximum": 2147483647,
                              "minimum": 1,
                              "type": "integer"
                            },
                            "maxItems": 1000,
                            "type": "array"
                          },
                          "hidden": {
                            "default": false,
                            "type": "boolean"
                          },
                          "key": {
                            "pattern": "^[a-z0-9_-]{1,64}$",
                            "type": "string"
                          },
                          "merge_into": {
                            "default": null,
                            "pattern": "^[a-z0-9_-]{1,64}$",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "name": {
                            "maxLength": 200,
                            "minLength": 1,
                            "type": "string"
                          }
                        },
                        "required": [
                          "key",
                          "name",
                          "asns"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "stats": {
                      "additionalProperties": {},
                      "type": "object"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "items",
                    "stats",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Rename, merge or hide carriers with If-Match",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.carriers.update",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-idempotency": "optional",
        "x-permission": "distribution.filter.manage"
      }
    },
    "/api/v1/admin/distribution/clients": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "clients": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "downloads": {
                            "items": {
                              "oneOf": [
                                {
                                  "additionalProperties": false,
                                  "properties": {
                                    "platform": {
                                      "maxLength": 50,
                                      "minLength": 1,
                                      "type": "string"
                                    },
                                    "type": {
                                      "enum": [
                                        "external"
                                      ],
                                      "type": "string"
                                    },
                                    "url": {
                                      "format": "uri",
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "platform",
                                    "url"
                                  ],
                                  "type": "object"
                                },
                                {
                                  "additionalProperties": false,
                                  "properties": {
                                    "file_id": {
                                      "format": "uuid",
                                      "type": "string"
                                    },
                                    "platform": {
                                      "maxLength": 50,
                                      "minLength": 1,
                                      "type": "string"
                                    },
                                    "type": {
                                      "enum": [
                                        "hosted"
                                      ],
                                      "type": "string"
                                    },
                                    "version": {
                                      "maxLength": 100,
                                      "minLength": 1,
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "platform",
                                    "file_id",
                                    "version"
                                  ],
                                  "type": "object"
                                }
                              ]
                            },
                            "maxItems": 30,
                            "type": "array"
                          },
                          "enabled": {
                            "type": "boolean"
                          },
                          "i18n": {
                            "additionalProperties": {
                              "properties": {
                                "_meta": {
                                  "properties": {
                                    "origin": {
                                      "enum": [
                                        "manual",
                                        "machine",
                                        "builtin"
                                      ],
                                      "type": "string"
                                    },
                                    "provider": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "origin"
                                  ],
                                  "type": "object"
                                },
                                "description": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "type": "object"
                            },
                            "type": "object"
                          },
                          "key": {
                            "pattern": "^[a-z0-9_.@-]{1,64}$",
                            "type": "string"
                          },
                          "source_locale": {
                            "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
                            "type": "string"
                          }
                        },
                        "required": [
                          "key",
                          "source_locale",
                          "i18n",
                          "enabled",
                          "downloads"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "clients",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Client catalog",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Edit the client catalog",
        "tags": [
          "clients"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "distribution.client.manage"
      },
      "put": {
        "parameters": [
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "clients": {
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "downloads": {
                          "items": {
                            "oneOf": [
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "platform": {
                                    "maxLength": 50,
                                    "minLength": 1,
                                    "type": "string"
                                  },
                                  "type": {
                                    "enum": [
                                      "external"
                                    ],
                                    "type": "string"
                                  },
                                  "url": {
                                    "format": "uri",
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "type",
                                  "platform",
                                  "url"
                                ],
                                "type": "object"
                              },
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "file_id": {
                                    "format": "uuid",
                                    "type": "string"
                                  },
                                  "platform": {
                                    "maxLength": 50,
                                    "minLength": 1,
                                    "type": "string"
                                  },
                                  "type": {
                                    "enum": [
                                      "hosted"
                                    ],
                                    "type": "string"
                                  },
                                  "version": {
                                    "maxLength": 100,
                                    "minLength": 1,
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "type",
                                  "platform",
                                  "file_id",
                                  "version"
                                ],
                                "type": "object"
                              }
                            ]
                          },
                          "maxItems": 30,
                          "type": "array"
                        },
                        "enabled": {
                          "type": "boolean"
                        },
                        "i18n": {
                          "additionalProperties": {
                            "additionalProperties": false,
                            "properties": {
                              "_meta": {
                                "additionalProperties": false,
                                "properties": {
                                  "origin": {
                                    "enum": [
                                      "manual",
                                      "machine",
                                      "builtin"
                                    ],
                                    "type": "string"
                                  },
                                  "provider": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "origin"
                                ],
                                "type": "object"
                              },
                              "description": {
                                "maxLength": 10000,
                                "type": "string"
                              },
                              "name": {
                                "maxLength": 200,
                                "type": "string"
                              }
                            },
                            "required": [
                              "name",
                              "description"
                            ],
                            "type": "object"
                          },
                          "type": "object"
                        },
                        "key": {
                          "pattern": "^[a-z0-9_.@-]{1,64}$",
                          "type": "string"
                        },
                        "source_locale": {
                          "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
                          "type": "string"
                        }
                      },
                      "required": [
                        "key",
                        "source_locale",
                        "i18n",
                        "enabled",
                        "downloads"
                      ],
                      "type": "object"
                    },
                    "maxItems": 100,
                    "type": "array"
                  }
                },
                "required": [
                  "clients"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "clients": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "downloads": {
                            "items": {
                              "oneOf": [
                                {
                                  "additionalProperties": false,
                                  "properties": {
                                    "platform": {
                                      "maxLength": 50,
                                      "minLength": 1,
                                      "type": "string"
                                    },
                                    "type": {
                                      "enum": [
                                        "external"
                                      ],
                                      "type": "string"
                                    },
                                    "url": {
                                      "format": "uri",
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "platform",
                                    "url"
                                  ],
                                  "type": "object"
                                },
                                {
                                  "additionalProperties": false,
                                  "properties": {
                                    "file_id": {
                                      "format": "uuid",
                                      "type": "string"
                                    },
                                    "platform": {
                                      "maxLength": 50,
                                      "minLength": 1,
                                      "type": "string"
                                    },
                                    "type": {
                                      "enum": [
                                        "hosted"
                                      ],
                                      "type": "string"
                                    },
                                    "version": {
                                      "maxLength": 100,
                                      "minLength": 1,
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "type",
                                    "platform",
                                    "file_id",
                                    "version"
                                  ],
                                  "type": "object"
                                }
                              ]
                            },
                            "maxItems": 30,
                            "type": "array"
                          },
                          "enabled": {
                            "type": "boolean"
                          },
                          "i18n": {
                            "additionalProperties": {
                              "properties": {
                                "_meta": {
                                  "properties": {
                                    "origin": {
                                      "enum": [
                                        "manual",
                                        "machine",
                                        "builtin"
                                      ],
                                      "type": "string"
                                    },
                                    "provider": {
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "origin"
                                  ],
                                  "type": "object"
                                },
                                "description": {
                                  "type": "string"
                                },
                                "name": {
                                  "type": "string"
                                }
                              },
                              "type": "object"
                            },
                            "type": "object"
                          },
                          "key": {
                            "pattern": "^[a-z0-9_.@-]{1,64}$",
                            "type": "string"
                          },
                          "source_locale": {
                            "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
                            "type": "string"
                          }
                        },
                        "required": [
                          "key",
                          "source_locale",
                          "i18n",
                          "enabled",
                          "downloads"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "clients",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Client catalog",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Save client catalog with If-Match",
        "tags": [
          "clients"
        ],
        "x-audit": "distribution.clients.update",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "distribution.client.manage"
      }
    },
    "/api/v1/admin/distribution/compatibility": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "format",
            "required": false,
            "schema": {
              "default": "json",
              "enum": [
                "json",
                "csv"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "client": {
                            "enum": [
                              "mihomo",
                              "sing_box@1.11",
                              "sing_box@1.12",
                              "sing_box@1.13",
                              "uri_base64",
                              "hiddify",
                              "stash",
                              "surge",
                              "quantumult_x",
                              "loon",
                              "surfboard",
                              "shadowrocket"
                            ],
                            "type": "string"
                          },
                          "max_version": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "min_version": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "percentage_bps": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "priority": {
                            "type": "integer"
                          },
                          "protocols": {
                            "items": {
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "source": {
                            "enum": [
                              "default",
                              "version_rule",
                              "canary"
                            ],
                            "type": "string"
                          },
                          "targeted_subscriptions": {
                            "type": "integer"
                          },
                          "targeted_users": {
                            "type": "integer"
                          },
                          "template_revision": {
                            "type": "string"
                          },
                          "template_version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "client",
                          "min_version",
                          "max_version",
                          "template_revision",
                          "template_version",
                          "protocols",
                          "source",
                          "priority",
                          "percentage_bps",
                          "targeted_subscriptions",
                          "targeted_users"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Compatibility matrix"
          }
        },
        "summary": "Export client version ranges, revision IDs, precedence and protocols",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.template_policy.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "distribution.template.manage",
        "x-reauth": false
      }
    },
    "/api/v1/admin/distribution/filter-preview": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "carrier": {
                    "maxLength": 64,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "conditions": {
                    "default": {},
                    "properties": {
                      "client": {
                        "maxLength": 64,
                        "type": "string"
                      },
                      "exclude_keyword": {
                        "maxLength": 2048,
                        "type": "string"
                      },
                      "ip_family": {
                        "maxLength": 2048,
                        "type": "string"
                      },
                      "isp": {
                        "maxLength": 2048,
                        "type": "string"
                      },
                      "kind": {
                        "maxLength": 2048,
                        "type": "string"
                      },
                      "limit": {
                        "maxLength": 128,
                        "type": "string"
                      },
                      "protocol": {
                        "maxLength": 2048,
                        "type": "string"
                      },
                      "region": {
                        "maxLength": 2048,
                        "type": "string"
                      },
                      "sort": {
                        "maxLength": 128,
                        "type": "string"
                      },
                      "tag": {
                        "maxLength": 2048,
                        "type": "string"
                      },
                      "ver": {
                        "maxLength": 32,
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "region_code": {
                    "maxLength": 64,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "rules": {
                    "additionalProperties": false,
                    "properties": {
                      "default_client": {
                        "default": "mihomo",
                        "pattern": "^[a-z0-9_.@-]{1,64}$",
                        "type": "string"
                      },
                      "exclusions": {
                        "default": [],
                        "items": {
                          "additionalProperties": false,
                          "properties": {
                            "carriers": {
                              "default": [],
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "clients": {
                              "default": [],
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "match": {
                              "additionalProperties": false,
                              "properties": {
                                "keywords": {
                                  "default": [],
                                  "items": {
                                    "maxLength": 128,
                                    "minLength": 1,
                                    "type": "string"
                                  },
                                  "maxItems": 200,
                                  "type": "array"
                                },
                                "kinds": {
                                  "default": [],
                                  "items": {
                                    "maxLength": 128,
                                    "minLength": 1,
                                    "type": "string"
                                  },
                                  "maxItems": 200,
                                  "type": "array"
                                },
                                "node_ids": {
                                  "default": [],
                                  "items": {
                                    "format": "uuid",
                                    "type": "string"
                                  },
                                  "maxItems": 1000,
                                  "type": "array"
                                },
                                "protocols": {
                                  "default": [],
                                  "items": {
                                    "maxLength": 128,
                                    "minLength": 1,
                                    "type": "string"
                                  },
                                  "maxItems": 200,
                                  "type": "array"
                                },
                                "regions": {
                                  "default": [],
                                  "items": {
                                    "maxLength": 128,
                                    "minLength": 1,
                                    "type": "string"
                                  },
                                  "maxItems": 200,
                                  "type": "array"
                                },
                                "tags": {
                                  "default": [],
                                  "items": {
                                    "maxLength": 128,
                                    "minLength": 1,
                                    "type": "string"
                                  },
                                  "maxItems": 200,
                                  "type": "array"
                                }
                              },
                              "type": "object"
                            }
                          },
                          "required": [
                            "match"
                          ],
                          "type": "object"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "hide_high_load": {
                        "default": false,
                        "type": "boolean"
                      },
                      "hide_offline": {
                        "default": false,
                        "type": "boolean"
                      },
                      "lines": {
                        "default": [],
                        "items": {
                          "additionalProperties": false,
                          "properties": {
                            "carrier": {
                              "maxLength": 64,
                              "minLength": 1,
                              "type": "string"
                            },
                            "mode": {
                              "enum": [
                                "only",
                                "prefer"
                              ],
                              "type": "string"
                            },
                            "node_ids": {
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 1000,
                              "type": "array"
                            },
                            "region_code": {
                              "default": null,
                              "maxLength": 64,
                              "minLength": 1,
                              "type": [
                                "string",
                                "null"
                              ]
                            }
                          },
                          "required": [
                            "carrier",
                            "node_ids",
                            "mode"
                          ],
                          "type": "object"
                        },
                        "maxItems": 500,
                        "type": "array"
                      },
                      "max_nodes": {
                        "default": 200,
                        "maximum": 1000,
                        "minimum": 1,
                        "type": "integer"
                      },
                      "name_template": {
                        "default": "{region_flag} {name}",
                        "maxLength": 512,
                        "minLength": 1,
                        "type": "string"
                      },
                      "show_node_load": {
                        "default": true,
                        "type": "boolean"
                      },
                      "subscription_url": {
                        "default": null,
                        "format": "uri",
                        "type": [
                          "string",
                          "null"
                        ]
                      },
                      "update_interval_hours": {
                        "default": 12,
                        "maximum": 168,
                        "minimum": 1,
                        "type": "integer"
                      },
                      "user_params": {
                        "default": {
                          "exclude_keyword": [
                            "*"
                          ],
                          "ip_family": [
                            "ipv4",
                            "ipv6"
                          ],
                          "isp": [
                            "*"
                          ],
                          "kind": [
                            "direct",
                            "relay",
                            "cdn"
                          ],
                          "limit": [
                            "*"
                          ],
                          "protocol": [
                            "*"
                          ],
                          "region": [
                            "*"
                          ],
                          "sort": [
                            "sort",
                            "name",
                            "region"
                          ],
                          "tag": [
                            "*"
                          ]
                        },
                        "properties": {
                          "exclude_keyword": {
                            "items": {
                              "maxLength": 128,
                              "minLength": 1,
                              "type": "string"
                            },
                            "maxItems": 200,
                            "type": "array"
                          },
                          "ip_family": {
                            "items": {
                              "maxLength": 128,
                              "minLength": 1,
                              "type": "string"
                            },
                            "maxItems": 200,
                            "type": "array"
                          },
                          "isp": {
                            "items": {
                              "maxLength": 128,
                              "minLength": 1,
                              "type": "string"
                            },
                            "maxItems": 200,
                            "type": "array"
                          },
                          "kind": {
                            "items": {
                              "maxLength": 128,
                              "minLength": 1,
                              "type": "string"
                            },
                            "maxItems": 200,
                            "type": "array"
                          },
                          "limit": {
                            "items": {
                              "maxLength": 128,
                              "minLength": 1,
                              "type": "string"
                            },
                            "maxItems": 200,
                            "type": "array"
                          },
                          "protocol": {
                            "items": {
                              "maxLength": 128,
                              "minLength": 1,
                              "type": "string"
                            },
                            "maxItems": 200,
                            "type": "array"
                          },
                          "region": {
                            "items": {
                              "maxLength": 128,
                              "minLength": 1,
                              "type": "string"
                            },
                            "maxItems": 200,
                            "type": "array"
                          },
                          "sort": {
                            "items": {
                              "maxLength": 128,
                              "minLength": 1,
                              "type": "string"
                            },
                            "maxItems": 200,
                            "type": "array"
                          },
                          "tag": {
                            "items": {
                              "maxLength": 128,
                              "minLength": 1,
                              "type": "string"
                            },
                            "maxItems": 200,
                            "type": "array"
                          }
                        },
                        "type": "object"
                      }
                    },
                    "type": "object"
                  },
                  "subscription_id": {
                    "format": "uuid",
                    "type": "string"
                  }
                },
                "required": [
                  "subscription_id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "client": {
                      "enum": [
                        "mihomo",
                        "sing_box@1.11",
                        "sing_box@1.12",
                        "sing_box@1.13",
                        "uri_base64",
                        "hiddify",
                        "stash",
                        "surge",
                        "quantumult_x",
                        "loon",
                        "surfboard",
                        "shadowrocket"
                      ],
                      "type": "string"
                    },
                    "failed_nodes": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "fallback": {
                      "type": "boolean"
                    },
                    "format": {
                      "enum": [
                        "yaml",
                        "json",
                        "conf",
                        "text",
                        "base64"
                      ],
                      "type": "string"
                    },
                    "nodes": {
                      "items": {
                        "properties": {
                          "address_family": {
                            "type": "string"
                          },
                          "health": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "load": {
                            "additionalProperties": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "type": "object"
                          },
                          "name": {
                            "type": "string"
                          },
                          "protocol": {
                            "type": "string"
                          },
                          "region": {
                            "type": "string"
                          },
                          "tags": {
                            "items": {
                              "type": "string"
                            },
                            "type": "array"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "protocol",
                          "region",
                          "tags"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "output": {
                      "type": "string"
                    },
                    "result": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "client",
                    "format",
                    "output",
                    "result",
                    "nodes",
                    "fallback",
                    "failed_nodes"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Preview proposed rules without saving them",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.filters.preview",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-idempotency": "none",
        "x-permission": "distribution.filter.manage"
      }
    },
    "/api/v1/admin/distribution/filters": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "rules": {
                      "additionalProperties": false,
                      "properties": {
                        "default_client": {
                          "default": "mihomo",
                          "pattern": "^[a-z0-9_.@-]{1,64}$",
                          "type": "string"
                        },
                        "exclusions": {
                          "default": [],
                          "items": {
                            "additionalProperties": false,
                            "properties": {
                              "carriers": {
                                "default": [],
                                "items": {
                                  "maxLength": 128,
                                  "minLength": 1,
                                  "type": "string"
                                },
                                "maxItems": 200,
                                "type": "array"
                              },
                              "clients": {
                                "default": [],
                                "items": {
                                  "maxLength": 128,
                                  "minLength": 1,
                                  "type": "string"
                                },
                                "maxItems": 200,
                                "type": "array"
                              },
                              "match": {
                                "additionalProperties": false,
                                "properties": {
                                  "keywords": {
                                    "default": [],
                                    "items": {
                                      "maxLength": 128,
                                      "minLength": 1,
                                      "type": "string"
                                    },
                                    "maxItems": 200,
                                    "type": "array"
                                  },
                                  "kinds": {
                                    "default": [],
                                    "items": {
                                      "maxLength": 128,
                                      "minLength": 1,
                                      "type": "string"
                                    },
                                    "maxItems": 200,
                                    "type": "array"
                                  },
                                  "node_ids": {
                                    "default": [],
                                    "items": {
                                      "format": "uuid",
                                      "type": "string"
                                    },
                                    "maxItems": 1000,
                                    "type": "array"
                                  },
                                  "protocols": {
                                    "default": [],
                                    "items": {
                                      "maxLength": 128,
                                      "minLength": 1,
                                      "type": "string"
                                    },
                                    "maxItems": 200,
                                    "type": "array"
                                  },
                                  "regions": {
                                    "default": [],
                                    "items": {
                                      "maxLength": 128,
                                      "minLength": 1,
                                      "type": "string"
                                    },
                                    "maxItems": 200,
                                    "type": "array"
                                  },
                                  "tags": {
                                    "default": [],
                                    "items": {
                                      "maxLength": 128,
                                      "minLength": 1,
                                      "type": "string"
                                    },
                                    "maxItems": 200,
                                    "type": "array"
                                  }
                                },
                                "type": "object"
                              }
                            },
                            "required": [
                              "match"
                            ],
                            "type": "object"
                          },
                          "maxItems": 200,
                          "type": "array"
                        },
                        "hide_high_load": {
                          "default": false,
                          "type": "boolean"
                        },
                        "hide_offline": {
                          "default": false,
                          "type": "boolean"
                        },
                        "lines": {
                          "default": [],
                          "items": {
                            "additionalProperties": false,
                            "properties": {
                              "carrier": {
                                "maxLength": 64,
                                "minLength": 1,
                                "type": "string"
                              },
                              "mode": {
                                "enum": [
                                  "only",
                                  "prefer"
                                ],
                                "type": "string"
                              },
                              "node_ids": {
                                "items": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "maxItems": 1000,
                                "type": "array"
                              },
                              "region_code": {
                                "default": null,
                                "maxLength": 64,
                                "minLength": 1,
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "carrier",
                              "node_ids",
                              "mode"
                            ],
                            "type": "object"
                          },
                          "maxItems": 500,
                          "type": "array"
                        },
                        "max_nodes": {
                          "default": 200,
                          "maximum": 1000,
                          "minimum": 1,
                          "type": "integer"
                        },
                        "name_template": {
                          "default": "{region_flag} {name}",
                          "maxLength": 512,
                          "minLength": 1,
                          "type": "string"
                        },
                        "show_node_load": {
                          "default": true,
                          "type": "boolean"
                        },
                        "subscription_url": {
                          "default": null,
                          "format": "uri",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "update_interval_hours": {
                          "default": 12,
                          "maximum": 168,
                          "minimum": 1,
                          "type": "integer"
                        },
                        "user_params": {
                          "default": {
                            "exclude_keyword": [
                              "*"
                            ],
                            "ip_family": [
                              "ipv4",
                              "ipv6"
                            ],
                            "isp": [
                              "*"
                            ],
                            "kind": [
                              "direct",
                              "relay",
                              "cdn"
                            ],
                            "limit": [
                              "*"
                            ],
                            "protocol": [
                              "*"
                            ],
                            "region": [
                              "*"
                            ],
                            "sort": [
                              "sort",
                              "name",
                              "region"
                            ],
                            "tag": [
                              "*"
                            ]
                          },
                          "properties": {
                            "exclude_keyword": {
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "ip_family": {
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "isp": {
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "kind": {
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "limit": {
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "protocol": {
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "region": {
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "sort": {
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "tag": {
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "rules",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Read distribution rules",
        "tags": [
          "distribution"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "distribution.filter.manage"
      },
      "put": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "default_client": {
                    "default": "mihomo",
                    "pattern": "^[a-z0-9_.@-]{1,64}$",
                    "type": "string"
                  },
                  "exclusions": {
                    "default": [],
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "carriers": {
                          "default": [],
                          "items": {
                            "maxLength": 128,
                            "minLength": 1,
                            "type": "string"
                          },
                          "maxItems": 200,
                          "type": "array"
                        },
                        "clients": {
                          "default": [],
                          "items": {
                            "maxLength": 128,
                            "minLength": 1,
                            "type": "string"
                          },
                          "maxItems": 200,
                          "type": "array"
                        },
                        "match": {
                          "additionalProperties": false,
                          "properties": {
                            "keywords": {
                              "default": [],
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "kinds": {
                              "default": [],
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "node_ids": {
                              "default": [],
                              "items": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "maxItems": 1000,
                              "type": "array"
                            },
                            "protocols": {
                              "default": [],
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "regions": {
                              "default": [],
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "tags": {
                              "default": [],
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "required": [
                        "match"
                      ],
                      "type": "object"
                    },
                    "maxItems": 200,
                    "type": "array"
                  },
                  "hide_high_load": {
                    "default": false,
                    "type": "boolean"
                  },
                  "hide_offline": {
                    "default": false,
                    "type": "boolean"
                  },
                  "lines": {
                    "default": [],
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "carrier": {
                          "maxLength": 64,
                          "minLength": 1,
                          "type": "string"
                        },
                        "mode": {
                          "enum": [
                            "only",
                            "prefer"
                          ],
                          "type": "string"
                        },
                        "node_ids": {
                          "items": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "maxItems": 1000,
                          "type": "array"
                        },
                        "region_code": {
                          "default": null,
                          "maxLength": 64,
                          "minLength": 1,
                          "type": [
                            "string",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "carrier",
                        "node_ids",
                        "mode"
                      ],
                      "type": "object"
                    },
                    "maxItems": 500,
                    "type": "array"
                  },
                  "max_nodes": {
                    "default": 200,
                    "maximum": 1000,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "name_template": {
                    "default": "{region_flag} {name}",
                    "maxLength": 512,
                    "minLength": 1,
                    "type": "string"
                  },
                  "show_node_load": {
                    "default": true,
                    "type": "boolean"
                  },
                  "subscription_url": {
                    "default": null,
                    "format": "uri",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "update_interval_hours": {
                    "default": 12,
                    "maximum": 168,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "user_params": {
                    "default": {
                      "exclude_keyword": [
                        "*"
                      ],
                      "ip_family": [
                        "ipv4",
                        "ipv6"
                      ],
                      "isp": [
                        "*"
                      ],
                      "kind": [
                        "direct",
                        "relay",
                        "cdn"
                      ],
                      "limit": [
                        "*"
                      ],
                      "protocol": [
                        "*"
                      ],
                      "region": [
                        "*"
                      ],
                      "sort": [
                        "sort",
                        "name",
                        "region"
                      ],
                      "tag": [
                        "*"
                      ]
                    },
                    "properties": {
                      "exclude_keyword": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "ip_family": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "isp": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "kind": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "limit": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "protocol": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "region": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "sort": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      },
                      "tag": {
                        "items": {
                          "maxLength": 128,
                          "minLength": 1,
                          "type": "string"
                        },
                        "maxItems": 200,
                        "type": "array"
                      }
                    },
                    "type": "object"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "rules": {
                      "additionalProperties": false,
                      "properties": {
                        "default_client": {
                          "default": "mihomo",
                          "pattern": "^[a-z0-9_.@-]{1,64}$",
                          "type": "string"
                        },
                        "exclusions": {
                          "default": [],
                          "items": {
                            "additionalProperties": false,
                            "properties": {
                              "carriers": {
                                "default": [],
                                "items": {
                                  "maxLength": 128,
                                  "minLength": 1,
                                  "type": "string"
                                },
                                "maxItems": 200,
                                "type": "array"
                              },
                              "clients": {
                                "default": [],
                                "items": {
                                  "maxLength": 128,
                                  "minLength": 1,
                                  "type": "string"
                                },
                                "maxItems": 200,
                                "type": "array"
                              },
                              "match": {
                                "additionalProperties": false,
                                "properties": {
                                  "keywords": {
                                    "default": [],
                                    "items": {
                                      "maxLength": 128,
                                      "minLength": 1,
                                      "type": "string"
                                    },
                                    "maxItems": 200,
                                    "type": "array"
                                  },
                                  "kinds": {
                                    "default": [],
                                    "items": {
                                      "maxLength": 128,
                                      "minLength": 1,
                                      "type": "string"
                                    },
                                    "maxItems": 200,
                                    "type": "array"
                                  },
                                  "node_ids": {
                                    "default": [],
                                    "items": {
                                      "format": "uuid",
                                      "type": "string"
                                    },
                                    "maxItems": 1000,
                                    "type": "array"
                                  },
                                  "protocols": {
                                    "default": [],
                                    "items": {
                                      "maxLength": 128,
                                      "minLength": 1,
                                      "type": "string"
                                    },
                                    "maxItems": 200,
                                    "type": "array"
                                  },
                                  "regions": {
                                    "default": [],
                                    "items": {
                                      "maxLength": 128,
                                      "minLength": 1,
                                      "type": "string"
                                    },
                                    "maxItems": 200,
                                    "type": "array"
                                  },
                                  "tags": {
                                    "default": [],
                                    "items": {
                                      "maxLength": 128,
                                      "minLength": 1,
                                      "type": "string"
                                    },
                                    "maxItems": 200,
                                    "type": "array"
                                  }
                                },
                                "type": "object"
                              }
                            },
                            "required": [
                              "match"
                            ],
                            "type": "object"
                          },
                          "maxItems": 200,
                          "type": "array"
                        },
                        "hide_high_load": {
                          "default": false,
                          "type": "boolean"
                        },
                        "hide_offline": {
                          "default": false,
                          "type": "boolean"
                        },
                        "lines": {
                          "default": [],
                          "items": {
                            "additionalProperties": false,
                            "properties": {
                              "carrier": {
                                "maxLength": 64,
                                "minLength": 1,
                                "type": "string"
                              },
                              "mode": {
                                "enum": [
                                  "only",
                                  "prefer"
                                ],
                                "type": "string"
                              },
                              "node_ids": {
                                "items": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "maxItems": 1000,
                                "type": "array"
                              },
                              "region_code": {
                                "default": null,
                                "maxLength": 64,
                                "minLength": 1,
                                "type": [
                                  "string",
                                  "null"
                                ]
                              }
                            },
                            "required": [
                              "carrier",
                              "node_ids",
                              "mode"
                            ],
                            "type": "object"
                          },
                          "maxItems": 500,
                          "type": "array"
                        },
                        "max_nodes": {
                          "default": 200,
                          "maximum": 1000,
                          "minimum": 1,
                          "type": "integer"
                        },
                        "name_template": {
                          "default": "{region_flag} {name}",
                          "maxLength": 512,
                          "minLength": 1,
                          "type": "string"
                        },
                        "show_node_load": {
                          "default": true,
                          "type": "boolean"
                        },
                        "subscription_url": {
                          "default": null,
                          "format": "uri",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "update_interval_hours": {
                          "default": 12,
                          "maximum": 168,
                          "minimum": 1,
                          "type": "integer"
                        },
                        "user_params": {
                          "default": {
                            "exclude_keyword": [
                              "*"
                            ],
                            "ip_family": [
                              "ipv4",
                              "ipv6"
                            ],
                            "isp": [
                              "*"
                            ],
                            "kind": [
                              "direct",
                              "relay",
                              "cdn"
                            ],
                            "limit": [
                              "*"
                            ],
                            "protocol": [
                              "*"
                            ],
                            "region": [
                              "*"
                            ],
                            "sort": [
                              "sort",
                              "name",
                              "region"
                            ],
                            "tag": [
                              "*"
                            ]
                          },
                          "properties": {
                            "exclude_keyword": {
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "ip_family": {
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "isp": {
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "kind": {
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "limit": {
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "protocol": {
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "region": {
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "sort": {
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            },
                            "tag": {
                              "items": {
                                "maxLength": 128,
                                "minLength": 1,
                                "type": "string"
                              },
                              "maxItems": 200,
                              "type": "array"
                            }
                          },
                          "type": "object"
                        }
                      },
                      "type": "object"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "rules",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Save distribution rules with If-Match",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.filters.update",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-idempotency": "optional",
        "x-permission": "distribution.filter.manage"
      }
    },
    "/api/v1/admin/distribution/leak-settings": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "settings": {
                      "additionalProperties": false,
                      "properties": {
                        "auto_rotate": {
                          "default": false,
                          "type": "boolean"
                        },
                        "enabled": {
                          "default": false,
                          "type": "boolean"
                        },
                        "max_asns": {
                          "default": 10,
                          "maximum": 10000,
                          "minimum": 1,
                          "type": "integer"
                        },
                        "max_countries": {
                          "default": 5,
                          "maximum": 250,
                          "minimum": 1,
                          "type": "integer"
                        },
                        "max_fingerprints": {
                          "default": 10,
                          "maximum": 10000,
                          "minimum": 1,
                          "type": "integer"
                        },
                        "max_ips": {
                          "default": 20,
                          "maximum": 100000,
                          "minimum": 1,
                          "type": "integer"
                        },
                        "window_seconds": {
                          "default": 3600,
                          "maximum": 86400,
                          "minimum": 3600,
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "settings",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Read link leak thresholds",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.template_policy.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "distribution.filter.manage",
        "x-reauth": false
      },
      "put": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "auto_rotate": {
                    "default": false,
                    "type": "boolean"
                  },
                  "enabled": {
                    "default": false,
                    "type": "boolean"
                  },
                  "max_asns": {
                    "default": 10,
                    "maximum": 10000,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "max_countries": {
                    "default": 5,
                    "maximum": 250,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "max_fingerprints": {
                    "default": 10,
                    "maximum": 10000,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "max_ips": {
                    "default": 20,
                    "maximum": 100000,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "window_seconds": {
                    "default": 3600,
                    "maximum": 86400,
                    "minimum": 3600,
                    "type": "integer"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "settings": {
                      "additionalProperties": false,
                      "properties": {
                        "auto_rotate": {
                          "default": false,
                          "type": "boolean"
                        },
                        "enabled": {
                          "default": false,
                          "type": "boolean"
                        },
                        "max_asns": {
                          "default": 10,
                          "maximum": 10000,
                          "minimum": 1,
                          "type": "integer"
                        },
                        "max_countries": {
                          "default": 5,
                          "maximum": 250,
                          "minimum": 1,
                          "type": "integer"
                        },
                        "max_fingerprints": {
                          "default": 10,
                          "maximum": 10000,
                          "minimum": 1,
                          "type": "integer"
                        },
                        "max_ips": {
                          "default": 20,
                          "maximum": 100000,
                          "minimum": 1,
                          "type": "integer"
                        },
                        "window_seconds": {
                          "default": 3600,
                          "maximum": 86400,
                          "minimum": 3600,
                          "type": "integer"
                        }
                      },
                      "type": "object"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "settings",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Configure opt-in link leak detection",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.leak_settings.update",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-idempotency": "optional",
        "x-permission": "distribution.filter.manage",
        "x-reauth": false
      }
    },
    "/api/v1/admin/distribution/leak-signals/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "asns": {
                      "type": "integer"
                    },
                    "countries": {
                      "type": "integer"
                    },
                    "exceeded": {
                      "items": {
                        "enum": [
                          "ips",
                          "asns",
                          "countries",
                          "fingerprints"
                        ],
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "fingerprints": {
                      "type": "integer"
                    },
                    "ips": {
                      "type": "integer"
                    },
                    "requests": {
                      "type": "integer"
                    },
                    "subscription_id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "subscription_id",
                    "ips",
                    "asns",
                    "countries",
                    "fingerprints",
                    "requests",
                    "exceeded"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Aggregate existing access-log signals for the current link",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.template_policy.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "distribution.log.read",
        "x-reauth": false
      }
    },
    "/api/v1/admin/distribution/template-policy": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "policy": {
                      "additionalProperties": false,
                      "properties": {
                        "canaries": {
                          "default": [],
                          "items": {
                            "additionalProperties": false,
                            "properties": {
                              "client": {
                                "enum": [
                                  "mihomo",
                                  "sing_box@1.11",
                                  "sing_box@1.12",
                                  "sing_box@1.13",
                                  "uri_base64",
                                  "hiddify",
                                  "stash",
                                  "surge",
                                  "quantumult_x",
                                  "loon",
                                  "surfboard",
                                  "shadowrocket"
                                ],
                                "type": "string"
                              },
                              "percentage_bps": {
                                "maximum": 10000,
                                "minimum": 0,
                                "type": "integer"
                              },
                              "subscription_ids": {
                                "default": [],
                                "items": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "maxItems": 1000,
                                "type": "array"
                              },
                              "template_id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "user_ids": {
                                "default": [],
                                "items": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "maxItems": 1000,
                                "type": "array"
                              }
                            },
                            "required": [
                              "client",
                              "template_id",
                              "percentage_bps"
                            ],
                            "type": "object"
                          },
                          "maxItems": 50,
                          "type": "array"
                        },
                        "rules": {
                          "default": [],
                          "items": {
                            "additionalProperties": false,
                            "properties": {
                              "client": {
                                "enum": [
                                  "mihomo",
                                  "sing_box@1.11",
                                  "sing_box@1.12",
                                  "sing_box@1.13",
                                  "uri_base64",
                                  "hiddify",
                                  "stash",
                                  "surge",
                                  "quantumult_x",
                                  "loon",
                                  "surfboard",
                                  "shadowrocket"
                                ],
                                "type": "string"
                              },
                              "id": {
                                "pattern": "^[a-z0-9_-]{1,64}$",
                                "type": "string"
                              },
                              "max_version": {
                                "pattern": "^\\d{1,6}\\.\\d{1,6}(?:\\.\\d{1,6})?$",
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "min_version": {
                                "pattern": "^\\d{1,6}\\.\\d{1,6}(?:\\.\\d{1,6})?$",
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "template_id": {
                                "format": "uuid",
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "client",
                              "min_version",
                              "max_version",
                              "template_id"
                            ],
                            "type": "object"
                          },
                          "maxItems": 200,
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "policy",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Read ordered version rules and canary targets",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.template_policy.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "distribution.template.manage",
        "x-reauth": false
      },
      "put": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "canaries": {
                    "default": [],
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "client": {
                          "enum": [
                            "mihomo",
                            "sing_box@1.11",
                            "sing_box@1.12",
                            "sing_box@1.13",
                            "uri_base64",
                            "hiddify",
                            "stash",
                            "surge",
                            "quantumult_x",
                            "loon",
                            "surfboard",
                            "shadowrocket"
                          ],
                          "type": "string"
                        },
                        "percentage_bps": {
                          "maximum": 10000,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "subscription_ids": {
                          "default": [],
                          "items": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "maxItems": 1000,
                          "type": "array"
                        },
                        "template_id": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "user_ids": {
                          "default": [],
                          "items": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "maxItems": 1000,
                          "type": "array"
                        }
                      },
                      "required": [
                        "client",
                        "template_id",
                        "percentage_bps"
                      ],
                      "type": "object"
                    },
                    "maxItems": 50,
                    "type": "array"
                  },
                  "rules": {
                    "default": [],
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "client": {
                          "enum": [
                            "mihomo",
                            "sing_box@1.11",
                            "sing_box@1.12",
                            "sing_box@1.13",
                            "uri_base64",
                            "hiddify",
                            "stash",
                            "surge",
                            "quantumult_x",
                            "loon",
                            "surfboard",
                            "shadowrocket"
                          ],
                          "type": "string"
                        },
                        "id": {
                          "pattern": "^[a-z0-9_-]{1,64}$",
                          "type": "string"
                        },
                        "max_version": {
                          "pattern": "^\\d{1,6}\\.\\d{1,6}(?:\\.\\d{1,6})?$",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "min_version": {
                          "pattern": "^\\d{1,6}\\.\\d{1,6}(?:\\.\\d{1,6})?$",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "template_id": {
                          "format": "uuid",
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "client",
                        "min_version",
                        "max_version",
                        "template_id"
                      ],
                      "type": "object"
                    },
                    "maxItems": 200,
                    "type": "array"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "policy": {
                      "additionalProperties": false,
                      "properties": {
                        "canaries": {
                          "default": [],
                          "items": {
                            "additionalProperties": false,
                            "properties": {
                              "client": {
                                "enum": [
                                  "mihomo",
                                  "sing_box@1.11",
                                  "sing_box@1.12",
                                  "sing_box@1.13",
                                  "uri_base64",
                                  "hiddify",
                                  "stash",
                                  "surge",
                                  "quantumult_x",
                                  "loon",
                                  "surfboard",
                                  "shadowrocket"
                                ],
                                "type": "string"
                              },
                              "percentage_bps": {
                                "maximum": 10000,
                                "minimum": 0,
                                "type": "integer"
                              },
                              "subscription_ids": {
                                "default": [],
                                "items": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "maxItems": 1000,
                                "type": "array"
                              },
                              "template_id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "user_ids": {
                                "default": [],
                                "items": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "maxItems": 1000,
                                "type": "array"
                              }
                            },
                            "required": [
                              "client",
                              "template_id",
                              "percentage_bps"
                            ],
                            "type": "object"
                          },
                          "maxItems": 50,
                          "type": "array"
                        },
                        "rules": {
                          "default": [],
                          "items": {
                            "additionalProperties": false,
                            "properties": {
                              "client": {
                                "enum": [
                                  "mihomo",
                                  "sing_box@1.11",
                                  "sing_box@1.12",
                                  "sing_box@1.13",
                                  "uri_base64",
                                  "hiddify",
                                  "stash",
                                  "surge",
                                  "quantumult_x",
                                  "loon",
                                  "surfboard",
                                  "shadowrocket"
                                ],
                                "type": "string"
                              },
                              "id": {
                                "pattern": "^[a-z0-9_-]{1,64}$",
                                "type": "string"
                              },
                              "max_version": {
                                "pattern": "^\\d{1,6}\\.\\d{1,6}(?:\\.\\d{1,6})?$",
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "min_version": {
                                "pattern": "^\\d{1,6}\\.\\d{1,6}(?:\\.\\d{1,6})?$",
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "template_id": {
                                "format": "uuid",
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "client",
                              "min_version",
                              "max_version",
                              "template_id"
                            ],
                            "type": "object"
                          },
                          "maxItems": 200,
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "policy",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Validate revisions and save version rules and canaries with If-Match",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.template_policy.update",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-idempotency": "optional",
        "x-permission": "distribution.template.manage",
        "x-reauth": false
      }
    },
    "/api/v1/admin/distribution/templates": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "client",
            "required": false,
            "schema": {
              "enum": [
                "mihomo",
                "sing_box@1.11",
                "sing_box@1.12",
                "sing_box@1.13",
                "uri_base64",
                "hiddify",
                "stash",
                "surge",
                "quantumult_x",
                "loon",
                "surfboard",
                "shadowrocket"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "pattern": "^[a-z0-9_.@-]{1,64}~[1-9]\\d{0,9}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "checksum": {
                            "type": "string"
                          },
                          "client_key": {
                            "enum": [
                              "mihomo",
                              "sing_box@1.11",
                              "sing_box@1.12",
                              "sing_box@1.13",
                              "uri_base64",
                              "hiddify",
                              "stash",
                              "surge",
                              "quantumult_x",
                              "loon",
                              "surfboard",
                              "shadowrocket"
                            ],
                            "type": "string"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "is_builtin": {
                            "type": "boolean"
                          },
                          "notes": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "output_format": {
                            "enum": [
                              "yaml",
                              "json",
                              "conf",
                              "text",
                              "base64"
                            ],
                            "type": "string"
                          },
                          "published_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "enum": [
                              "draft",
                              "published",
                              "archived"
                            ],
                            "type": "string"
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "id",
                          "client_key",
                          "version",
                          "output_format",
                          "status",
                          "is_builtin",
                          "checksum",
                          "notes",
                          "published_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "has_more",
                    "next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Template versions and drafts",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.templates.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "distribution.template.manage"
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "body": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "client_key": {
                    "enum": [
                      "mihomo",
                      "sing_box@1.11",
                      "sing_box@1.12",
                      "sing_box@1.13",
                      "uri_base64",
                      "hiddify",
                      "stash",
                      "surge",
                      "quantumult_x",
                      "loon",
                      "surfboard",
                      "shadowrocket"
                    ],
                    "type": "string"
                  },
                  "notes": {
                    "default": null,
                    "maxLength": 2000,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "params": {
                    "additionalProperties": {},
                    "default": {},
                    "type": "object"
                  }
                },
                "required": [
                  "client_key",
                  "body"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "body": {
                      "type": "string"
                    },
                    "checksum": {
                      "type": "string"
                    },
                    "client_key": {
                      "enum": [
                        "mihomo",
                        "sing_box@1.11",
                        "sing_box@1.12",
                        "sing_box@1.13",
                        "uri_base64",
                        "hiddify",
                        "stash",
                        "surge",
                        "quantumult_x",
                        "loon",
                        "surfboard",
                        "shadowrocket"
                      ],
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "is_builtin": {
                      "type": "boolean"
                    },
                    "notes": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "output_format": {
                      "enum": [
                        "yaml",
                        "json",
                        "conf",
                        "text",
                        "base64"
                      ],
                      "type": "string"
                    },
                    "params": {
                      "additionalProperties": {},
                      "type": "object"
                    },
                    "published_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "enum": [
                        "draft",
                        "published",
                        "archived"
                      ],
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "client_key",
                    "version",
                    "output_format",
                    "body",
                    "params",
                    "status",
                    "is_builtin",
                    "checksum",
                    "notes",
                    "published_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Create a template draft",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.templates.update",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-idempotency": "optional",
        "x-permission": "distribution.template.manage"
      }
    },
    "/api/v1/admin/distribution/templates/builtins": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "body": {
                            "type": "string"
                          },
                          "client_key": {
                            "enum": [
                              "mihomo",
                              "sing_box@1.11",
                              "sing_box@1.12",
                              "sing_box@1.13",
                              "uri_base64",
                              "hiddify",
                              "stash",
                              "surge",
                              "quantumult_x",
                              "loon",
                              "surfboard",
                              "shadowrocket"
                            ],
                            "type": "string"
                          },
                          "format": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "client_key",
                          "body",
                          "format"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Built-in template sources, available before database seeding",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.templates.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "distribution.template.manage"
      }
    },
    "/api/v1/admin/distribution/templates/{clientKey}/rollback": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "clientKey",
            "required": true,
            "schema": {
              "enum": [
                "mihomo",
                "sing_box@1.11",
                "sing_box@1.12",
                "sing_box@1.13",
                "uri_base64",
                "hiddify",
                "stash",
                "surge",
                "quantumult_x",
                "loon",
                "surfboard",
                "shadowrocket"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "body": {
                      "type": "string"
                    },
                    "checksum": {
                      "type": "string"
                    },
                    "client_key": {
                      "enum": [
                        "mihomo",
                        "sing_box@1.11",
                        "sing_box@1.12",
                        "sing_box@1.13",
                        "uri_base64",
                        "hiddify",
                        "stash",
                        "surge",
                        "quantumult_x",
                        "loon",
                        "surfboard",
                        "shadowrocket"
                      ],
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "is_builtin": {
                      "type": "boolean"
                    },
                    "notes": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "output_format": {
                      "enum": [
                        "yaml",
                        "json",
                        "conf",
                        "text",
                        "base64"
                      ],
                      "type": "string"
                    },
                    "params": {
                      "additionalProperties": {},
                      "type": "object"
                    },
                    "published_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "enum": [
                        "draft",
                        "published",
                        "archived"
                      ],
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "client_key",
                    "version",
                    "output_format",
                    "body",
                    "params",
                    "status",
                    "is_builtin",
                    "checksum",
                    "notes",
                    "published_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Restore the preceding published version",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.templates.rollback",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional",
        "x-permission": "distribution.template.manage"
      }
    },
    "/api/v1/admin/distribution/templates/{clientKey}/versions": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "clientKey",
            "required": true,
            "schema": {
              "enum": [
                "mihomo",
                "sing_box@1.11",
                "sing_box@1.12",
                "sing_box@1.13",
                "uri_base64",
                "hiddify",
                "stash",
                "surge",
                "quantumult_x",
                "loon",
                "surfboard",
                "shadowrocket"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "pattern": "^[a-z0-9_.@-]{1,64}~[1-9]\\d{0,9}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "checksum": {
                            "type": "string"
                          },
                          "client_key": {
                            "enum": [
                              "mihomo",
                              "sing_box@1.11",
                              "sing_box@1.12",
                              "sing_box@1.13",
                              "uri_base64",
                              "hiddify",
                              "stash",
                              "surge",
                              "quantumult_x",
                              "loon",
                              "surfboard",
                              "shadowrocket"
                            ],
                            "type": "string"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "is_builtin": {
                            "type": "boolean"
                          },
                          "notes": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "output_format": {
                            "enum": [
                              "yaml",
                              "json",
                              "conf",
                              "text",
                              "base64"
                            ],
                            "type": "string"
                          },
                          "published_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "enum": [
                              "draft",
                              "published",
                              "archived"
                            ],
                            "type": "string"
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "id",
                          "client_key",
                          "version",
                          "output_format",
                          "status",
                          "is_builtin",
                          "checksum",
                          "notes",
                          "published_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "has_more",
                    "next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Versions of a client template",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.templates.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "distribution.template.manage"
      }
    },
    "/api/v1/admin/distribution/templates/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "body": {
                      "type": "string"
                    },
                    "checksum": {
                      "type": "string"
                    },
                    "client_key": {
                      "enum": [
                        "mihomo",
                        "sing_box@1.11",
                        "sing_box@1.12",
                        "sing_box@1.13",
                        "uri_base64",
                        "hiddify",
                        "stash",
                        "surge",
                        "quantumult_x",
                        "loon",
                        "surfboard",
                        "shadowrocket"
                      ],
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "is_builtin": {
                      "type": "boolean"
                    },
                    "notes": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "output_format": {
                      "enum": [
                        "yaml",
                        "json",
                        "conf",
                        "text",
                        "base64"
                      ],
                      "type": "string"
                    },
                    "params": {
                      "additionalProperties": {},
                      "type": "object"
                    },
                    "published_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "enum": [
                        "draft",
                        "published",
                        "archived"
                      ],
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "client_key",
                    "version",
                    "output_format",
                    "body",
                    "params",
                    "status",
                    "is_builtin",
                    "checksum",
                    "notes",
                    "published_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "A template version",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.templates.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "distribution.template.manage"
      },
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "body": {
                    "minLength": 1,
                    "type": "string"
                  },
                  "client_key": {
                    "enum": [
                      "mihomo",
                      "sing_box@1.11",
                      "sing_box@1.12",
                      "sing_box@1.13",
                      "uri_base64",
                      "hiddify",
                      "stash",
                      "surge",
                      "quantumult_x",
                      "loon",
                      "surfboard",
                      "shadowrocket"
                    ],
                    "type": "string"
                  },
                  "notes": {
                    "default": null,
                    "maxLength": 2000,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "params": {
                    "additionalProperties": {},
                    "default": {},
                    "type": "object"
                  }
                },
                "required": [
                  "client_key",
                  "body"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "body": {
                      "type": "string"
                    },
                    "checksum": {
                      "type": "string"
                    },
                    "client_key": {
                      "enum": [
                        "mihomo",
                        "sing_box@1.11",
                        "sing_box@1.12",
                        "sing_box@1.13",
                        "uri_base64",
                        "hiddify",
                        "stash",
                        "surge",
                        "quantumult_x",
                        "loon",
                        "surfboard",
                        "shadowrocket"
                      ],
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "is_builtin": {
                      "type": "boolean"
                    },
                    "notes": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "output_format": {
                      "enum": [
                        "yaml",
                        "json",
                        "conf",
                        "text",
                        "base64"
                      ],
                      "type": "string"
                    },
                    "params": {
                      "additionalProperties": {},
                      "type": "object"
                    },
                    "published_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "enum": [
                        "draft",
                        "published",
                        "archived"
                      ],
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "client_key",
                    "version",
                    "output_format",
                    "body",
                    "params",
                    "status",
                    "is_builtin",
                    "checksum",
                    "notes",
                    "published_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Replace a draft with a new immutable revision",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.templates.update",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-idempotency": "optional",
        "x-permission": "distribution.template.manage"
      }
    },
    "/api/v1/admin/distribution/templates/{id}/preview": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "conditions": {
                    "default": {},
                    "properties": {
                      "client": {
                        "maxLength": 64,
                        "type": "string"
                      },
                      "exclude_keyword": {
                        "maxLength": 2048,
                        "type": "string"
                      },
                      "ip_family": {
                        "maxLength": 2048,
                        "type": "string"
                      },
                      "isp": {
                        "maxLength": 2048,
                        "type": "string"
                      },
                      "kind": {
                        "maxLength": 2048,
                        "type": "string"
                      },
                      "limit": {
                        "maxLength": 128,
                        "type": "string"
                      },
                      "protocol": {
                        "maxLength": 2048,
                        "type": "string"
                      },
                      "region": {
                        "maxLength": 2048,
                        "type": "string"
                      },
                      "sort": {
                        "maxLength": 128,
                        "type": "string"
                      },
                      "tag": {
                        "maxLength": 2048,
                        "type": "string"
                      },
                      "ver": {
                        "maxLength": 32,
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "subscription_id": {
                    "format": "uuid",
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "format": {
                      "type": "string"
                    },
                    "output": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "output",
                    "format"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Render a draft with sample or selected subscription data",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.templates.preview",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-idempotency": "none",
        "x-permission": "distribution.template.manage"
      }
    },
    "/api/v1/admin/distribution/templates/{id}/publish": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "body": {
                      "type": "string"
                    },
                    "checksum": {
                      "type": "string"
                    },
                    "client_key": {
                      "enum": [
                        "mihomo",
                        "sing_box@1.11",
                        "sing_box@1.12",
                        "sing_box@1.13",
                        "uri_base64",
                        "hiddify",
                        "stash",
                        "surge",
                        "quantumult_x",
                        "loon",
                        "surfboard",
                        "shadowrocket"
                      ],
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "is_builtin": {
                      "type": "boolean"
                    },
                    "notes": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "output_format": {
                      "enum": [
                        "yaml",
                        "json",
                        "conf",
                        "text",
                        "base64"
                      ],
                      "type": "string"
                    },
                    "params": {
                      "additionalProperties": {},
                      "type": "object"
                    },
                    "published_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "enum": [
                        "draft",
                        "published",
                        "archived"
                      ],
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "client_key",
                    "version",
                    "output_format",
                    "body",
                    "params",
                    "status",
                    "is_builtin",
                    "checksum",
                    "notes",
                    "published_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Validate samples and atomically publish a draft",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.templates.publish",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional",
        "x-permission": "distribution.template.manage"
      }
    },
    "/api/v1/admin/distribution/user-routing-policy": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "policy": {
                      "additionalProperties": false,
                      "properties": {
                        "allowed_types": {
                          "default": [
                            "domain",
                            "domain-suffix",
                            "domain-keyword",
                            "IP-CIDR",
                            "GEOIP",
                            "GEOSITE",
                            "process-name"
                          ],
                          "items": {
                            "enum": [
                              "domain",
                              "domain-suffix",
                              "domain-keyword",
                              "IP-CIDR",
                              "GEOIP",
                              "GEOSITE",
                              "process-name"
                            ],
                            "type": "string"
                          },
                          "maxItems": 7,
                          "type": "array"
                        },
                        "denied_targets": {
                          "default": [],
                          "items": {
                            "maxLength": 200,
                            "minLength": 1,
                            "pattern": "^[^,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                            "type": "string"
                          },
                          "maxItems": 200,
                          "type": "array"
                        },
                        "enabled": {
                          "default": true,
                          "type": "boolean"
                        },
                        "max_count": {
                          "default": 200,
                          "maximum": 200,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "protected_domains": {
                          "default": [],
                          "items": {
                            "maxLength": 253,
                            "pattern": "^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i",
                            "type": "string"
                          },
                          "maxItems": 100,
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "policy",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Read user routing controls",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.user_routing.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "distribution.filter.manage",
        "x-rate-limit": "distribution.user_routing.user",
        "x-reauth": false
      },
      "put": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "allowed_types": {
                    "default": [
                      "domain",
                      "domain-suffix",
                      "domain-keyword",
                      "IP-CIDR",
                      "GEOIP",
                      "GEOSITE",
                      "process-name"
                    ],
                    "items": {
                      "enum": [
                        "domain",
                        "domain-suffix",
                        "domain-keyword",
                        "IP-CIDR",
                        "GEOIP",
                        "GEOSITE",
                        "process-name"
                      ],
                      "type": "string"
                    },
                    "maxItems": 7,
                    "type": "array"
                  },
                  "denied_targets": {
                    "default": [],
                    "items": {
                      "maxLength": 200,
                      "minLength": 1,
                      "pattern": "^[^,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                      "type": "string"
                    },
                    "maxItems": 200,
                    "type": "array"
                  },
                  "enabled": {
                    "default": true,
                    "type": "boolean"
                  },
                  "max_count": {
                    "default": 200,
                    "maximum": 200,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "protected_domains": {
                    "default": [],
                    "items": {
                      "maxLength": 253,
                      "pattern": "^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i",
                      "type": "string"
                    },
                    "maxItems": 100,
                    "type": "array"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "policy": {
                      "additionalProperties": false,
                      "properties": {
                        "allowed_types": {
                          "default": [
                            "domain",
                            "domain-suffix",
                            "domain-keyword",
                            "IP-CIDR",
                            "GEOIP",
                            "GEOSITE",
                            "process-name"
                          ],
                          "items": {
                            "enum": [
                              "domain",
                              "domain-suffix",
                              "domain-keyword",
                              "IP-CIDR",
                              "GEOIP",
                              "GEOSITE",
                              "process-name"
                            ],
                            "type": "string"
                          },
                          "maxItems": 7,
                          "type": "array"
                        },
                        "denied_targets": {
                          "default": [],
                          "items": {
                            "maxLength": 200,
                            "minLength": 1,
                            "pattern": "^[^,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                            "type": "string"
                          },
                          "maxItems": 200,
                          "type": "array"
                        },
                        "enabled": {
                          "default": true,
                          "type": "boolean"
                        },
                        "max_count": {
                          "default": 200,
                          "maximum": 200,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "protected_domains": {
                          "default": [],
                          "items": {
                            "maxLength": 253,
                            "pattern": "^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i",
                            "type": "string"
                          },
                          "maxItems": 100,
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "policy",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Set allowed rule types, count and denied targets",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.user_routing.update",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-idempotency": "optional",
        "x-permission": "distribution.filter.manage",
        "x-rate-limit": "distribution.user_routing.user",
        "x-reauth": false
      }
    },
    "/api/v1/admin/enterprise-prices/{id}": {
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "member_limit": {
                    "maximum": 500,
                    "minimum": 2,
                    "type": "integer"
                  }
                },
                "required": [
                  "member_limit"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "saved": {
                      "enum": [
                        true
                      ],
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "saved"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Enterprise designation saved"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Team role does not permit this action"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Team or member not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Subscription, membership or allocation conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Mark a price option enterprise and configure its member limit",
        "tags": [
          "teams"
        ],
        "x-audit": "subscription.team.manage",
        "x-body": "json",
        "x-body-limit": 4096,
        "x-idempotency": "required",
        "x-permission": "catalog.price.manage",
        "x-rate-limit": "subscription.teams.user",
        "x-reauth": true
      }
    },
    "/api/v1/admin/exceptions": {
      "get": {
        "parameters": [
          {
            "description": "Status; repeat the parameter for several values",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "open",
                    "acknowledged",
                    "muted",
                    "resolved"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "open",
                      "acknowledged",
                      "muted",
                      "resolved"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Status; repeat the parameter for several values"
            }
          },
          {
            "description": "Severity; repeat the parameter for several values",
            "in": "query",
            "name": "severity",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "p1",
                    "p2",
                    "p3"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "p1",
                      "p2",
                      "p3"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Severity; repeat the parameter for several values"
            }
          },
          {
            "in": "query",
            "name": "source",
            "required": false,
            "schema": {
              "maxLength": 100,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "type",
            "required": false,
            "schema": {
              "maxLength": 100,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "fingerprint",
            "required": false,
            "schema": {
              "maxLength": 500,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Return `total` (first page only)",
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "description": "Return `total` (first page only)",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpsExceptionPage"
                }
              }
            },
            "description": "A page of exceptions"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid filter or cursor"
          }
        },
        "summary": "List business exceptions (newest first)",
        "tags": [
          "ops"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "ops.exception.read"
      }
    },
    "/api/v1/admin/exceptions/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpsException"
                }
              }
            },
            "description": "The exception (ETag: its version)",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such exception"
          }
        },
        "summary": "One business exception",
        "tags": [
          "ops"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "ops.exception.read"
      }
    },
    "/api/v1/admin/exceptions/{id}/handle": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "if-match",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "action": {
                    "enum": [
                      "claim",
                      "assign",
                      "acknowledge",
                      "mute",
                      "unmute",
                      "resolve",
                      "comment"
                    ],
                    "type": "string"
                  },
                  "note": {
                    "maxLength": 2000,
                    "minLength": 1,
                    "type": "string"
                  },
                  "owner_staff_id": {
                    "format": "uuid",
                    "type": "string"
                  }
                },
                "required": [
                  "action",
                  "note"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpsException"
                }
              }
            },
            "description": "Updated exception and handling history",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unknown exception"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Stale version or resolved exception"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid owner or note"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "Claim, assign, acknowledge, mute, resolve or comment on an exception",
        "tags": [
          "ops"
        ],
        "x-audit": "ops.exception.handle",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "ops.exception.manage",
        "x-rate-limit": "ops.manage.user"
      }
    },
    "/api/v1/admin/exports": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "kind",
            "required": true,
            "schema": {
              "enum": [
                "orders",
                "payments",
                "users",
                "usage",
                "bulk_report"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "operation_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Return `total` (first page only)",
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "description": "Return `total` (first page only)",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "anyOf": [
                          {
                            "$ref": "#/components/schemas/OpsExport"
                          },
                          {
                            "$ref": "#/components/schemas/BulkReportExport"
                          }
                        ]
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Own exports"
          }
        },
        "summary": "List own exports of a permitted kind",
        "tags": [
          "ops"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": [
          "ops.export.orders",
          "ops.export.payments",
          "ops.export.users",
          "ops.export.usage",
          "ops.bulk.manage"
        ]
      },
      "post": {
        "parameters": [
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "additionalProperties": false,
                    "properties": {
                      "filters": {
                        "additionalProperties": false,
                        "properties": {
                          "created_from": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "created_to": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "user_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "kind": {
                        "enum": [
                          "orders"
                        ],
                        "type": "string"
                      },
                      "reason": {
                        "maxLength": 500,
                        "minLength": 1,
                        "type": "string"
                      },
                      "row_limit": {
                        "maximum": 10000,
                        "minimum": 1,
                        "type": "integer"
                      }
                    },
                    "required": [
                      "kind",
                      "row_limit",
                      "reason",
                      "filters"
                    ],
                    "type": "object"
                  },
                  {
                    "additionalProperties": false,
                    "properties": {
                      "filters": {
                        "additionalProperties": false,
                        "properties": {
                          "created_from": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "created_to": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "user_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "kind": {
                        "enum": [
                          "payments"
                        ],
                        "type": "string"
                      },
                      "reason": {
                        "maxLength": 500,
                        "minLength": 1,
                        "type": "string"
                      },
                      "row_limit": {
                        "maximum": 10000,
                        "minimum": 1,
                        "type": "integer"
                      }
                    },
                    "required": [
                      "kind",
                      "row_limit",
                      "reason",
                      "filters"
                    ],
                    "type": "object"
                  },
                  {
                    "additionalProperties": false,
                    "properties": {
                      "filters": {
                        "additionalProperties": false,
                        "properties": {
                          "created_from": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "created_to": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "user_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "kind": {
                        "enum": [
                          "users"
                        ],
                        "type": "string"
                      },
                      "reason": {
                        "maxLength": 500,
                        "minLength": 1,
                        "type": "string"
                      },
                      "row_limit": {
                        "maximum": 10000,
                        "minimum": 1,
                        "type": "integer"
                      }
                    },
                    "required": [
                      "kind",
                      "row_limit",
                      "reason",
                      "filters"
                    ],
                    "type": "object"
                  },
                  {
                    "additionalProperties": false,
                    "properties": {
                      "filters": {
                        "additionalProperties": false,
                        "properties": {
                          "operation_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "operation_id"
                        ],
                        "type": "object"
                      },
                      "kind": {
                        "enum": [
                          "bulk_report"
                        ],
                        "type": "string"
                      },
                      "reason": {
                        "maxLength": 500,
                        "minLength": 1,
                        "type": "string"
                      },
                      "row_limit": {
                        "maximum": 10000,
                        "minimum": 1,
                        "type": "integer"
                      }
                    },
                    "required": [
                      "kind",
                      "row_limit",
                      "reason",
                      "filters"
                    ],
                    "type": "object"
                  },
                  {
                    "additionalProperties": false,
                    "properties": {
                      "filters": {
                        "additionalProperties": false,
                        "properties": {
                          "date_from": {
                            "format": "date",
                            "type": "string"
                          },
                          "date_to": {
                            "format": "date",
                            "type": "string"
                          },
                          "server_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "subscription_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "date_from",
                          "date_to"
                        ],
                        "type": "object"
                      },
                      "kind": {
                        "enum": [
                          "usage"
                        ],
                        "type": "string"
                      },
                      "reason": {
                        "maxLength": 500,
                        "minLength": 1,
                        "type": "string"
                      },
                      "row_limit": {
                        "maximum": 10000,
                        "minimum": 1,
                        "type": "integer"
                      }
                    },
                    "required": [
                      "kind",
                      "row_limit",
                      "reason",
                      "filters"
                    ],
                    "type": "object"
                  }
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/OpsExport"
                    },
                    {
                      "$ref": "#/components/schemas/BulkReportExport"
                    }
                  ]
                }
              }
            },
            "description": "Queued export"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Export-kind permission required"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such bulk operation"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid export request"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Export quota exceeded"
          }
        },
        "summary": "Queue a private CSV export (at most 10,000 rows, expires after seven days)",
        "tags": [
          "ops"
        ],
        "x-audit": "ops.export.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": [
          "ops.export.orders",
          "ops.export.payments",
          "ops.export.users",
          "ops.export.usage",
          "ops.bulk.manage"
        ],
        "x-rate-limit": "ops.export.user",
        "x-reauth": true
      }
    },
    "/api/v1/admin/exports/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/OpsExport"
                    },
                    {
                      "$ref": "#/components/schemas/BulkReportExport"
                    }
                  ]
                }
              }
            },
            "description": "Export status"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such export"
          }
        },
        "summary": "Read own export status",
        "tags": [
          "ops"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": [
          "ops.export.orders",
          "ops.export.payments",
          "ops.export.users",
          "ops.export.usage",
          "ops.bulk.manage"
        ]
      }
    },
    "/api/v1/admin/exports/{id}/download": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "Private CSV download"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Export missing, pending, expired, or owned by another operator"
          }
        },
        "summary": "Download an unexpired private export",
        "tags": [
          "ops"
        ],
        "x-audit": "ops.export.download",
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": [
          "ops.export.orders",
          "ops.export.payments",
          "ops.export.users",
          "ops.export.usage",
          "ops.bulk.manage"
        ]
      }
    },
    "/api/v1/admin/files": {
      "get": {
        "parameters": [
          {
            "description": "Purpose; repeat the parameter for several values",
            "in": "query",
            "name": "purpose",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "site_asset",
                    "image",
                    "package",
                    "ticket_attachment",
                    "receipt",
                    "export"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "site_asset",
                      "image",
                      "package",
                      "ticket_attachment",
                      "receipt",
                      "export"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Purpose; repeat the parameter for several values"
            }
          },
          {
            "description": "Status; repeat the parameter for several values",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "uploading",
                    "verifying",
                    "ready",
                    "rejected",
                    "deleted"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "uploading",
                      "verifying",
                      "ready",
                      "rejected",
                      "deleted"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Status; repeat the parameter for several values"
            }
          },
          {
            "in": "query",
            "name": "visibility",
            "required": false,
            "schema": {
              "enum": [
                "public",
                "private"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "owner_type",
            "required": false,
            "schema": {
              "enum": [
                "user",
                "staff",
                "system"
              ],
              "type": "string"
            }
          },
          {
            "description": "File name substring or SHA-256 hex prefix",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "description": "File name substring or SHA-256 hex prefix",
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "enum": [
                "created_at",
                "size",
                "filename"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "order",
            "required": false,
            "schema": {
              "enum": [
                "asc",
                "desc"
              ],
              "type": "string"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Adds `total` (first page only)",
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "description": "Adds `total` (first page only)",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FilePage"
                }
              }
            },
            "description": "A page of files"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid filter or cursor"
          }
        },
        "summary": "List files",
        "tags": [
          "files"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "support.file.read"
      },
      "post": {
        "description": "Checks the file name, declared type and size against the purpose (413 before any storage call) and returns the part plan: send `parts/1…part_count` (each exactly `part_size` bytes but the last), then `complete`.",
        "parameters": [
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FileUploadCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/File"
                }
              }
            },
            "description": "The file in `uploading` with its part plan"
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.file_too_large"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.file_type_not_allowed or validation failed"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.storage_unavailable"
          }
        },
        "summary": "Open an upload session",
        "tags": [
          "files"
        ],
        "x-audit": "support.file.upload_create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "support.file.manage"
      }
    },
    "/api/v1/admin/files/migrate-storage": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "bucket": {
                    "enum": [
                      "public",
                      "private"
                    ],
                    "type": "string"
                  },
                  "source_revision": {
                    "exclusiveMinimum": 0,
                    "type": "integer"
                  },
                  "source_version": {
                    "exclusiveMinimum": 0,
                    "type": "integer"
                  },
                  "target_revision": {
                    "exclusiveMinimum": 0,
                    "type": "integer"
                  },
                  "target_version": {
                    "exclusiveMinimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "source_revision",
                  "source_version",
                  "target_revision",
                  "target_version",
                  "bucket"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "job_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "job_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Queued verified copy"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid revisions or active uploads"
          }
        },
        "summary": "Copy and verify objects between pinned storage revisions",
        "tags": [
          "files"
        ],
        "x-audit": "support.storage.migrate",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "system.settings.manage",
        "x-rate-limit": "support.storage_migration",
        "x-reauth": true
      }
    },
    "/api/v1/admin/files/{id}": {
      "delete": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileDetail"
                }
              }
            },
            "description": "The deleted file"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such file"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.upload_incomplete: still uploading or verifying"
          }
        },
        "summary": "Soft delete (restorable until expires_at); lists possible references",
        "tags": [
          "files"
        ],
        "x-audit": "support.file.delete",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional",
        "x-permission": "support.file.manage"
      },
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FileDetail"
                }
              }
            },
            "description": "The file"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such file"
          }
        },
        "summary": "One file with its upload state and possible references",
        "tags": [
          "files"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "support.file.read"
      }
    },
    "/api/v1/admin/files/{id}/complete": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FileUploadComplete"
              }
            }
          },
          "required": false
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/File"
                }
              }
            },
            "description": "The file (`ready` or `verifying`)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such upload"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.upload_incomplete (missing parts) or support.upload_expired"
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.file_too_large (image above 8192 × 8192)"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.file_type_mismatch / support.checksum_mismatch: rejected and deleted"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.storage_unavailable"
          }
        },
        "summary": "Complete an upload: ready (single part) or verifying (multipart, SHA-256 computed by a job)",
        "tags": [
          "files"
        ],
        "x-audit": "support.file.upload_complete",
        "x-body": "json",
        "x-body-limit": 1048576,
        "x-idempotency": "optional",
        "x-permission": "support.file.manage"
      }
    },
    "/api/v1/admin/files/{id}/content": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/gzip": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/pdf": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/vnd.android.package-archive": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/vnd.appimage": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/vnd.debian.binary-package": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/vnd.microsoft.portable-executable": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-7z-compressed": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-apple-diskimage": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-msi": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-rpm": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-xar": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/zip": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/avif": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/gif": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/jpeg": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/png": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/svg+xml": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/webp": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/x-icon": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "text/csv": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "text/plain": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "video/mp4": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "video/webm": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "The file (attachment, private files `Cache-Control: private, no-store`)"
          },
          "206": {
            "content": {
              "application/gzip": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/pdf": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/vnd.android.package-archive": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/vnd.appimage": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/vnd.debian.binary-package": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/vnd.microsoft.portable-executable": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-7z-compressed": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-apple-diskimage": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-msi": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-rpm": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-xar": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/zip": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/avif": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/gif": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/jpeg": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/png": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/svg+xml": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/webp": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/x-icon": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "text/csv": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "text/plain": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "video/mp4": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "video/webm": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "The requested range"
          },
          "304": {
            "description": "Not modified (If-None-Match)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such ready file"
          },
          "416": {
            "description": "Range not satisfiable (`Content-Range: bytes */<size>`)"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.storage_unavailable"
          }
        },
        "summary": "Download a ready file from its bucket (private files only this way)",
        "tags": [
          "files"
        ],
        "x-audit": "support.file.download",
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "support.file.read"
      }
    },
    "/api/v1/admin/files/{id}/parts/{n}": {
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "n",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/octet-stream": {
              "schema": {
                "format": "binary",
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FilePartResult"
                }
              }
            },
            "description": "The stored part"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such upload"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.upload_expired"
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Request body above the part size"
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not application/octet-stream"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Wrong part length, part number, or support.checksum_mismatch"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.storage_unavailable"
          }
        },
        "summary": "Upload one part (raw bytes; re-sending a part replaces it)",
        "tags": [
          "files"
        ],
        "x-audit": "support.file.upload_part",
        "x-body": "octet-stream",
        "x-body-limit": 16777216,
        "x-idempotency": "none",
        "x-permission": "support.file.manage"
      }
    },
    "/api/v1/admin/files/{id}/purge": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Purged; the public URL answers 404"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such file"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.storage_unavailable: the record stays and gc finishes the deletion"
          }
        },
        "summary": "Delete the object and the record now (re-authentication)",
        "tags": [
          "files"
        ],
        "x-audit": "support.file.purge",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional",
        "x-permission": "support.file.manage",
        "x-reauth": true
      }
    },
    "/api/v1/admin/files/{id}/restore": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/File"
                }
              }
            },
            "description": "The ready file"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such file, or past the restore window"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.upload_incomplete"
          }
        },
        "summary": "Restore a soft-deleted file within its window",
        "tags": [
          "files"
        ],
        "x-audit": "support.file.restore",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional",
        "x-permission": "support.file.manage"
      }
    },
    "/api/v1/admin/files/{id}/upload": {
      "delete": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Aborted"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such upload"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.upload_expired: the session is already closed"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.storage_unavailable"
          }
        },
        "summary": "Abandon an upload session",
        "tags": [
          "files"
        ],
        "x-audit": "support.file.upload_abort",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional",
        "x-permission": "support.file.manage"
      }
    },
    "/api/v1/admin/growth/checkout-links": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "before",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "claims": {
                            "additionalProperties": false,
                            "properties": {
                              "coupon": {
                                "pattern": "^[A-Z0-9][A-Z0-9_-]{3,31}$",
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "expires_at": {
                                "format": "date-time",
                                "type": "string"
                              },
                              "id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "key_id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "origins": {
                                "items": {
                                  "format": "uri",
                                  "maxLength": 2048,
                                  "type": "string"
                                },
                                "maxItems": 20,
                                "minItems": 1,
                                "type": "array"
                              },
                              "plan_id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "price_id": {
                                "format": "uuid",
                                "type": "string"
                              },
                              "return_url": {
                                "format": "uri",
                                "maxLength": 2048,
                                "type": "string"
                              },
                              "v": {
                                "enum": [
                                  1
                                ],
                                "type": "number"
                              }
                            },
                            "required": [
                              "plan_id",
                              "price_id",
                              "coupon",
                              "expires_at",
                              "origins",
                              "return_url",
                              "v",
                              "id",
                              "key_id"
                            ],
                            "type": "object"
                          },
                          "revoked_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "token": {
                            "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\.[A-Za-z0-9_-]{43}$",
                            "type": "string"
                          }
                        },
                        "required": [
                          "claims",
                          "token",
                          "revoked_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "List signed checkout links",
        "tags": [
          "checkout-links"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "growth.coupon.manage",
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "coupon": {
                    "pattern": "^[A-Z0-9][A-Z0-9_-]{3,31}$",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "expires_at": {
                    "format": "date-time",
                    "type": "string"
                  },
                  "origins": {
                    "items": {
                      "format": "uri",
                      "maxLength": 2048,
                      "type": "string"
                    },
                    "maxItems": 20,
                    "minItems": 1,
                    "type": "array"
                  },
                  "plan_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "price_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "return_url": {
                    "format": "uri",
                    "maxLength": 2048,
                    "type": "string"
                  }
                },
                "required": [
                  "plan_id",
                  "price_id",
                  "coupon",
                  "expires_at",
                  "origins",
                  "return_url"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "claims": {
                      "additionalProperties": false,
                      "properties": {
                        "coupon": {
                          "pattern": "^[A-Z0-9][A-Z0-9_-]{3,31}$",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "expires_at": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "id": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "key_id": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "origins": {
                          "items": {
                            "format": "uri",
                            "maxLength": 2048,
                            "type": "string"
                          },
                          "maxItems": 20,
                          "minItems": 1,
                          "type": "array"
                        },
                        "plan_id": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "price_id": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "return_url": {
                          "format": "uri",
                          "maxLength": 2048,
                          "type": "string"
                        },
                        "v": {
                          "enum": [
                            1
                          ],
                          "type": "number"
                        }
                      },
                      "required": [
                        "plan_id",
                        "price_id",
                        "coupon",
                        "expires_at",
                        "origins",
                        "return_url",
                        "v",
                        "id",
                        "key_id"
                      ],
                      "type": "object"
                    },
                    "revoked_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "token": {
                      "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\.[A-Za-z0-9_-]{43}$",
                      "type": "string"
                    }
                  },
                  "required": [
                    "claims",
                    "token",
                    "revoked_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid link or return URL policy"
          }
        },
        "summary": "Create a signed checkout link",
        "tags": [
          "checkout-links"
        ],
        "x-audit": "growth.checkout_link.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "growth.coupon.manage",
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/admin/growth/checkout-links/rotate-key": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "overlap_seconds": {
                    "maximum": 604800,
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "overlap_seconds"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "key_id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "key_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Rotate checkout signing key",
        "tags": [
          "checkout-links"
        ],
        "x-audit": "growth.checkout_link.rotate",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "growth.coupon.manage",
        "x-rate-limit": "commerce.checkout",
        "x-reauth": true
      }
    },
    "/api/v1/admin/growth/checkout-links/{id}/revoke": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Revoked"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such link"
          }
        },
        "summary": "Revoke a checkout link",
        "tags": [
          "checkout-links"
        ],
        "x-audit": "growth.checkout_link.revoke",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required",
        "x-permission": "growth.coupon.manage",
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/admin/growth/coupons": {
      "get": {
        "parameters": [
          {
            "description": "Distribution; repeat the parameter for several values",
            "in": "query",
            "name": "distribution",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "public",
                    "issued"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "public",
                      "issued"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Distribution; repeat the parameter for several values"
            }
          },
          {
            "description": "Status; repeat the parameter for several values",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "active",
                    "disabled"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "active",
                      "disabled"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Status; repeat the parameter for several values"
            }
          },
          {
            "description": "Name (contains) or code text (prefix)",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "description": "Name (contains) or code text (prefix)",
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Default created_at (desc); name (asc)",
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "description": "Default created_at (desc); name (asc)",
              "enum": [
                "created_at",
                "name"
              ],
              "type": "string"
            }
          },
          {
            "description": "Return `total` (first page only)",
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "description": "Return `total` (first page only)",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CouponPage"
                }
              }
            },
            "description": "A page of coupons"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid filter or cursor"
          }
        },
        "summary": "List coupons (public codes and issued coupons)",
        "tags": [
          "coupons"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": [
          "growth.coupon.manage",
          "growth.coupon.issue"
        ]
      },
      "post": {
        "parameters": [
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CouponCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Coupon"
                }
              }
            },
            "description": "The coupon, with ETag",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "growth.code_taken or an Idempotency-Key conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed (incl. growth.currency_mismatch, growth.plan_unknown field errors)"
          }
        },
        "summary": "Create a coupon",
        "tags": [
          "coupons"
        ],
        "x-audit": "growth.coupon.create",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-concurrency": {
          "etag": true
        },
        "x-idempotency": "required",
        "x-permission": "growth.coupon.manage"
      }
    },
    "/api/v1/admin/growth/coupons/{id}": {
      "delete": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such coupon"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict or growth.coupon_in_use (disable it instead)"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Delete a coupon nothing was issued from or used (If-Match)",
        "tags": [
          "coupons"
        ],
        "x-audit": "growth.coupon.delete",
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "growth.coupon.manage"
      },
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CouponDetail"
                }
              }
            },
            "description": "The coupon, with ETag",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such coupon"
          }
        },
        "summary": "One coupon with its usage",
        "tags": [
          "coupons"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": [
          "growth.coupon.manage",
          "growth.coupon.issue"
        ]
      },
      "patch": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CouponPatch"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Coupon"
                }
              }
            },
            "description": "The coupon, with ETag",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such coupon"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current) or growth.code_taken"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Update a coupon (If-Match); status `disabled` disables it. Coupons already issued keep their terms",
        "tags": [
          "coupons"
        ],
        "x-audit": "growth.coupon.update",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "growth.coupon.manage"
      }
    },
    "/api/v1/admin/growth/coupons/{id}/issue": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CouponIssue"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CouponIssueResult"
                }
              }
            },
            "description": "One result per user (growth.code_invalid, code_expired, code_exhausted, code_user_limit, common.not_found)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such coupon"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Idempotency-Key conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          }
        },
        "summary": "Issue the coupon to users (≤ 100; larger audiences use a bulk operation)",
        "tags": [
          "coupons"
        ],
        "x-audit": "growth.coupon.issue",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "growth.coupon.issue"
      }
    },
    "/api/v1/admin/growth/invite-codes": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "channel",
            "required": false,
            "schema": {
              "maxLength": 64,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "promoter_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "channel": {
                            "default": null,
                            "maxLength": 64,
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "code": {
                            "pattern": "^[A-Z0-9_-]{3,64}$",
                            "type": "string"
                          },
                          "effect": {
                            "additionalProperties": false,
                            "default": {
                              "invitee_rewards": [],
                              "landing": "/"
                            },
                            "properties": {
                              "invitee_rewards": {
                                "default": [],
                                "items": {
                                  "oneOf": [
                                    {
                                      "additionalProperties": false,
                                      "properties": {
                                        "amount_minor": {
                                          "pattern": "^\\d{1,18}$",
                                          "type": "string"
                                        },
                                        "kind": {
                                          "enum": [
                                            "gift_credit"
                                          ],
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "amount_minor"
                                      ],
                                      "type": "object"
                                    },
                                    {
                                      "additionalProperties": false,
                                      "properties": {
                                        "code_id": {
                                          "format": "uuid",
                                          "type": "string"
                                        },
                                        "kind": {
                                          "enum": [
                                            "coupon"
                                          ],
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "code_id"
                                      ],
                                      "type": "object"
                                    },
                                    {
                                      "additionalProperties": false,
                                      "properties": {
                                        "kind": {
                                          "enum": [
                                            "traffic_bonus"
                                          ],
                                          "type": "string"
                                        },
                                        "traffic_bytes": {
                                          "pattern": "^\\d{1,18}$",
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "traffic_bytes"
                                      ],
                                      "type": "object"
                                    },
                                    {
                                      "additionalProperties": false,
                                      "properties": {
                                        "kind": {
                                          "enum": [
                                            "term_extend"
                                          ],
                                          "type": "string"
                                        },
                                        "period_count": {
                                          "exclusiveMinimum": 0,
                                          "maximum": 3650,
                                          "type": "integer"
                                        },
                                        "period_unit": {
                                          "enum": [
                                            "hour",
                                            "day",
                                            "month",
                                            "year"
                                          ],
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "period_unit",
                                        "period_count"
                                      ],
                                      "type": "object"
                                    },
                                    {
                                      "additionalProperties": false,
                                      "properties": {
                                        "kind": {
                                          "enum": [
                                            "trial"
                                          ],
                                          "type": "string"
                                        },
                                        "period_count": {
                                          "exclusiveMinimum": 0,
                                          "maximum": 3650,
                                          "type": "integer"
                                        },
                                        "period_unit": {
                                          "enum": [
                                            "hour",
                                            "day",
                                            "month",
                                            "year"
                                          ],
                                          "type": "string"
                                        },
                                        "plan_id": {
                                          "format": "uuid",
                                          "type": "string"
                                        }
                                      },
                                      "required": [
                                        "kind",
                                        "plan_id",
                                        "period_unit",
                                        "period_count"
                                      ],
                                      "type": "object"
                                    }
                                  ]
                                },
                                "maxItems": 20,
                                "type": "array"
                              },
                              "landing": {
                                "default": "/",
                                "pattern": "^(?:\\/|\\/pricing|\\/docs(?:\\/[a-zA-Z0-9_-]+)*|\\/app\\/(?:en-US\\/)?checkout\\?kind=purchase&plan=[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}&price=[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})$",
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "ends_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "max_redemptions": {
                            "default": null,
                            "exclusiveMinimum": 0,
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "name": {
                            "maxLength": 64,
                            "minLength": 1,
                            "type": "string"
                          },
                          "promoter_user_id": {
                            "default": null,
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "redeemed_count": {
                            "type": "integer"
                          },
                          "starts_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "default": "active",
                            "enum": [
                              "active",
                              "disabled"
                            ],
                            "type": "string"
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "name",
                          "code",
                          "starts_at",
                          "ends_at",
                          "id",
                          "redeemed_count",
                          "version"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "List universal invite codes",
        "tags": [
          "referral"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "growth.invite_code.manage"
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "channel": {
                    "default": null,
                    "maxLength": 64,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "code": {
                    "pattern": "^[A-Z0-9_-]{3,64}$",
                    "type": "string"
                  },
                  "effect": {
                    "additionalProperties": false,
                    "default": {
                      "invitee_rewards": [],
                      "landing": "/"
                    },
                    "properties": {
                      "invitee_rewards": {
                        "default": [],
                        "items": {
                          "oneOf": [
                            {
                              "additionalProperties": false,
                              "properties": {
                                "amount_minor": {
                                  "pattern": "^\\d{1,18}$",
                                  "type": "string"
                                },
                                "kind": {
                                  "enum": [
                                    "gift_credit"
                                  ],
                                  "type": "string"
                                }
                              },
                              "required": [
                                "kind",
                                "amount_minor"
                              ],
                              "type": "object"
                            },
                            {
                              "additionalProperties": false,
                              "properties": {
                                "code_id": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "kind": {
                                  "enum": [
                                    "coupon"
                                  ],
                                  "type": "string"
                                }
                              },
                              "required": [
                                "kind",
                                "code_id"
                              ],
                              "type": "object"
                            },
                            {
                              "additionalProperties": false,
                              "properties": {
                                "kind": {
                                  "enum": [
                                    "traffic_bonus"
                                  ],
                                  "type": "string"
                                },
                                "traffic_bytes": {
                                  "pattern": "^\\d{1,18}$",
                                  "type": "string"
                                }
                              },
                              "required": [
                                "kind",
                                "traffic_bytes"
                              ],
                              "type": "object"
                            },
                            {
                              "additionalProperties": false,
                              "properties": {
                                "kind": {
                                  "enum": [
                                    "term_extend"
                                  ],
                                  "type": "string"
                                },
                                "period_count": {
                                  "exclusiveMinimum": 0,
                                  "maximum": 3650,
                                  "type": "integer"
                                },
                                "period_unit": {
                                  "enum": [
                                    "hour",
                                    "day",
                                    "month",
                                    "year"
                                  ],
                                  "type": "string"
                                }
                              },
                              "required": [
                                "kind",
                                "period_unit",
                                "period_count"
                              ],
                              "type": "object"
                            },
                            {
                              "additionalProperties": false,
                              "properties": {
                                "kind": {
                                  "enum": [
                                    "trial"
                                  ],
                                  "type": "string"
                                },
                                "period_count": {
                                  "exclusiveMinimum": 0,
                                  "maximum": 3650,
                                  "type": "integer"
                                },
                                "period_unit": {
                                  "enum": [
                                    "hour",
                                    "day",
                                    "month",
                                    "year"
                                  ],
                                  "type": "string"
                                },
                                "plan_id": {
                                  "format": "uuid",
                                  "type": "string"
                                }
                              },
                              "required": [
                                "kind",
                                "plan_id",
                                "period_unit",
                                "period_count"
                              ],
                              "type": "object"
                            }
                          ]
                        },
                        "maxItems": 20,
                        "type": "array"
                      },
                      "landing": {
                        "default": "/",
                        "pattern": "^(?:\\/|\\/pricing|\\/docs(?:\\/[a-zA-Z0-9_-]+)*|\\/app\\/(?:en-US\\/)?checkout\\?kind=purchase&plan=[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}&price=[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})$",
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "ends_at": {
                    "default": null,
                    "format": "date-time",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "max_redemptions": {
                    "default": null,
                    "exclusiveMinimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "name": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "promoter_user_id": {
                    "default": null,
                    "format": "uuid",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "starts_at": {
                    "default": null,
                    "format": "date-time",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "status": {
                    "default": "active",
                    "enum": [
                      "active",
                      "disabled"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "code"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "channel": {
                      "default": null,
                      "maxLength": 64,
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "code": {
                      "pattern": "^[A-Z0-9_-]{3,64}$",
                      "type": "string"
                    },
                    "effect": {
                      "additionalProperties": false,
                      "default": {
                        "invitee_rewards": [],
                        "landing": "/"
                      },
                      "properties": {
                        "invitee_rewards": {
                          "default": [],
                          "items": {
                            "oneOf": [
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "amount_minor": {
                                    "pattern": "^\\d{1,18}$",
                                    "type": "string"
                                  },
                                  "kind": {
                                    "enum": [
                                      "gift_credit"
                                    ],
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "amount_minor"
                                ],
                                "type": "object"
                              },
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "code_id": {
                                    "format": "uuid",
                                    "type": "string"
                                  },
                                  "kind": {
                                    "enum": [
                                      "coupon"
                                    ],
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "code_id"
                                ],
                                "type": "object"
                              },
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "kind": {
                                    "enum": [
                                      "traffic_bonus"
                                    ],
                                    "type": "string"
                                  },
                                  "traffic_bytes": {
                                    "pattern": "^\\d{1,18}$",
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "traffic_bytes"
                                ],
                                "type": "object"
                              },
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "kind": {
                                    "enum": [
                                      "term_extend"
                                    ],
                                    "type": "string"
                                  },
                                  "period_count": {
                                    "exclusiveMinimum": 0,
                                    "maximum": 3650,
                                    "type": "integer"
                                  },
                                  "period_unit": {
                                    "enum": [
                                      "hour",
                                      "day",
                                      "month",
                                      "year"
                                    ],
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "period_unit",
                                  "period_count"
                                ],
                                "type": "object"
                              },
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "kind": {
                                    "enum": [
                                      "trial"
                                    ],
                                    "type": "string"
                                  },
                                  "period_count": {
                                    "exclusiveMinimum": 0,
                                    "maximum": 3650,
                                    "type": "integer"
                                  },
                                  "period_unit": {
                                    "enum": [
                                      "hour",
                                      "day",
                                      "month",
                                      "year"
                                    ],
                                    "type": "string"
                                  },
                                  "plan_id": {
                                    "format": "uuid",
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "plan_id",
                                  "period_unit",
                                  "period_count"
                                ],
                                "type": "object"
                              }
                            ]
                          },
                          "maxItems": 20,
                          "type": "array"
                        },
                        "landing": {
                          "default": "/",
                          "pattern": "^(?:\\/|\\/pricing|\\/docs(?:\\/[a-zA-Z0-9_-]+)*|\\/app\\/(?:en-US\\/)?checkout\\?kind=purchase&plan=[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}&price=[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})$",
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "ends_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "max_redemptions": {
                      "default": null,
                      "exclusiveMinimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "name": {
                      "maxLength": 64,
                      "minLength": 1,
                      "type": "string"
                    },
                    "promoter_user_id": {
                      "default": null,
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "redeemed_count": {
                      "type": "integer"
                    },
                    "starts_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "default": "active",
                      "enum": [
                        "active",
                        "disabled"
                      ],
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "name",
                    "code",
                    "starts_at",
                    "ends_at",
                    "id",
                    "redeemed_count",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Resource not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "State or version conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Create a universal invite code",
        "tags": [
          "referral"
        ],
        "x-audit": "growth.invite_code.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true
        },
        "x-idempotency": "required",
        "x-permission": "growth.invite_code.manage",
        "x-reauth": false
      }
    },
    "/api/v1/admin/growth/invite-codes/{id}": {
      "delete": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Resource not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "State or version conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Delete an unused invite code",
        "tags": [
          "referral"
        ],
        "x-audit": "growth.invite_code.delete",
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "growth.invite_code.manage",
        "x-reauth": false
      },
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "channel": {
                      "default": null,
                      "maxLength": 64,
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "code": {
                      "pattern": "^[A-Z0-9_-]{3,64}$",
                      "type": "string"
                    },
                    "effect": {
                      "additionalProperties": false,
                      "default": {
                        "invitee_rewards": [],
                        "landing": "/"
                      },
                      "properties": {
                        "invitee_rewards": {
                          "default": [],
                          "items": {
                            "oneOf": [
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "amount_minor": {
                                    "pattern": "^\\d{1,18}$",
                                    "type": "string"
                                  },
                                  "kind": {
                                    "enum": [
                                      "gift_credit"
                                    ],
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "amount_minor"
                                ],
                                "type": "object"
                              },
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "code_id": {
                                    "format": "uuid",
                                    "type": "string"
                                  },
                                  "kind": {
                                    "enum": [
                                      "coupon"
                                    ],
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "code_id"
                                ],
                                "type": "object"
                              },
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "kind": {
                                    "enum": [
                                      "traffic_bonus"
                                    ],
                                    "type": "string"
                                  },
                                  "traffic_bytes": {
                                    "pattern": "^\\d{1,18}$",
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "traffic_bytes"
                                ],
                                "type": "object"
                              },
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "kind": {
                                    "enum": [
                                      "term_extend"
                                    ],
                                    "type": "string"
                                  },
                                  "period_count": {
                                    "exclusiveMinimum": 0,
                                    "maximum": 3650,
                                    "type": "integer"
                                  },
                                  "period_unit": {
                                    "enum": [
                                      "hour",
                                      "day",
                                      "month",
                                      "year"
                                    ],
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "period_unit",
                                  "period_count"
                                ],
                                "type": "object"
                              },
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "kind": {
                                    "enum": [
                                      "trial"
                                    ],
                                    "type": "string"
                                  },
                                  "period_count": {
                                    "exclusiveMinimum": 0,
                                    "maximum": 3650,
                                    "type": "integer"
                                  },
                                  "period_unit": {
                                    "enum": [
                                      "hour",
                                      "day",
                                      "month",
                                      "year"
                                    ],
                                    "type": "string"
                                  },
                                  "plan_id": {
                                    "format": "uuid",
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "plan_id",
                                  "period_unit",
                                  "period_count"
                                ],
                                "type": "object"
                              }
                            ]
                          },
                          "maxItems": 20,
                          "type": "array"
                        },
                        "landing": {
                          "default": "/",
                          "pattern": "^(?:\\/|\\/pricing|\\/docs(?:\\/[a-zA-Z0-9_-]+)*|\\/app\\/(?:en-US\\/)?checkout\\?kind=purchase&plan=[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}&price=[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})$",
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "ends_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "max_redemptions": {
                      "default": null,
                      "exclusiveMinimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "name": {
                      "maxLength": 64,
                      "minLength": 1,
                      "type": "string"
                    },
                    "promoter_user_id": {
                      "default": null,
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "redeemed_count": {
                      "type": "integer"
                    },
                    "starts_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "default": "active",
                      "enum": [
                        "active",
                        "disabled"
                      ],
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "name",
                    "code",
                    "starts_at",
                    "ends_at",
                    "id",
                    "redeemed_count",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Resource not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "State or version conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Read an invite code",
        "tags": [
          "referral"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "growth.invite_code.manage"
      },
      "patch": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "channel": {
                    "default": null,
                    "maxLength": 64,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "effect": {
                    "additionalProperties": false,
                    "default": {
                      "invitee_rewards": [],
                      "landing": "/"
                    },
                    "properties": {
                      "invitee_rewards": {
                        "default": [],
                        "items": {
                          "oneOf": [
                            {
                              "additionalProperties": false,
                              "properties": {
                                "amount_minor": {
                                  "pattern": "^\\d{1,18}$",
                                  "type": "string"
                                },
                                "kind": {
                                  "enum": [
                                    "gift_credit"
                                  ],
                                  "type": "string"
                                }
                              },
                              "required": [
                                "kind",
                                "amount_minor"
                              ],
                              "type": "object"
                            },
                            {
                              "additionalProperties": false,
                              "properties": {
                                "code_id": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "kind": {
                                  "enum": [
                                    "coupon"
                                  ],
                                  "type": "string"
                                }
                              },
                              "required": [
                                "kind",
                                "code_id"
                              ],
                              "type": "object"
                            },
                            {
                              "additionalProperties": false,
                              "properties": {
                                "kind": {
                                  "enum": [
                                    "traffic_bonus"
                                  ],
                                  "type": "string"
                                },
                                "traffic_bytes": {
                                  "pattern": "^\\d{1,18}$",
                                  "type": "string"
                                }
                              },
                              "required": [
                                "kind",
                                "traffic_bytes"
                              ],
                              "type": "object"
                            },
                            {
                              "additionalProperties": false,
                              "properties": {
                                "kind": {
                                  "enum": [
                                    "term_extend"
                                  ],
                                  "type": "string"
                                },
                                "period_count": {
                                  "exclusiveMinimum": 0,
                                  "maximum": 3650,
                                  "type": "integer"
                                },
                                "period_unit": {
                                  "enum": [
                                    "hour",
                                    "day",
                                    "month",
                                    "year"
                                  ],
                                  "type": "string"
                                }
                              },
                              "required": [
                                "kind",
                                "period_unit",
                                "period_count"
                              ],
                              "type": "object"
                            },
                            {
                              "additionalProperties": false,
                              "properties": {
                                "kind": {
                                  "enum": [
                                    "trial"
                                  ],
                                  "type": "string"
                                },
                                "period_count": {
                                  "exclusiveMinimum": 0,
                                  "maximum": 3650,
                                  "type": "integer"
                                },
                                "period_unit": {
                                  "enum": [
                                    "hour",
                                    "day",
                                    "month",
                                    "year"
                                  ],
                                  "type": "string"
                                },
                                "plan_id": {
                                  "format": "uuid",
                                  "type": "string"
                                }
                              },
                              "required": [
                                "kind",
                                "plan_id",
                                "period_unit",
                                "period_count"
                              ],
                              "type": "object"
                            }
                          ]
                        },
                        "maxItems": 20,
                        "type": "array"
                      },
                      "landing": {
                        "default": "/",
                        "pattern": "^(?:\\/|\\/pricing|\\/docs(?:\\/[a-zA-Z0-9_-]+)*|\\/app\\/(?:en-US\\/)?checkout\\?kind=purchase&plan=[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}&price=[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})$",
                        "type": "string"
                      }
                    },
                    "type": "object"
                  },
                  "ends_at": {
                    "default": null,
                    "format": "date-time",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "max_redemptions": {
                    "default": null,
                    "exclusiveMinimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "name": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "promoter_user_id": {
                    "default": null,
                    "format": "uuid",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "starts_at": {
                    "default": null,
                    "format": "date-time",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "status": {
                    "default": "active",
                    "enum": [
                      "active",
                      "disabled"
                    ],
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "channel": {
                      "default": null,
                      "maxLength": 64,
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "code": {
                      "pattern": "^[A-Z0-9_-]{3,64}$",
                      "type": "string"
                    },
                    "effect": {
                      "additionalProperties": false,
                      "default": {
                        "invitee_rewards": [],
                        "landing": "/"
                      },
                      "properties": {
                        "invitee_rewards": {
                          "default": [],
                          "items": {
                            "oneOf": [
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "amount_minor": {
                                    "pattern": "^\\d{1,18}$",
                                    "type": "string"
                                  },
                                  "kind": {
                                    "enum": [
                                      "gift_credit"
                                    ],
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "amount_minor"
                                ],
                                "type": "object"
                              },
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "code_id": {
                                    "format": "uuid",
                                    "type": "string"
                                  },
                                  "kind": {
                                    "enum": [
                                      "coupon"
                                    ],
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "code_id"
                                ],
                                "type": "object"
                              },
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "kind": {
                                    "enum": [
                                      "traffic_bonus"
                                    ],
                                    "type": "string"
                                  },
                                  "traffic_bytes": {
                                    "pattern": "^\\d{1,18}$",
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "traffic_bytes"
                                ],
                                "type": "object"
                              },
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "kind": {
                                    "enum": [
                                      "term_extend"
                                    ],
                                    "type": "string"
                                  },
                                  "period_count": {
                                    "exclusiveMinimum": 0,
                                    "maximum": 3650,
                                    "type": "integer"
                                  },
                                  "period_unit": {
                                    "enum": [
                                      "hour",
                                      "day",
                                      "month",
                                      "year"
                                    ],
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "period_unit",
                                  "period_count"
                                ],
                                "type": "object"
                              },
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "kind": {
                                    "enum": [
                                      "trial"
                                    ],
                                    "type": "string"
                                  },
                                  "period_count": {
                                    "exclusiveMinimum": 0,
                                    "maximum": 3650,
                                    "type": "integer"
                                  },
                                  "period_unit": {
                                    "enum": [
                                      "hour",
                                      "day",
                                      "month",
                                      "year"
                                    ],
                                    "type": "string"
                                  },
                                  "plan_id": {
                                    "format": "uuid",
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "kind",
                                  "plan_id",
                                  "period_unit",
                                  "period_count"
                                ],
                                "type": "object"
                              }
                            ]
                          },
                          "maxItems": 20,
                          "type": "array"
                        },
                        "landing": {
                          "default": "/",
                          "pattern": "^(?:\\/|\\/pricing|\\/docs(?:\\/[a-zA-Z0-9_-]+)*|\\/app\\/(?:en-US\\/)?checkout\\?kind=purchase&plan=[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}&price=[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})$",
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "ends_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "max_redemptions": {
                      "default": null,
                      "exclusiveMinimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "name": {
                      "maxLength": 64,
                      "minLength": 1,
                      "type": "string"
                    },
                    "promoter_user_id": {
                      "default": null,
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "redeemed_count": {
                      "type": "integer"
                    },
                    "starts_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "default": "active",
                      "enum": [
                        "active",
                        "disabled"
                      ],
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "name",
                    "code",
                    "starts_at",
                    "ends_at",
                    "id",
                    "redeemed_count",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Resource not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "State or version conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Update or disable an invite code",
        "tags": [
          "referral"
        ],
        "x-audit": "growth.invite_code.update",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "growth.invite_code.manage",
        "x-reauth": false
      }
    },
    "/api/v1/admin/growth/redeem-batches": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "created_at": {
                            "type": "string"
                          },
                          "created_by": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "effect": {
                            "properties": {
                              "kind": {
                                "type": "string"
                              },
                              "params": {
                                "additionalProperties": {},
                                "type": "object"
                              },
                              "snapshot": {},
                              "term": {
                                "oneOf": [
                                  {
                                    "additionalProperties": false,
                                    "properties": {
                                      "perpetual": {
                                        "enum": [
                                          true
                                        ],
                                        "type": "boolean"
                                      }
                                    },
                                    "required": [
                                      "perpetual"
                                    ],
                                    "type": "object"
                                  },
                                  {
                                    "additionalProperties": false,
                                    "properties": {
                                      "count": {
                                        "maximum": 1200,
                                        "minimum": 1,
                                        "type": "integer"
                                      },
                                      "perpetual": {
                                        "enum": [
                                          false
                                        ],
                                        "type": "boolean"
                                      },
                                      "unit": {
                                        "enum": [
                                          "hour",
                                          "day",
                                          "month",
                                          "year"
                                        ],
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "perpetual",
                                      "unit",
                                      "count"
                                    ],
                                    "type": "object"
                                  }
                                ]
                              }
                            },
                            "required": [
                              "kind",
                              "params"
                            ],
                            "type": "object"
                          },
                          "ends_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "exported_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "quantity": {
                            "type": "integer"
                          },
                          "starts_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "void_reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "voided_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "quantity",
                          "effect",
                          "starts_at",
                          "ends_at",
                          "created_by",
                          "created_at",
                          "exported_at",
                          "voided_at",
                          "void_reason"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "summary": "List redeem batches without secret codes",
        "tags": [
          "redeem"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "growth.redeem.manage",
        "x-rate-limit": "growth.redeem.admin",
        "x-reauth": false
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "effect": {
                    "oneOf": [
                      {
                        "additionalProperties": false,
                        "properties": {
                          "kind": {
                            "enum": [
                              "activate_plan"
                            ],
                            "type": "string"
                          },
                          "plan_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "term": {
                            "oneOf": [
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "perpetual": {
                                    "enum": [
                                      true
                                    ],
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "perpetual"
                                ],
                                "type": "object"
                              },
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "count": {
                                    "maximum": 1200,
                                    "minimum": 1,
                                    "type": "integer"
                                  },
                                  "perpetual": {
                                    "enum": [
                                      false
                                    ],
                                    "type": "boolean"
                                  },
                                  "unit": {
                                    "enum": [
                                      "hour",
                                      "day",
                                      "month",
                                      "year"
                                    ],
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "perpetual",
                                  "unit",
                                  "count"
                                ],
                                "type": "object"
                              }
                            ]
                          }
                        },
                        "required": [
                          "kind",
                          "plan_id",
                          "term"
                        ],
                        "type": "object"
                      },
                      {
                        "additionalProperties": false,
                        "properties": {
                          "kind": {
                            "enum": [
                              "plan_switch"
                            ],
                            "type": "string"
                          },
                          "plan_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "kind",
                          "plan_id"
                        ],
                        "type": "object"
                      },
                      {
                        "additionalProperties": false,
                        "properties": {
                          "kind": {
                            "enum": [
                              "term_extend"
                            ],
                            "type": "string"
                          },
                          "term": {
                            "oneOf": [
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "perpetual": {
                                    "enum": [
                                      true
                                    ],
                                    "type": "boolean"
                                  }
                                },
                                "required": [
                                  "perpetual"
                                ],
                                "type": "object"
                              },
                              {
                                "additionalProperties": false,
                                "properties": {
                                  "count": {
                                    "maximum": 1200,
                                    "minimum": 1,
                                    "type": "integer"
                                  },
                                  "perpetual": {
                                    "enum": [
                                      false
                                    ],
                                    "type": "boolean"
                                  },
                                  "unit": {
                                    "enum": [
                                      "hour",
                                      "day",
                                      "month",
                                      "year"
                                    ],
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "perpetual",
                                  "unit",
                                  "count"
                                ],
                                "type": "object"
                              }
                            ]
                          }
                        },
                        "required": [
                          "kind",
                          "term"
                        ],
                        "type": "object"
                      },
                      {
                        "additionalProperties": false,
                        "properties": {
                          "kind": {
                            "enum": [
                              "traffic_bonus"
                            ],
                            "type": "string"
                          },
                          "traffic_bytes": {
                            "pattern": "^[1-9][0-9]{0,17}$",
                            "type": "string"
                          }
                        },
                        "required": [
                          "kind",
                          "traffic_bytes"
                        ],
                        "type": "object"
                      },
                      {
                        "additionalProperties": false,
                        "properties": {
                          "device_delta": {
                            "maximum": 1000,
                            "minimum": 1,
                            "type": "integer"
                          },
                          "expires_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "kind": {
                            "enum": [
                              "device_bonus"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "kind",
                          "device_delta"
                        ],
                        "type": "object"
                      },
                      {
                        "additionalProperties": false,
                        "properties": {
                          "kind": {
                            "enum": [
                              "usage_reset"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "kind"
                        ],
                        "type": "object"
                      }
                    ]
                  },
                  "ends_at": {
                    "format": "date-time",
                    "type": "string"
                  },
                  "name": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "quantity": {
                    "maximum": 1000,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "starts_at": {
                    "format": "date-time",
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "quantity",
                  "effect"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "created_at": {
                      "type": "string"
                    },
                    "created_by": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "effect": {
                      "properties": {
                        "kind": {
                          "type": "string"
                        },
                        "params": {
                          "additionalProperties": {},
                          "type": "object"
                        },
                        "snapshot": {},
                        "term": {
                          "oneOf": [
                            {
                              "additionalProperties": false,
                              "properties": {
                                "perpetual": {
                                  "enum": [
                                    true
                                  ],
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "perpetual"
                              ],
                              "type": "object"
                            },
                            {
                              "additionalProperties": false,
                              "properties": {
                                "count": {
                                  "maximum": 1200,
                                  "minimum": 1,
                                  "type": "integer"
                                },
                                "perpetual": {
                                  "enum": [
                                    false
                                  ],
                                  "type": "boolean"
                                },
                                "unit": {
                                  "enum": [
                                    "hour",
                                    "day",
                                    "month",
                                    "year"
                                  ],
                                  "type": "string"
                                }
                              },
                              "required": [
                                "perpetual",
                                "unit",
                                "count"
                              ],
                              "type": "object"
                            }
                          ]
                        }
                      },
                      "required": [
                        "kind",
                        "params"
                      ],
                      "type": "object"
                    },
                    "ends_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "exported_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "quantity": {
                      "type": "integer"
                    },
                    "starts_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "void_reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "voided_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "quantity",
                    "effect",
                    "starts_at",
                    "ends_at",
                    "created_by",
                    "created_at",
                    "exported_at",
                    "voided_at",
                    "void_reason"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "summary": "Create a redeem batch for one-time export",
        "tags": [
          "redeem"
        ],
        "x-audit": "growth.redeem.generate",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "growth.redeem.manage",
        "x-rate-limit": "growth.redeem.admin",
        "x-reauth": false
      }
    },
    "/api/v1/admin/growth/redeem-batches/{id}/export": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "batch_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "codes": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "batch_id",
                    "codes"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "summary": "Export redeem codes exactly once; response cannot be replayed",
        "tags": [
          "redeem"
        ],
        "x-audit": "growth.redeem.export",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "growth.redeem.manage",
        "x-rate-limit": "growth.redeem.admin",
        "x-reauth": false
      }
    },
    "/api/v1/admin/growth/redeem-batches/{id}/void": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "reason": {
                    "maxLength": 500,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "reason"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "created_at": {
                      "type": "string"
                    },
                    "created_by": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "effect": {
                      "properties": {
                        "kind": {
                          "type": "string"
                        },
                        "params": {
                          "additionalProperties": {},
                          "type": "object"
                        },
                        "snapshot": {},
                        "term": {
                          "oneOf": [
                            {
                              "additionalProperties": false,
                              "properties": {
                                "perpetual": {
                                  "enum": [
                                    true
                                  ],
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "perpetual"
                              ],
                              "type": "object"
                            },
                            {
                              "additionalProperties": false,
                              "properties": {
                                "count": {
                                  "maximum": 1200,
                                  "minimum": 1,
                                  "type": "integer"
                                },
                                "perpetual": {
                                  "enum": [
                                    false
                                  ],
                                  "type": "boolean"
                                },
                                "unit": {
                                  "enum": [
                                    "hour",
                                    "day",
                                    "month",
                                    "year"
                                  ],
                                  "type": "string"
                                }
                              },
                              "required": [
                                "perpetual",
                                "unit",
                                "count"
                              ],
                              "type": "object"
                            }
                          ]
                        }
                      },
                      "required": [
                        "kind",
                        "params"
                      ],
                      "type": "object"
                    },
                    "ends_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "exported_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "quantity": {
                      "type": "integer"
                    },
                    "starts_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "void_reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "voided_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "quantity",
                    "effect",
                    "starts_at",
                    "ends_at",
                    "created_by",
                    "created_at",
                    "exported_at",
                    "voided_at",
                    "void_reason"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "summary": "Void all unredeemed codes in a batch",
        "tags": [
          "redeem"
        ],
        "x-audit": "growth.redeem.void",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "growth.redeem.manage",
        "x-rate-limit": "growth.redeem.admin",
        "x-reauth": false
      }
    },
    "/api/v1/admin/growth/referral-levels": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "first_order_rate_bps": {
                            "maximum": 10000,
                            "minimum": 0,
                            "type": "integer"
                          },
                          "i18n": {
                            "additionalProperties": {
                              "additionalProperties": false,
                              "properties": {
                                "_meta": {
                                  "additionalProperties": false,
                                  "properties": {
                                    "origin": {
                                      "enum": [
                                        "manual",
                                        "machine",
                                        "builtin"
                                      ],
                                      "type": "string"
                                    },
                                    "provider": {
                                      "maxLength": 64,
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "origin"
                                  ],
                                  "type": "object"
                                },
                                "description": {
                                  "maxLength": 1000,
                                  "type": "string"
                                },
                                "name": {
                                  "maxLength": 64,
                                  "minLength": 1,
                                  "type": "string"
                                }
                              },
                              "type": "object"
                            },
                            "default": {},
                            "type": "object"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "is_base": {
                            "type": "boolean"
                          },
                          "name": {
                            "maxLength": 64,
                            "minLength": 1,
                            "type": "string"
                          },
                          "rank": {
                            "type": "integer"
                          },
                          "recurring_rate_bps": {
                            "maximum": 10000,
                            "minimum": 0,
                            "type": "integer"
                          },
                          "retain_min_net_paid_minor": {
                            "default": null,
                            "pattern": "^[1-9]\\d{0,17}$",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "retain_min_paid_invitees": {
                            "default": null,
                            "exclusiveMinimum": 0,
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "source_locale": {
                            "default": "zh-CN",
                            "maxLength": 20,
                            "minLength": 2,
                            "type": "string"
                          },
                          "status": {
                            "default": "active",
                            "enum": [
                              "active",
                              "disabled"
                            ],
                            "type": "string"
                          },
                          "upgrade_min_net_paid_minor": {
                            "default": null,
                            "pattern": "^[1-9]\\d{0,17}$",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "upgrade_min_paid_invitees": {
                            "default": null,
                            "exclusiveMinimum": 0,
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "name",
                          "rank",
                          "first_order_rate_bps",
                          "recurring_rate_bps",
                          "id",
                          "is_base",
                          "version"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "List referral levels",
        "tags": [
          "referral"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "growth.referral.manage"
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "first_order_rate_bps": {
                    "maximum": 10000,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "i18n": {
                    "additionalProperties": {
                      "additionalProperties": false,
                      "properties": {
                        "_meta": {
                          "additionalProperties": false,
                          "properties": {
                            "origin": {
                              "enum": [
                                "manual",
                                "machine",
                                "builtin"
                              ],
                              "type": "string"
                            },
                            "provider": {
                              "maxLength": 64,
                              "type": "string"
                            }
                          },
                          "required": [
                            "origin"
                          ],
                          "type": "object"
                        },
                        "description": {
                          "maxLength": 1000,
                          "type": "string"
                        },
                        "name": {
                          "maxLength": 64,
                          "minLength": 1,
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "default": {},
                    "type": "object"
                  },
                  "name": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "rank": {
                    "type": "integer"
                  },
                  "recurring_rate_bps": {
                    "maximum": 10000,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "retain_min_net_paid_minor": {
                    "default": null,
                    "pattern": "^[1-9]\\d{0,17}$",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "retain_min_paid_invitees": {
                    "default": null,
                    "exclusiveMinimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "source_locale": {
                    "default": "zh-CN",
                    "maxLength": 20,
                    "minLength": 2,
                    "type": "string"
                  },
                  "status": {
                    "default": "active",
                    "enum": [
                      "active",
                      "disabled"
                    ],
                    "type": "string"
                  },
                  "upgrade_min_net_paid_minor": {
                    "default": null,
                    "pattern": "^[1-9]\\d{0,17}$",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "upgrade_min_paid_invitees": {
                    "default": null,
                    "exclusiveMinimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "required": [
                  "name",
                  "rank",
                  "first_order_rate_bps",
                  "recurring_rate_bps"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "first_order_rate_bps": {
                      "maximum": 10000,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "i18n": {
                      "additionalProperties": {
                        "additionalProperties": false,
                        "properties": {
                          "_meta": {
                            "additionalProperties": false,
                            "properties": {
                              "origin": {
                                "enum": [
                                  "manual",
                                  "machine",
                                  "builtin"
                                ],
                                "type": "string"
                              },
                              "provider": {
                                "maxLength": 64,
                                "type": "string"
                              }
                            },
                            "required": [
                              "origin"
                            ],
                            "type": "object"
                          },
                          "description": {
                            "maxLength": 1000,
                            "type": "string"
                          },
                          "name": {
                            "maxLength": 64,
                            "minLength": 1,
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "default": {},
                      "type": "object"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "is_base": {
                      "type": "boolean"
                    },
                    "name": {
                      "maxLength": 64,
                      "minLength": 1,
                      "type": "string"
                    },
                    "rank": {
                      "type": "integer"
                    },
                    "recurring_rate_bps": {
                      "maximum": 10000,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "retain_min_net_paid_minor": {
                      "default": null,
                      "pattern": "^[1-9]\\d{0,17}$",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "retain_min_paid_invitees": {
                      "default": null,
                      "exclusiveMinimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "source_locale": {
                      "default": "zh-CN",
                      "maxLength": 20,
                      "minLength": 2,
                      "type": "string"
                    },
                    "status": {
                      "default": "active",
                      "enum": [
                        "active",
                        "disabled"
                      ],
                      "type": "string"
                    },
                    "upgrade_min_net_paid_minor": {
                      "default": null,
                      "pattern": "^[1-9]\\d{0,17}$",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "upgrade_min_paid_invitees": {
                      "default": null,
                      "exclusiveMinimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "name",
                    "rank",
                    "first_order_rate_bps",
                    "recurring_rate_bps",
                    "id",
                    "is_base",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Resource not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "State or version conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Create a referral level",
        "tags": [
          "referral"
        ],
        "x-audit": "growth.level.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true
        },
        "x-idempotency": "required",
        "x-permission": "growth.referral.manage",
        "x-reauth": false
      }
    },
    "/api/v1/admin/growth/referral-levels/order": {
      "put": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "ids": {
                    "items": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "maxItems": 1000,
                    "minItems": 1,
                    "type": "array"
                  }
                },
                "required": [
                  "ids"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "first_order_rate_bps": {
                            "maximum": 10000,
                            "minimum": 0,
                            "type": "integer"
                          },
                          "i18n": {
                            "additionalProperties": {
                              "additionalProperties": false,
                              "properties": {
                                "_meta": {
                                  "additionalProperties": false,
                                  "properties": {
                                    "origin": {
                                      "enum": [
                                        "manual",
                                        "machine",
                                        "builtin"
                                      ],
                                      "type": "string"
                                    },
                                    "provider": {
                                      "maxLength": 64,
                                      "type": "string"
                                    }
                                  },
                                  "required": [
                                    "origin"
                                  ],
                                  "type": "object"
                                },
                                "description": {
                                  "maxLength": 1000,
                                  "type": "string"
                                },
                                "name": {
                                  "maxLength": 64,
                                  "minLength": 1,
                                  "type": "string"
                                }
                              },
                              "type": "object"
                            },
                            "default": {},
                            "type": "object"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "is_base": {
                            "type": "boolean"
                          },
                          "name": {
                            "maxLength": 64,
                            "minLength": 1,
                            "type": "string"
                          },
                          "rank": {
                            "type": "integer"
                          },
                          "recurring_rate_bps": {
                            "maximum": 10000,
                            "minimum": 0,
                            "type": "integer"
                          },
                          "retain_min_net_paid_minor": {
                            "default": null,
                            "pattern": "^[1-9]\\d{0,17}$",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "retain_min_paid_invitees": {
                            "default": null,
                            "exclusiveMinimum": 0,
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "source_locale": {
                            "default": "zh-CN",
                            "maxLength": 20,
                            "minLength": 2,
                            "type": "string"
                          },
                          "status": {
                            "default": "active",
                            "enum": [
                              "active",
                              "disabled"
                            ],
                            "type": "string"
                          },
                          "upgrade_min_net_paid_minor": {
                            "default": null,
                            "pattern": "^[1-9]\\d{0,17}$",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "upgrade_min_paid_invitees": {
                            "default": null,
                            "exclusiveMinimum": 0,
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "name",
                          "rank",
                          "first_order_rate_bps",
                          "recurring_rate_bps",
                          "id",
                          "is_base",
                          "version"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Resource not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "State or version conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Reorder every referral level",
        "tags": [
          "referral"
        ],
        "x-audit": "growth.level.reorder",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "optional",
        "x-permission": "growth.referral.manage",
        "x-reauth": false
      }
    },
    "/api/v1/admin/growth/referral-levels/{id}": {
      "delete": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Resource not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "State or version conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Delete an unused non-base level",
        "tags": [
          "referral"
        ],
        "x-audit": "growth.level.delete",
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "growth.referral.manage",
        "x-reauth": false
      },
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "first_order_rate_bps": {
                      "maximum": 10000,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "i18n": {
                      "additionalProperties": {
                        "additionalProperties": false,
                        "properties": {
                          "_meta": {
                            "additionalProperties": false,
                            "properties": {
                              "origin": {
                                "enum": [
                                  "manual",
                                  "machine",
                                  "builtin"
                                ],
                                "type": "string"
                              },
                              "provider": {
                                "maxLength": 64,
                                "type": "string"
                              }
                            },
                            "required": [
                              "origin"
                            ],
                            "type": "object"
                          },
                          "description": {
                            "maxLength": 1000,
                            "type": "string"
                          },
                          "name": {
                            "maxLength": 64,
                            "minLength": 1,
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "default": {},
                      "type": "object"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "is_base": {
                      "type": "boolean"
                    },
                    "name": {
                      "maxLength": 64,
                      "minLength": 1,
                      "type": "string"
                    },
                    "rank": {
                      "type": "integer"
                    },
                    "recurring_rate_bps": {
                      "maximum": 10000,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "retain_min_net_paid_minor": {
                      "default": null,
                      "pattern": "^[1-9]\\d{0,17}$",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "retain_min_paid_invitees": {
                      "default": null,
                      "exclusiveMinimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "source_locale": {
                      "default": "zh-CN",
                      "maxLength": 20,
                      "minLength": 2,
                      "type": "string"
                    },
                    "status": {
                      "default": "active",
                      "enum": [
                        "active",
                        "disabled"
                      ],
                      "type": "string"
                    },
                    "upgrade_min_net_paid_minor": {
                      "default": null,
                      "pattern": "^[1-9]\\d{0,17}$",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "upgrade_min_paid_invitees": {
                      "default": null,
                      "exclusiveMinimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "name",
                    "rank",
                    "first_order_rate_bps",
                    "recurring_rate_bps",
                    "id",
                    "is_base",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Resource not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "State or version conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Read a referral level",
        "tags": [
          "referral"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "growth.referral.manage"
      },
      "patch": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "first_order_rate_bps": {
                    "maximum": 10000,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "i18n": {
                    "additionalProperties": {
                      "additionalProperties": false,
                      "properties": {
                        "_meta": {
                          "additionalProperties": false,
                          "properties": {
                            "origin": {
                              "enum": [
                                "manual",
                                "machine",
                                "builtin"
                              ],
                              "type": "string"
                            },
                            "provider": {
                              "maxLength": 64,
                              "type": "string"
                            }
                          },
                          "required": [
                            "origin"
                          ],
                          "type": "object"
                        },
                        "description": {
                          "maxLength": 1000,
                          "type": "string"
                        },
                        "name": {
                          "maxLength": 64,
                          "minLength": 1,
                          "type": "string"
                        }
                      },
                      "type": "object"
                    },
                    "default": {},
                    "type": "object"
                  },
                  "name": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "rank": {
                    "type": "integer"
                  },
                  "recurring_rate_bps": {
                    "maximum": 10000,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "retain_min_net_paid_minor": {
                    "default": null,
                    "pattern": "^[1-9]\\d{0,17}$",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "retain_min_paid_invitees": {
                    "default": null,
                    "exclusiveMinimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  },
                  "source_locale": {
                    "default": "zh-CN",
                    "maxLength": 20,
                    "minLength": 2,
                    "type": "string"
                  },
                  "status": {
                    "default": "active",
                    "enum": [
                      "active",
                      "disabled"
                    ],
                    "type": "string"
                  },
                  "upgrade_min_net_paid_minor": {
                    "default": null,
                    "pattern": "^[1-9]\\d{0,17}$",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "upgrade_min_paid_invitees": {
                    "default": null,
                    "exclusiveMinimum": 0,
                    "type": [
                      "integer",
                      "null"
                    ]
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "first_order_rate_bps": {
                      "maximum": 10000,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "i18n": {
                      "additionalProperties": {
                        "additionalProperties": false,
                        "properties": {
                          "_meta": {
                            "additionalProperties": false,
                            "properties": {
                              "origin": {
                                "enum": [
                                  "manual",
                                  "machine",
                                  "builtin"
                                ],
                                "type": "string"
                              },
                              "provider": {
                                "maxLength": 64,
                                "type": "string"
                              }
                            },
                            "required": [
                              "origin"
                            ],
                            "type": "object"
                          },
                          "description": {
                            "maxLength": 1000,
                            "type": "string"
                          },
                          "name": {
                            "maxLength": 64,
                            "minLength": 1,
                            "type": "string"
                          }
                        },
                        "type": "object"
                      },
                      "default": {},
                      "type": "object"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "is_base": {
                      "type": "boolean"
                    },
                    "name": {
                      "maxLength": 64,
                      "minLength": 1,
                      "type": "string"
                    },
                    "rank": {
                      "type": "integer"
                    },
                    "recurring_rate_bps": {
                      "maximum": 10000,
                      "minimum": 0,
                      "type": "integer"
                    },
                    "retain_min_net_paid_minor": {
                      "default": null,
                      "pattern": "^[1-9]\\d{0,17}$",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "retain_min_paid_invitees": {
                      "default": null,
                      "exclusiveMinimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "source_locale": {
                      "default": "zh-CN",
                      "maxLength": 20,
                      "minLength": 2,
                      "type": "string"
                    },
                    "status": {
                      "default": "active",
                      "enum": [
                        "active",
                        "disabled"
                      ],
                      "type": "string"
                    },
                    "upgrade_min_net_paid_minor": {
                      "default": null,
                      "pattern": "^[1-9]\\d{0,17}$",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "upgrade_min_paid_invitees": {
                      "default": null,
                      "exclusiveMinimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "name",
                    "rank",
                    "first_order_rate_bps",
                    "recurring_rate_bps",
                    "id",
                    "is_base",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Resource not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "State or version conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Update a referral level without changing past commissions",
        "tags": [
          "referral"
        ],
        "x-audit": "growth.level.update",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "growth.referral.manage",
        "x-reauth": false
      }
    },
    "/api/v1/admin/growth/referral-stats": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "referrer_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "code_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "channel",
            "required": false,
            "schema": {
              "maxLength": 64,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "from",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "clicks": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "commission_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "currency": {
                      "pattern": "^[A-Z]{3}$",
                      "type": "string"
                    },
                    "daily": {
                      "items": {
                        "properties": {
                          "clicks": {
                            "pattern": "^\\d{1,18}$",
                            "type": "string"
                          },
                          "code": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "commission_minor": {
                            "pattern": "^\\d{1,18}$",
                            "type": "string"
                          },
                          "date": {
                            "format": "date",
                            "type": "string"
                          },
                          "first_paid": {
                            "type": "integer"
                          },
                          "paid_minor": {
                            "pattern": "^\\d{1,18}$",
                            "type": "string"
                          },
                          "registrations": {
                            "type": "integer"
                          },
                          "rewards": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "date",
                          "code",
                          "clicks",
                          "registrations",
                          "first_paid",
                          "paid_minor",
                          "commission_minor",
                          "rewards"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "first_paid": {
                      "type": "integer"
                    },
                    "paid_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "registrations": {
                      "type": "integer"
                    },
                    "rewards": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "daily",
                    "currency",
                    "clicks",
                    "registrations",
                    "first_paid",
                    "paid_minor",
                    "commission_minor",
                    "rewards"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Referral statistics",
        "tags": [
          "referral"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "growth.referral.read"
      }
    },
    "/api/v1/admin/growth/referrals": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "referrer_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "code_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "channel",
            "required": false,
            "schema": {
              "maxLength": 64,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "from",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "created_at": {
                            "type": "string"
                          },
                          "email_masked": {
                            "type": "string"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "invite_code_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "invited_via": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "public_id": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "public_id",
                          "email_masked",
                          "invited_via",
                          "invite_code_id",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "List referral relationships",
        "tags": [
          "referral"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "growth.referral.read"
      }
    },
    "/api/v1/admin/growth/rewards": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "beneficiary_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "enum": [
                "held",
                "pending",
                "available",
                "granted",
                "reversed",
                "rejected"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "amount_minor": {
                            "pattern": "^\\d{1,18}$",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "available_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "base_minor": {
                            "pattern": "^\\d{1,18}$",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "beneficiary_user_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "currency": {
                            "pattern": "^[A-Z]{3}$",
                            "type": "string"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "idempotency_key": {
                            "type": "string"
                          },
                          "invite_code_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "invitee_user_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "inviter_user_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "kind": {
                            "enum": [
                              "commission",
                              "gift_credit",
                              "coupon",
                              "traffic_bonus",
                              "term_extend",
                              "trial"
                            ],
                            "type": "string"
                          },
                          "order_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "rate_bps": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "reversed_minor": {
                            "pattern": "^\\d{1,18}$",
                            "type": "string"
                          },
                          "review_reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "role": {
                            "enum": [
                              "inviter",
                              "invitee"
                            ],
                            "type": "string"
                          },
                          "rule_key": {
                            "type": "string"
                          },
                          "rule_snapshot": {
                            "additionalProperties": {},
                            "type": "object"
                          },
                          "status": {
                            "enum": [
                              "pending",
                              "held",
                              "available",
                              "granted",
                              "reversed",
                              "rejected"
                            ],
                            "type": "string"
                          },
                          "trigger": {
                            "enum": [
                              "registered",
                              "first_paid",
                              "paid"
                            ],
                            "type": "string"
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "currency",
                          "id",
                          "beneficiary_user_id",
                          "invitee_user_id",
                          "inviter_user_id",
                          "invite_code_id",
                          "role",
                          "trigger",
                          "order_id",
                          "kind",
                          "rule_key",
                          "rule_snapshot",
                          "base_minor",
                          "rate_bps",
                          "amount_minor",
                          "reversed_minor",
                          "status",
                          "available_at",
                          "idempotency_key",
                          "review_reason",
                          "version"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "List referral rewards and held review queue",
        "tags": [
          "referral"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "growth.commission.read"
      }
    },
    "/api/v1/admin/growth/rewards/{id}/approve": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "reason": {
                    "maxLength": 500,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "reason"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "amount_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "available_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "base_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "beneficiary_user_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "currency": {
                      "pattern": "^[A-Z]{3}$",
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "idempotency_key": {
                      "type": "string"
                    },
                    "invite_code_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "invitee_user_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "inviter_user_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "kind": {
                      "enum": [
                        "commission",
                        "gift_credit",
                        "coupon",
                        "traffic_bonus",
                        "term_extend",
                        "trial"
                      ],
                      "type": "string"
                    },
                    "order_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "rate_bps": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "reversed_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "review_reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "role": {
                      "enum": [
                        "inviter",
                        "invitee"
                      ],
                      "type": "string"
                    },
                    "rule_key": {
                      "type": "string"
                    },
                    "rule_snapshot": {
                      "additionalProperties": {},
                      "type": "object"
                    },
                    "status": {
                      "enum": [
                        "pending",
                        "held",
                        "available",
                        "granted",
                        "reversed",
                        "rejected"
                      ],
                      "type": "string"
                    },
                    "trigger": {
                      "enum": [
                        "registered",
                        "first_paid",
                        "paid"
                      ],
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "currency",
                    "id",
                    "beneficiary_user_id",
                    "invitee_user_id",
                    "inviter_user_id",
                    "invite_code_id",
                    "role",
                    "trigger",
                    "order_id",
                    "kind",
                    "rule_key",
                    "rule_snapshot",
                    "base_minor",
                    "rate_bps",
                    "amount_minor",
                    "reversed_minor",
                    "status",
                    "available_at",
                    "idempotency_key",
                    "review_reason",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Resource not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "State or version conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Approve a held referral reward",
        "tags": [
          "referral"
        ],
        "x-audit": "growth.reward.approve",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "growth.referral.manage",
        "x-reauth": false
      }
    },
    "/api/v1/admin/growth/rewards/{id}/reject": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "reason": {
                    "maxLength": 500,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "reason"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "amount_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "available_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "base_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "beneficiary_user_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "currency": {
                      "pattern": "^[A-Z]{3}$",
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "idempotency_key": {
                      "type": "string"
                    },
                    "invite_code_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "invitee_user_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "inviter_user_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "kind": {
                      "enum": [
                        "commission",
                        "gift_credit",
                        "coupon",
                        "traffic_bonus",
                        "term_extend",
                        "trial"
                      ],
                      "type": "string"
                    },
                    "order_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "rate_bps": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "reversed_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "review_reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "role": {
                      "enum": [
                        "inviter",
                        "invitee"
                      ],
                      "type": "string"
                    },
                    "rule_key": {
                      "type": "string"
                    },
                    "rule_snapshot": {
                      "additionalProperties": {},
                      "type": "object"
                    },
                    "status": {
                      "enum": [
                        "pending",
                        "held",
                        "available",
                        "granted",
                        "reversed",
                        "rejected"
                      ],
                      "type": "string"
                    },
                    "trigger": {
                      "enum": [
                        "registered",
                        "first_paid",
                        "paid"
                      ],
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "currency",
                    "id",
                    "beneficiary_user_id",
                    "invitee_user_id",
                    "inviter_user_id",
                    "invite_code_id",
                    "role",
                    "trigger",
                    "order_id",
                    "kind",
                    "rule_key",
                    "rule_snapshot",
                    "base_minor",
                    "rate_bps",
                    "amount_minor",
                    "reversed_minor",
                    "status",
                    "available_at",
                    "idempotency_key",
                    "review_reason",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Resource not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "State or version conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Reject a held referral reward",
        "tags": [
          "referral"
        ],
        "x-audit": "growth.reward.reject",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "growth.referral.manage",
        "x-reauth": false
      }
    },
    "/api/v1/admin/health": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "database": {
                      "properties": {
                        "available": {
                          "type": "boolean"
                        },
                        "compatible": {
                          "type": "boolean"
                        },
                        "min_app_schema": {
                          "type": "number"
                        },
                        "schema_version": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "available",
                        "schema_version",
                        "min_app_schema",
                        "compatible"
                      ],
                      "type": "object"
                    },
                    "installed": {
                      "type": "boolean"
                    },
                    "job_kinds": {
                      "items": {
                        "properties": {
                          "dead": {
                            "minimum": 0,
                            "type": "number"
                          },
                          "failures_1h": {
                            "minimum": 0,
                            "type": "number"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "oldest_due_seconds": {
                            "minimum": 0,
                            "type": "number"
                          },
                          "pending": {
                            "minimum": 0,
                            "type": "number"
                          },
                          "queue": {
                            "enum": [
                              "default",
                              "heavy"
                            ],
                            "type": "string"
                          },
                          "running": {
                            "minimum": 0,
                            "type": "number"
                          },
                          "superseded_1h": {
                            "minimum": 0,
                            "type": "number"
                          }
                        },
                        "required": [
                          "queue",
                          "pending",
                          "oldest_due_seconds",
                          "running",
                          "failures_1h",
                          "dead",
                          "superseded_1h",
                          "kind"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "queues": {
                      "items": {
                        "properties": {
                          "dead": {
                            "minimum": 0,
                            "type": "number"
                          },
                          "failures_1h": {
                            "minimum": 0,
                            "type": "number"
                          },
                          "oldest_due_seconds": {
                            "minimum": 0,
                            "type": "number"
                          },
                          "pending": {
                            "minimum": 0,
                            "type": "number"
                          },
                          "queue": {
                            "enum": [
                              "default",
                              "heavy"
                            ],
                            "type": "string"
                          },
                          "running": {
                            "minimum": 0,
                            "type": "number"
                          },
                          "superseded_1h": {
                            "minimum": 0,
                            "type": "number"
                          }
                        },
                        "required": [
                          "queue",
                          "pending",
                          "oldest_due_seconds",
                          "running",
                          "failures_1h",
                          "dead",
                          "superseded_1h"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "ready": {
                      "type": "boolean"
                    },
                    "volatile": {
                      "properties": {
                        "available": {
                          "type": "boolean"
                        },
                        "kind": {
                          "type": "string"
                        },
                        "latency_ms": {
                          "type": "number"
                        },
                        "rate_limit_degraded": {
                          "type": "number"
                        },
                        "unavailable_total": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "kind",
                        "available",
                        "latency_ms",
                        "unavailable_total",
                        "rate_limit_degraded"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "ready",
                    "database",
                    "installed",
                    "queues",
                    "job_kinds",
                    "volatile"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Health"
          }
        },
        "summary": "Database, queues and active volatile store",
        "tags": [
          "health"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "ops.health.read"
      }
    },
    "/api/v1/admin/i18n/providers/{id}/test": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "example": "workers_ai",
              "maxLength": 32,
              "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TranslationProviderTest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TranslationProviderTestResult"
                }
              }
            },
            "description": "Translated sample"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No provider with this id"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "i18n.locale_not_enabled or validation failed"
          },
          "502": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "i18n.translation_provider_failed (details.reason)"
          }
        },
        "summary": "Test one translation provider with a sample (synchronous; counts toward its monthly characters)",
        "tags": [
          "i18n"
        ],
        "x-audit": "i18n.provider_test",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-permission": "system.i18n.manage"
      }
    },
    "/api/v1/admin/i18n/status": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "type",
            "required": false,
            "schema": {
              "example": "catalog.product",
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9_]*\\.[a-z][a-z0-9_]*$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "id",
            "required": false,
            "schema": {
              "example": "0192f0c4-0000-7000-8000-00000000abcd",
              "maxLength": 80,
              "minLength": 1,
              "pattern": "^[A-Za-z0-9_./:-]+$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TranslationStatus"
                }
              }
            },
            "description": "Overview or resource status"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unknown resource type or resource"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "type and id must be given together"
          }
        },
        "summary": "Translation status: overview, or one resource (?type=&id=) with every locale and its latest job",
        "tags": [
          "i18n"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "system.i18n.manage"
      }
    },
    "/api/v1/admin/i18n/translate": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TranslateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TranslateResult"
                }
              }
            },
            "description": "Queued translations"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unknown resource type or resource"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Idempotency-Key conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "i18n.locale_not_enabled or validation failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Idempotency-Key missing"
          }
        },
        "summary": "Translate missing locales of a resource, or retranslate (overwrite) after confirmation",
        "tags": [
          "i18n"
        ],
        "x-audit": "i18n.translate",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "system.i18n.manage"
      }
    },
    "/api/v1/admin/invitations": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "enum": [
                "pending",
                "accepted",
                "rejected",
                "canceled"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvitationList"
                }
              }
            },
            "description": "Invitations"
          }
        },
        "summary": "Invitations (staff onboarding and invited customers)",
        "tags": [
          "admin"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "iam.staff.manage"
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InvitationCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invitation"
                }
              }
            },
            "description": "Invited"
          }
        },
        "summary": "Invite by email: a staff role within your grant boundary, or customer",
        "tags": [
          "admin"
        ],
        "x-audit": "iam.invitation.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "iam.staff.manage",
        "x-reauth": true
      }
    },
    "/api/v1/admin/invitations/{id}/cancel": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Invitation"
                }
              }
            },
            "description": "Canceled"
          }
        },
        "summary": "Cancel a pending invitation",
        "tags": [
          "admin"
        ],
        "x-audit": "iam.invitation.cancel",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "iam.staff.manage"
      }
    },
    "/api/v1/admin/jobs": {
      "get": {
        "parameters": [
          {
            "description": "Job status; repeat the parameter for several values",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "pending",
                    "running",
                    "succeeded",
                    "dead",
                    "cancelled"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "pending",
                      "running",
                      "succeeded",
                      "dead",
                      "cancelled"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Job status; repeat the parameter for several values"
            }
          },
          {
            "in": "query",
            "name": "queue",
            "required": false,
            "schema": {
              "enum": [
                "default",
                "heavy"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "maxLength": 100,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "dedupe_key",
            "required": false,
            "schema": {
              "maxLength": 200,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Created at or after (inclusive)",
            "in": "query",
            "name": "created_from",
            "required": false,
            "schema": {
              "description": "Created at or after (inclusive)",
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Created before (exclusive)",
            "in": "query",
            "name": "created_to",
            "required": false,
            "schema": {
              "description": "Created before (exclusive)",
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Return `total` (first page only)",
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "description": "Return `total` (first page only)",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobPage"
                }
              }
            },
            "description": "A page of jobs"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid filter or cursor"
          }
        },
        "summary": "List jobs (newest first)",
        "tags": [
          "ops"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "ops.job.read"
      }
    },
    "/api/v1/admin/jobs/stats": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobStats"
                }
              }
            },
            "description": "Current gauges and failure/supersede occurrences within the last hour"
          }
        },
        "summary": "Job statistics per queue and kind",
        "tags": [
          "ops"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "ops.job.read",
        "x-reauth": false
      }
    },
    "/api/v1/admin/jobs/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "example": "42",
              "pattern": "^[1-9]\\d{0,15}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobDetail"
                }
              }
            },
            "description": "The job"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such job"
          }
        },
        "summary": "Job detail with the redacted payload",
        "tags": [
          "ops"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "ops.job.read"
      }
    },
    "/api/v1/admin/jobs/{id}/cancel": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "example": "42",
              "pattern": "^[1-9]\\d{0,15}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobDetail"
                }
              }
            },
            "description": "The cancelled job"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such job"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "system.job_not_cancellable: the job is running or finished"
          }
        },
        "summary": "Cancel a pending or dead job",
        "tags": [
          "ops"
        ],
        "x-audit": "ops.job.cancel",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional",
        "x-permission": "ops.job.manage"
      }
    },
    "/api/v1/admin/jobs/{id}/replay": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "example": "42",
              "pattern": "^[1-9]\\d{0,15}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JobReplayResult"
                }
              }
            },
            "description": "Requeued, or cancelled as superseded"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such job"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "system.job_not_replayable: the job is not dead"
          }
        },
        "summary": "Replay a dead job (dead → pending, attempts reset)",
        "tags": [
          "ops"
        ],
        "x-audit": "ops.job.replay",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional",
        "x-permission": "ops.job.manage"
      }
    },
    "/api/v1/admin/keys/inventory": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "old_version",
            "required": false,
            "schema": {
              "exclusiveMinimum": 0,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MasterKeyInventory"
                }
              }
            },
            "description": "Coherent database snapshot; excludes offline backups"
          }
        },
        "summary": "Inventory every master-key envelope and live hardware HMAC dependency",
        "tags": [
          "ops"
        ],
        "x-audit": "ops.keys.inventory",
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "ops.job.read",
        "x-reauth": true
      }
    },
    "/api/v1/admin/keys/reencrypt": {
      "post": {
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "job_id": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "job_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "First rotation batch enqueued"
          }
        },
        "summary": "Start bounded resumable global re-encryption; progress is available in the job console",
        "tags": [
          "ops"
        ],
        "x-audit": "ops.keys.reencrypt",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required",
        "x-permission": "ops.job.manage",
        "x-reauth": true
      }
    },
    "/api/v1/admin/logs": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "level",
            "required": false,
            "schema": {
              "enum": [
                "debug",
                "info",
                "warn",
                "error"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "from_at",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "to_at",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "keyword",
            "required": false,
            "schema": {
              "maxLength": 256,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "request_id",
            "required": false,
            "schema": {
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{7,127}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "source",
            "required": false,
            "schema": {
              "pattern": "^[A-Za-z0-9._:-]{1,128}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "instance_id",
            "required": false,
            "schema": {
              "pattern": "^[A-Za-z0-9._:-]{1,128}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "maxLength": 1024,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "dashboard_prefill_verified": {
                      "enum": [
                        false
                      ],
                      "type": "boolean"
                    },
                    "dashboard_url": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "filter_context": {
                      "additionalProperties": {
                        "type": "string"
                      },
                      "type": "object"
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "additionalProperties": {},
                        "properties": {
                          "instance_id": {
                            "type": "string"
                          },
                          "level": {
                            "enum": [
                              "debug",
                              "info",
                              "warn",
                              "error"
                            ],
                            "type": "string"
                          },
                          "msg": {
                            "type": "string"
                          },
                          "request_id": {
                            "type": "string"
                          },
                          "source": {
                            "type": "string"
                          },
                          "time": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "time",
                          "level",
                          "msg",
                          "source",
                          "instance_id"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "mode": {
                      "enum": [
                        "selfhost",
                        "workers",
                        "disabled"
                      ],
                      "type": "string"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "scan_limit_reached": {
                      "type": "boolean"
                    },
                    "scanned_bytes": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "request_id",
                    "mode",
                    "items",
                    "next_cursor",
                    "has_more",
                    "scanned_bytes",
                    "scan_limit_reached",
                    "dashboard_url",
                    "dashboard_prefill_verified",
                    "filter_context"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Runtime logs, newest write first"
          }
        },
        "summary": "Search bounded local runtime logs or open Workers Logs",
        "tags": [
          "ops"
        ],
        "x-audit": "ops.logs.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "ops.logs.read",
        "x-rate-limit": "ops.logs.read",
        "x-reauth": false
      }
    },
    "/api/v1/admin/maintenance": {
      "put": {
        "parameters": [
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "reason": {
                    "maxLength": 500,
                    "minLength": 10,
                    "type": "string"
                  },
                  "retry_after_seconds": {
                    "maximum": 86400,
                    "minimum": 1,
                    "type": "integer"
                  }
                },
                "required": [
                  "enabled",
                  "retry_after_seconds",
                  "reason"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MaintenanceState"
                }
              }
            },
            "description": "Updated switch",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Concurrent change"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "Freeze or resume writes and background work",
        "tags": [
          "ops"
        ],
        "x-audit": "platform.maintenance.set",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "system.maintenance.manage",
        "x-reauth": true
      }
    },
    "/api/v1/admin/marketing/import-csv": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "csv": {
                    "maxLength": 1048576,
                    "type": "string"
                  },
                  "marketing": {
                    "default": true,
                    "type": "boolean"
                  }
                },
                "required": [
                  "csv"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "audience": {
                      "properties": {
                        "emails": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "type": {
                          "enum": [
                            "list"
                          ],
                          "type": "string"
                        },
                        "user_ids": {
                          "items": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "type": "array"
                        }
                      },
                      "required": [
                        "type",
                        "user_ids",
                        "emails"
                      ],
                      "type": "object"
                    },
                    "report": {
                      "items": {
                        "properties": {
                          "row": {
                            "type": "number"
                          },
                          "status": {
                            "enum": [
                              "accepted",
                              "invalid",
                              "unknown",
                              "duplicate",
                              "unsubscribed"
                            ],
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "row",
                          "value",
                          "status"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "audience",
                    "report"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Audience and per-row validation"
          }
        },
        "summary": "Validate CSV targets",
        "tags": [
          "marketing"
        ],
        "x-audit": "marketing.import_csv",
        "x-body": "json",
        "x-body-limit": 1048576,
        "x-idempotency": "optional",
        "x-permission": "ops.bulk.manage",
        "x-rate-limit": "marketing.preview"
      }
    },
    "/api/v1/admin/marketing/preview": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "body": {
                    "maxLength": 50000,
                    "minLength": 1,
                    "type": "string"
                  },
                  "locale": {
                    "enum": [
                      "en-US",
                      "zh-CN"
                    ],
                    "type": "string"
                  },
                  "subject": {
                    "maxLength": 200,
                    "minLength": 1,
                    "pattern": "^[^\\r\\n]+$",
                    "type": "string"
                  }
                },
                "required": [
                  "subject",
                  "body",
                  "locale"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "html": {
                      "type": "string"
                    },
                    "subject": {
                      "type": "string"
                    },
                    "text": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "subject",
                    "text",
                    "html"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Rendered template"
          }
        },
        "summary": "Render a broadcast without sending",
        "tags": [
          "marketing"
        ],
        "x-audit": "marketing.preview",
        "x-body": "json",
        "x-body-limit": 1048576,
        "x-idempotency": "optional",
        "x-permission": "ops.bulk.manage",
        "x-rate-limit": "marketing.preview"
      }
    },
    "/api/v1/admin/me": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminMe"
                }
              }
            },
            "description": "Staff session"
          }
        },
        "summary": "Signed-in staff member: roles, permission codes, MFA state, permissions ETag (open before MFA)",
        "tags": [
          "admin"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/admin/network/inbounds/{id}": {
      "delete": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such inbound"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "network.inbound_in_use (details.node_count) or common.version_conflict"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Delete an inbound that has no nodes (If-Match)",
        "tags": [
          "network"
        ],
        "x-audit": "network.inbound.delete",
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "network.inbound.manage"
      },
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkInbound"
                }
              }
            },
            "description": "The inbound",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such inbound"
          }
        },
        "summary": "One inbound (secrets as { \"set\": true }), with ETag",
        "tags": [
          "network"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "network.server.read"
      },
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NetworkInboundInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkInbound"
                }
              }
            },
            "description": "The inbound, with ETag"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such server or inbound"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "network.port_conflict, network.server_retired or common.version_conflict"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "network.protocol_params_invalid or common.validation_failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Replace an inbound (If-Match)",
        "tags": [
          "network"
        ],
        "x-audit": "network.inbound.update",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "optional",
        "x-permission": "network.inbound.manage"
      }
    },
    "/api/v1/admin/network/inbounds/{id}/secret": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkInboundSecrets"
                }
              }
            },
            "description": "Secrets by parameter path"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such inbound"
          }
        },
        "summary": "Plaintext secrets of an inbound (re-authentication within 10 minutes; audited)",
        "tags": [
          "network"
        ],
        "x-audit": "network.inbound.read_secret",
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "network.inbound.read_secret",
        "x-reauth": true
      }
    },
    "/api/v1/admin/network/inbounds/{id}/status": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NetworkInboundStatusInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkInbound"
                }
              }
            },
            "description": "The inbound, with ETag",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such server or inbound"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "network.port_conflict, network.server_retired or common.version_conflict"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "network.protocol_params_invalid or common.validation_failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Enable or disable an inbound (If-Match)",
        "tags": [
          "network"
        ],
        "x-audit": "network.inbound.status",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "network.inbound.manage"
      }
    },
    "/api/v1/admin/network/multipliers": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "rules": {
                      "additionalProperties": false,
                      "properties": {
                        "global": {
                          "items": {
                            "additionalProperties": false,
                            "properties": {
                              "days": {
                                "items": {
                                  "maximum": 6,
                                  "minimum": 0,
                                  "type": "integer"
                                },
                                "maxItems": 7,
                                "minItems": 1,
                                "type": "array"
                              },
                              "end": {
                                "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                                "type": "string"
                              },
                              "id": {
                                "pattern": "^[a-zA-Z0-9_-]{1,64}$",
                                "type": "string"
                              },
                              "multiplier_bps": {
                                "maximum": 1000000,
                                "minimum": 1,
                                "type": "integer"
                              },
                              "priority": {
                                "maximum": 1000,
                                "minimum": 0,
                                "type": "integer"
                              },
                              "start": {
                                "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "days",
                              "start",
                              "end",
                              "multiplier_bps",
                              "priority"
                            ],
                            "type": "object"
                          },
                          "maxItems": 100,
                          "type": "array"
                        },
                        "inbounds": {
                          "additionalProperties": {
                            "items": {
                              "additionalProperties": false,
                              "properties": {
                                "days": {
                                  "items": {
                                    "maximum": 6,
                                    "minimum": 0,
                                    "type": "integer"
                                  },
                                  "maxItems": 7,
                                  "minItems": 1,
                                  "type": "array"
                                },
                                "end": {
                                  "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                                  "type": "string"
                                },
                                "id": {
                                  "pattern": "^[a-zA-Z0-9_-]{1,64}$",
                                  "type": "string"
                                },
                                "multiplier_bps": {
                                  "maximum": 1000000,
                                  "minimum": 1,
                                  "type": "integer"
                                },
                                "priority": {
                                  "maximum": 1000,
                                  "minimum": 0,
                                  "type": "integer"
                                },
                                "start": {
                                  "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "days",
                                "start",
                                "end",
                                "multiplier_bps",
                                "priority"
                              ],
                              "type": "object"
                            },
                            "maxItems": 100,
                            "type": "array"
                          },
                          "type": "object"
                        }
                      },
                      "required": [
                        "global",
                        "inbounds"
                      ],
                      "type": "object"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "rules",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Rules; weekdays start on Sunday",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Versioned time-of-day traffic rules",
        "tags": [
          "network"
        ],
        "x-audit": "network.multiplier.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-idempotency": "none",
        "x-permission": "network.server.read",
        "x-rate-limit": "network.multiplier.read",
        "x-reauth": false
      },
      "put": {
        "parameters": [
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "rules": {
                    "additionalProperties": false,
                    "properties": {
                      "global": {
                        "items": {
                          "additionalProperties": false,
                          "properties": {
                            "days": {
                              "items": {
                                "maximum": 6,
                                "minimum": 0,
                                "type": "integer"
                              },
                              "maxItems": 7,
                              "minItems": 1,
                              "type": "array"
                            },
                            "end": {
                              "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                              "type": "string"
                            },
                            "id": {
                              "pattern": "^[a-zA-Z0-9_-]{1,64}$",
                              "type": "string"
                            },
                            "multiplier_bps": {
                              "maximum": 1000000,
                              "minimum": 1,
                              "type": "integer"
                            },
                            "priority": {
                              "maximum": 1000,
                              "minimum": 0,
                              "type": "integer"
                            },
                            "start": {
                              "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                              "type": "string"
                            }
                          },
                          "required": [
                            "id",
                            "days",
                            "start",
                            "end",
                            "multiplier_bps",
                            "priority"
                          ],
                          "type": "object"
                        },
                        "maxItems": 100,
                        "type": "array"
                      },
                      "inbounds": {
                        "additionalProperties": {
                          "items": {
                            "additionalProperties": false,
                            "properties": {
                              "days": {
                                "items": {
                                  "maximum": 6,
                                  "minimum": 0,
                                  "type": "integer"
                                },
                                "maxItems": 7,
                                "minItems": 1,
                                "type": "array"
                              },
                              "end": {
                                "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                                "type": "string"
                              },
                              "id": {
                                "pattern": "^[a-zA-Z0-9_-]{1,64}$",
                                "type": "string"
                              },
                              "multiplier_bps": {
                                "maximum": 1000000,
                                "minimum": 1,
                                "type": "integer"
                              },
                              "priority": {
                                "maximum": 1000,
                                "minimum": 0,
                                "type": "integer"
                              },
                              "start": {
                                "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "days",
                              "start",
                              "end",
                              "multiplier_bps",
                              "priority"
                            ],
                            "type": "object"
                          },
                          "maxItems": 100,
                          "type": "array"
                        },
                        "type": "object"
                      }
                    },
                    "required": [
                      "global",
                      "inbounds"
                    ],
                    "type": "object"
                  }
                },
                "required": [
                  "rules"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "rules": {
                      "additionalProperties": false,
                      "properties": {
                        "global": {
                          "items": {
                            "additionalProperties": false,
                            "properties": {
                              "days": {
                                "items": {
                                  "maximum": 6,
                                  "minimum": 0,
                                  "type": "integer"
                                },
                                "maxItems": 7,
                                "minItems": 1,
                                "type": "array"
                              },
                              "end": {
                                "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                                "type": "string"
                              },
                              "id": {
                                "pattern": "^[a-zA-Z0-9_-]{1,64}$",
                                "type": "string"
                              },
                              "multiplier_bps": {
                                "maximum": 1000000,
                                "minimum": 1,
                                "type": "integer"
                              },
                              "priority": {
                                "maximum": 1000,
                                "minimum": 0,
                                "type": "integer"
                              },
                              "start": {
                                "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                                "type": "string"
                              }
                            },
                            "required": [
                              "id",
                              "days",
                              "start",
                              "end",
                              "multiplier_bps",
                              "priority"
                            ],
                            "type": "object"
                          },
                          "maxItems": 100,
                          "type": "array"
                        },
                        "inbounds": {
                          "additionalProperties": {
                            "items": {
                              "additionalProperties": false,
                              "properties": {
                                "days": {
                                  "items": {
                                    "maximum": 6,
                                    "minimum": 0,
                                    "type": "integer"
                                  },
                                  "maxItems": 7,
                                  "minItems": 1,
                                  "type": "array"
                                },
                                "end": {
                                  "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                                  "type": "string"
                                },
                                "id": {
                                  "pattern": "^[a-zA-Z0-9_-]{1,64}$",
                                  "type": "string"
                                },
                                "multiplier_bps": {
                                  "maximum": 1000000,
                                  "minimum": 1,
                                  "type": "integer"
                                },
                                "priority": {
                                  "maximum": 1000,
                                  "minimum": 0,
                                  "type": "integer"
                                },
                                "start": {
                                  "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$",
                                  "type": "string"
                                }
                              },
                              "required": [
                                "id",
                                "days",
                                "start",
                                "end",
                                "multiplier_bps",
                                "priority"
                              ],
                              "type": "object"
                            },
                            "maxItems": 100,
                            "type": "array"
                          },
                          "type": "object"
                        }
                      },
                      "required": [
                        "global",
                        "inbounds"
                      ],
                      "type": "object"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "rules",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Saved rules",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Inbound not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current)"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid rules"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Replace time-of-day traffic rules",
        "tags": [
          "network"
        ],
        "x-audit": "network.multiplier.update",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "network.runtime.manage",
        "x-rate-limit": "network.multiplier.write",
        "x-reauth": false
      }
    },
    "/api/v1/admin/network/multipliers/preview": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "inbound_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "at",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "base_multiplier": {
                      "type": "string"
                    },
                    "effective_multiplier": {
                      "type": "string"
                    },
                    "inbound_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "multiplier_bps": {
                      "type": "integer"
                    },
                    "rule_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "rule_version": {
                      "type": "integer"
                    },
                    "scope": {
                      "enum": [
                        "inbound",
                        "global",
                        "default"
                      ],
                      "type": "string"
                    },
                    "timezone": {
                      "type": "string"
                    },
                    "windows": {
                      "items": {
                        "properties": {
                          "days": {
                            "items": {
                              "type": "integer"
                            },
                            "type": "array"
                          },
                          "effective_multiplier": {
                            "type": "string"
                          },
                          "end": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "multiplier_bps": {
                            "type": "integer"
                          },
                          "priority": {
                            "type": "integer"
                          },
                          "scope": {
                            "enum": [
                              "inbound",
                              "global"
                            ],
                            "type": "string"
                          },
                          "start": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "days",
                          "start",
                          "end",
                          "multiplier_bps",
                          "priority",
                          "scope",
                          "effective_multiplier"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "inbound_id",
                    "at",
                    "timezone",
                    "rule_version",
                    "base_multiplier",
                    "multiplier_bps",
                    "rule_id",
                    "scope",
                    "effective_multiplier",
                    "windows"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Effective multiplier and windows"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Inbound not found"
          }
        },
        "summary": "Effective multiplier now or at an explicit instant",
        "tags": [
          "network"
        ],
        "x-audit": "network.multiplier.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "network.server.read",
        "x-rate-limit": "network.multiplier.read",
        "x-reauth": false
      }
    },
    "/api/v1/admin/network/nodes": {
      "get": {
        "parameters": [
          {
            "description": "Name or connect host contains",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "description": "Name or connect host contains",
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "server_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "inbound_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Manual tag the node carries",
            "in": "query",
            "name": "tag",
            "required": false,
            "schema": {
              "description": "Manual tag the node carries",
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Visibility; repeat the parameter for several values",
            "in": "query",
            "name": "visibility",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "visible",
                    "hidden",
                    "disabled"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "visible",
                      "hidden",
                      "disabled"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Visibility; repeat the parameter for several values"
            }
          },
          {
            "description": "Kind; repeat the parameter for several values",
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "direct",
                    "relay",
                    "cdn"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "direct",
                      "relay",
                      "cdn"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Kind; repeat the parameter for several values"
            }
          },
          {
            "description": "Address family; repeat the parameter for several values",
            "in": "query",
            "name": "address_family",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "ipv4",
                    "ipv6",
                    "dual"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "ipv4",
                      "ipv6",
                      "dual"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Address family; repeat the parameter for several values"
            }
          },
          {
            "in": "query",
            "name": "region_code",
            "required": false,
            "schema": {
              "pattern": "^[a-z][a-z0-9-]{0,31}$",
              "type": "string"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Return `total` (first page only)",
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "description": "Return `total` (first page only)",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkNodePage"
                }
              }
            },
            "description": "A page of nodes"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid filter or cursor"
          }
        },
        "summary": "List nodes (sort, id order)",
        "tags": [
          "network"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "network.server.read"
      },
      "post": {
        "parameters": [
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NetworkNodeInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkNode"
                }
              }
            },
            "description": "The node, with ETag"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such node or inbound"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "network.server_retired or common.version_conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "network.tag_invalid or common.validation_failed"
          }
        },
        "summary": "Create a node",
        "tags": [
          "network"
        ],
        "x-audit": "network.node.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "network.node.manage"
      }
    },
    "/api/v1/admin/network/nodes/reorder": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NetworkNodeReorderInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkNodeReorderResult"
                }
              }
            },
            "description": "Updated count"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          }
        },
        "summary": "Set the order of nodes",
        "tags": [
          "network"
        ],
        "x-audit": "network.node.reorder",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "optional",
        "x-permission": "network.node.manage"
      }
    },
    "/api/v1/admin/network/nodes/tags": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NetworkNodeTagsInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkNodeTagsResult"
                }
              }
            },
            "description": "Nodes whose tags changed"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "network.tag_invalid or common.validation_failed"
          }
        },
        "summary": "Add or remove manual tags on many nodes",
        "tags": [
          "network"
        ],
        "x-audit": "network.node.tags",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "optional",
        "x-permission": "network.node.manage"
      }
    },
    "/api/v1/admin/network/nodes/{id}": {
      "delete": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such node"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current)"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Delete a node (If-Match)",
        "tags": [
          "network"
        ],
        "x-audit": "network.node.delete",
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "network.node.manage"
      },
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkNode"
                }
              }
            },
            "description": "The node",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such node"
          }
        },
        "summary": "One node, with ETag",
        "tags": [
          "network"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "network.server.read"
      },
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NetworkNodeInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkNode"
                }
              }
            },
            "description": "The node, with ETag"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such node or inbound"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "network.server_retired or common.version_conflict"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "network.tag_invalid or common.validation_failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Replace a node (If-Match)",
        "tags": [
          "network"
        ],
        "x-audit": "network.node.update",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "optional",
        "x-permission": "network.node.manage"
      }
    },
    "/api/v1/admin/network/protocols": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkProtocolList"
                }
              }
            },
            "description": "Protocols"
          }
        },
        "summary": "Protocol catalogue for the inbound forms",
        "tags": [
          "network"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "network.server.read"
      }
    },
    "/api/v1/admin/network/runtime": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkRuntimeDefaults"
                }
              }
            },
            "description": "Runtime defaults",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Runtime defaults of every server, with ETag",
        "tags": [
          "network"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "network.server.read"
      },
      "put": {
        "parameters": [
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NetworkRuntimeDefaultsInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkRuntimeDefaults"
                }
              }
            },
            "description": "Saved defaults, with ETag",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current)"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Replace the runtime defaults (If-Match); servers re-render their desired config",
        "tags": [
          "network"
        ],
        "x-audit": "network.runtime.update",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "network.runtime.manage"
      }
    },
    "/api/v1/admin/network/servers": {
      "get": {
        "parameters": [
          {
            "description": "Name or address contains",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "description": "Name or address contains",
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Status; repeat the parameter for several values",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "active",
                    "maintenance",
                    "retired"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "active",
                      "maintenance",
                      "retired"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Status; repeat the parameter for several values"
            }
          },
          {
            "description": "Health; repeat the parameter for several values",
            "in": "query",
            "name": "health",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "unknown",
                    "healthy",
                    "degraded",
                    "offline",
                    "config_drift",
                    "auth_failed",
                    "protocol_conflict"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "unknown",
                      "healthy",
                      "degraded",
                      "offline",
                      "config_drift",
                      "auth_failed",
                      "protocol_conflict"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Health; repeat the parameter for several values"
            }
          },
          {
            "in": "query",
            "name": "region_code",
            "required": false,
            "schema": {
              "pattern": "^[a-z][a-z0-9-]{0,31}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "ip_geo_status",
            "required": false,
            "schema": {
              "enum": [
                "ok",
                "unresolved",
                "manual"
              ],
              "type": "string"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Return `total` (first page only)",
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "description": "Return `total` (first page only)",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkServerPage"
                }
              }
            },
            "description": "A page of servers"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid filter or cursor"
          }
        },
        "summary": "List servers (sort, id order)",
        "tags": [
          "network"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "network.server.read"
      },
      "post": {
        "parameters": [
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NetworkServerInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkServer"
                }
              }
            },
            "description": "The server, with ETag",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          }
        },
        "summary": "Create a server (renders desired config revision 1)",
        "tags": [
          "network"
        ],
        "x-audit": "network.server.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true
        },
        "x-idempotency": "required",
        "x-permission": "network.server.manage"
      }
    },
    "/api/v1/admin/network/servers/{id}": {
      "delete": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkServer"
                }
              }
            },
            "description": "The retired server",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such server"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict or network.server_retired"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Retire a server (If-Match): terminal; its nodes stop authorizing anyone",
        "tags": [
          "network"
        ],
        "x-audit": "network.server.retire",
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "network.server.manage"
      },
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkServer"
                }
              }
            },
            "description": "The server",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such server"
          }
        },
        "summary": "One server, with ETag",
        "tags": [
          "network"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "network.server.read"
      },
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NetworkServerInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkServer"
                }
              }
            },
            "description": "The server, with ETag",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such server"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict or network.server_retired"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Edit a server (If-Match): name, location, address, active ⇄ maintenance, order",
        "tags": [
          "network"
        ],
        "x-audit": "network.server.update",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "network.server.manage"
      }
    },
    "/api/v1/admin/network/servers/{id}/config": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkServerConfig"
                }
              }
            },
            "description": "Configuration",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such server"
          }
        },
        "summary": "Runtime configuration and desired config preview (secrets masked)",
        "tags": [
          "network"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "network.server.read"
      }
    },
    "/api/v1/admin/network/servers/{id}/create-ipv6-node": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Only these IPv4 nodes; default every direct IPv4 node of the server",
            "in": "query",
            "name": "node_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "uuid",
                  "type": "string"
                },
                {
                  "items": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "maxItems": 500,
                  "type": "array"
                }
              ],
              "description": "Only these IPv4 nodes; default every direct IPv4 node of the server"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkNodeList"
                }
              }
            },
            "description": "Created nodes"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such server"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "network.server_retired, network.agent_not_active or network.ipv6_unavailable"
          }
        },
        "summary": "Create IPv6 twins of the direct IPv4 nodes (needs a reported IPv6 address)",
        "tags": [
          "network"
        ],
        "x-audit": "network.node.create_ipv6",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required",
        "x-permission": "network.node.manage"
      }
    },
    "/api/v1/admin/network/servers/{id}/disable-agent": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkServer"
                }
              }
            },
            "description": "The server"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such server"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "network.server_retired, network.agent_not_active or network.ipv6_unavailable"
          }
        },
        "summary": "Disable the agent (node gets 403 node.disabled until it enrolls again)",
        "tags": [
          "network"
        ],
        "x-audit": "network.agent.disable",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required",
        "x-permission": "network.agent.manage"
      }
    },
    "/api/v1/admin/network/servers/{id}/enrollment-token": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkAgentToken"
                }
              }
            },
            "description": "The token (shown once)"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such server"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "network.server_retired, network.agent_not_active or network.ipv6_unavailable"
          }
        },
        "summary": "Issue a one-time enrollment token (1 hour)",
        "tags": [
          "network"
        ],
        "x-audit": "network.agent.enrollment_token",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required",
        "x-permission": "network.agent.manage"
      }
    },
    "/api/v1/admin/network/servers/{id}/geo": {
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "country_code": {
                    "pattern": "^[A-Z]{2}$",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "region_code": {
                    "pattern": "^[a-z][a-z0-9-]{0,31}$",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "country_code",
                  "region_code"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkServer"
                }
              }
            },
            "description": "Server location",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such server"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current)"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid location"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Set a manual server location, protected from automatic GeoIP refresh",
        "tags": [
          "network"
        ],
        "x-audit": "network.server.geo",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "network.server.manage"
      }
    },
    "/api/v1/admin/network/servers/{id}/health": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkServerHealth"
                }
              }
            },
            "description": "Health"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such server"
          }
        },
        "summary": "Server health: stored state and the live verdict with reasons",
        "tags": [
          "network"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "network.server.read"
      }
    },
    "/api/v1/admin/network/servers/{id}/inbounds": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkInboundList"
                }
              }
            },
            "description": "Inbounds"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such server"
          }
        },
        "summary": "A server's inbounds",
        "tags": [
          "network"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "network.server.read"
      },
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NetworkInboundInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkInbound"
                }
              }
            },
            "description": "The inbound, with ETag"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such server or inbound"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "network.port_conflict, network.server_retired or common.version_conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "network.protocol_params_invalid or common.validation_failed"
          }
        },
        "summary": "Create an inbound; the desired config is re-rendered in the same transaction",
        "tags": [
          "network"
        ],
        "x-audit": "network.inbound.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "network.inbound.manage"
      }
    },
    "/api/v1/admin/network/servers/{id}/republish": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkRepublish"
                }
              }
            },
            "description": "Render result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such server"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "network.server_retired, network.agent_not_active or network.ipv6_unavailable"
          }
        },
        "summary": "Re-render the desired config now",
        "tags": [
          "network"
        ],
        "x-audit": "network.agent.republish",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required",
        "x-permission": "network.agent.manage"
      }
    },
    "/api/v1/admin/network/servers/{id}/rotate-agent-token": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Revoke immediately (token leaked); default false keeps the 10-minute overlap",
            "in": "query",
            "name": "immediate",
            "required": false,
            "schema": {
              "default": "false",
              "description": "Revoke immediately (token leaked); default false keeps the 10-minute overlap",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkAgentToken"
                }
              }
            },
            "description": "The new token (shown once); expires_at is the previous token cut-off time"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "auth.forbidden or auth.reauth_required"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such server"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "network.server_retired, network.agent_not_active or network.ipv6_unavailable"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid immediate option"
          }
        },
        "summary": "Rotate the agent token (10-minute overlap unless immediate revocation is selected)",
        "tags": [
          "network"
        ],
        "x-audit": "network.agent.rotate_token",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required",
        "x-permission": "network.agent.manage",
        "x-reauth": true
      }
    },
    "/api/v1/admin/network/servers/{id}/runtime": {
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NetworkRuntimeOverridesInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkServerConfig"
                }
              }
            },
            "description": "Configuration, with the server ETag",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such server"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict or network.server_retired"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed (e.g. a rule names an unknown outbound)"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Replace the runtime override patch (If-Match = server ETag); re-renders the desired config",
        "tags": [
          "network"
        ],
        "x-audit": "network.server.runtime_update",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "network.runtime.manage"
      }
    },
    "/api/v1/admin/network/servers/{id}/stats": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Business date (inclusive); default 29 days before date_to",
            "in": "query",
            "name": "date_from",
            "required": false,
            "schema": {
              "description": "Business date (inclusive); default 29 days before date_to",
              "example": "2026-10-22",
              "format": "date",
              "type": "string"
            }
          },
          {
            "description": "Business date (inclusive); default today",
            "in": "query",
            "name": "date_to",
            "required": false,
            "schema": {
              "description": "Business date (inclusive); default today",
              "example": "2026-10-22",
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkServerStats"
                }
              }
            },
            "description": "Statistics"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such server"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid range"
          }
        },
        "summary": "Daily load and speed statistics (business dates)",
        "tags": [
          "network"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "network.server.read"
      }
    },
    "/api/v1/admin/network/tags": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkTagList"
                }
              }
            },
            "description": "Tags"
          }
        },
        "summary": "Tag summary: manual tags (nodes, plans, active subscriptions) and system tags",
        "tags": [
          "network"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "network.server.read"
      }
    },
    "/api/v1/admin/network/tags/impact": {
      "get": {
        "parameters": [
          {
            "description": "Tags to inspect; repeat the parameter for several",
            "in": "query",
            "name": "tags",
            "required": true,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 128,
                  "type": "string"
                },
                {
                  "items": {
                    "maxLength": 128,
                    "type": "string"
                  },
                  "maxItems": 64,
                  "type": "array"
                }
              ],
              "description": "Tags to inspect; repeat the parameter for several"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkTagImpact"
                }
              }
            },
            "description": "Counts per tag"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          }
        },
        "summary": "What renaming or merging these tags would touch",
        "tags": [
          "network"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "network.server.read"
      }
    },
    "/api/v1/admin/network/tags/merge": {
      "post": {
        "parameters": [
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NetworkTagMergeInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkTagChange"
                }
              }
            },
            "description": "What changed"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "auth.forbidden: catalog.plan.manage is also required"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "network.tag_invalid (system tag shape, unknown source, existing target for a rename)"
          }
        },
        "summary": "Merge tags into one on nodes, plans and subscriptions in one transaction",
        "tags": [
          "network"
        ],
        "x-audit": "network.tag.merge",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "network.node.manage"
      }
    },
    "/api/v1/admin/network/tags/rename": {
      "post": {
        "parameters": [
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NetworkTagRenameInput"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NetworkTagChange"
                }
              }
            },
            "description": "What changed"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "auth.forbidden: catalog.plan.manage is also required"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "network.tag_invalid (system tag shape, unknown source, existing target for a rename)"
          }
        },
        "summary": "Rename a tag on nodes, plans and subscriptions in one transaction",
        "tags": [
          "network"
        ],
        "x-audit": "network.tag.rename",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "network.node.manage"
      }
    },
    "/api/v1/admin/notify/deliveries": {
      "get": {
        "parameters": [
          {
            "description": "Delivery status; repeat the parameter for several values",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "pending",
                    "sending",
                    "sent",
                    "failed",
                    "suppressed",
                    "dead"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "pending",
                      "sending",
                      "sent",
                      "failed",
                      "suppressed",
                      "dead"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Delivery status; repeat the parameter for several values"
            }
          },
          {
            "in": "query",
            "name": "template_key",
            "required": false,
            "schema": {
              "maxLength": 100,
              "pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*){1,3}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "event_key",
            "required": false,
            "schema": {
              "maxLength": 200,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "recipient_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Exact recipient address (matched by hash)",
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "description": "Exact recipient address (matched by hash)",
              "format": "email",
              "maxLength": 254,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "channel",
            "required": false,
            "schema": {
              "enum": [
                "email",
                "sms",
                "telegram",
                "inbox"
              ],
              "type": "string"
            }
          },
          {
            "description": "Created at or after (inclusive)",
            "in": "query",
            "name": "created_from",
            "required": false,
            "schema": {
              "description": "Created at or after (inclusive)",
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Created before (exclusive)",
            "in": "query",
            "name": "created_to",
            "required": false,
            "schema": {
              "description": "Created before (exclusive)",
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Return `total` (first page only)",
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "description": "Return `total` (first page only)",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotifyDeliveryPage"
                }
              }
            },
            "description": "A page of deliveries"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid filter or cursor"
          }
        },
        "summary": "List deliveries (newest first, masked targets)",
        "tags": [
          "notify"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "notify.delivery.read"
      }
    },
    "/api/v1/admin/notify/deliveries/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotifyDeliveryDetail"
                }
              }
            },
            "description": "The delivery"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such delivery"
          }
        },
        "summary": "Delivery detail with masked values",
        "tags": [
          "notify"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "notify.delivery.read"
      }
    },
    "/api/v1/admin/notify/deliveries/{id}/retry": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotifyDeliveryDetail"
                }
              }
            },
            "description": "The delivery, pending again"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such delivery"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "notify.delivery_not_retryable"
          }
        },
        "summary": "Retry a failed or dead delivery (back to pending with a fresh attempt budget)",
        "tags": [
          "notify"
        ],
        "x-audit": "notify.delivery.retry",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional",
        "x-permission": "notify.delivery.retry"
      }
    },
    "/api/v1/admin/notify/digest-preview": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "billed_bytes": {
                      "type": "string"
                    },
                    "business_date": {
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    },
                    "orders": {
                      "type": "integer"
                    },
                    "paid_minor": {
                      "type": "string"
                    },
                    "registered_users": {
                      "type": "integer"
                    },
                    "time_zone": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "business_date",
                    "time_zone",
                    "currency",
                    "orders",
                    "paid_minor",
                    "registered_users",
                    "billed_bytes",
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Daily digest"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Permission required"
          }
        },
        "summary": "Preview the previous business day operations digest",
        "tags": [
          "notification-center"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "notify.provider.manage",
        "x-rate-limit": "notify.center",
        "x-reauth": false
      }
    },
    "/api/v1/admin/notify/templates": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "key",
            "required": false,
            "schema": {
              "maxLength": 100,
              "pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*){1,3}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "channel",
            "required": false,
            "schema": {
              "enum": [
                "email",
                "sms",
                "telegram",
                "inbox"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "locale",
            "required": false,
            "schema": {
              "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotifyTemplateList"
                }
              }
            },
            "description": "Templates"
          }
        },
        "summary": "List notification templates (built-in texts and saved locales)",
        "tags": [
          "notify"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "notify.template.manage"
      }
    },
    "/api/v1/admin/notify/templates/{key}/{channel}/{locale}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "required": true,
            "schema": {
              "example": "commerce.order.fulfilled",
              "maxLength": 100,
              "pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*){1,3}$",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "channel",
            "required": true,
            "schema": {
              "enum": [
                "email",
                "sms",
                "telegram",
                "inbox"
              ],
              "example": "email",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "locale",
            "required": true,
            "schema": {
              "example": "en-US",
              "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotifyTemplate"
                }
              }
            },
            "description": "The template",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unknown template or locale"
          }
        },
        "summary": "One template locale, with ETag",
        "tags": [
          "notify"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "notify.template.manage"
      },
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "required": true,
            "schema": {
              "example": "commerce.order.fulfilled",
              "maxLength": 100,
              "pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*){1,3}$",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "channel",
            "required": true,
            "schema": {
              "enum": [
                "email",
                "sms",
                "telegram",
                "inbox"
              ],
              "example": "email",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "locale",
            "required": true,
            "schema": {
              "example": "en-US",
              "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NotifyTemplateUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotifyTemplate"
                }
              }
            },
            "description": "Saved template, with ETag",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unknown template, channel or locale"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current)"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "notify.template_invalid or validation failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Save one template locale (If-Match \"v<version>\"; \"v0\" overrides the built-in text or adds a locale)",
        "tags": [
          "notify"
        ],
        "x-audit": "notify.template.update",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "notify.template.manage"
      }
    },
    "/api/v1/admin/notify/test-send": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NotifyTestSend"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotifyTestSendResult"
                }
              }
            },
            "description": "Rendered message and, unless dry_run, every provider attempt"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "auth.forbidden: recipient must be own verified email; other recipients/provider_id need notify.provider.manage"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unknown template"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "notify.template_invalid or validation failed"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.rate_limited: provider managers may make 10 real test-send attempts per hour per actor"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "notify.provider_unavailable: no enabled provider (or no such provider)"
          }
        },
        "summary": "Preview or test-send a template (synchronous; no delivery record)",
        "tags": [
          "notify"
        ],
        "x-audit": "notify.template.test_send",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-idempotency": "none",
        "x-permission": "notify.template.manage"
      }
    },
    "/api/v1/admin/notify/webhook-deliveries": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "endpoint_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "before",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "attempts": {
                            "type": "integer"
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "endpoint_id": {
                            "type": "string"
                          },
                          "event_id": {
                            "type": "string"
                          },
                          "event_type": {
                            "type": "string"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "last_error": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "last_status_code": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "latency_ms": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "next_attempt_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "endpoint_id",
                          "event_id",
                          "event_type",
                          "status",
                          "attempts",
                          "last_status_code",
                          "last_error",
                          "latency_ms",
                          "next_attempt_at",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Webhooks"
        ],
        "x-audit": "notify.webhook.deliveries",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "notify.webhook.manage",
        "x-rate-limit": "notify.webhook.admin",
        "x-reauth": false
      }
    },
    "/api/v1/admin/notify/webhook-deliveries/{id}/retry": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Webhooks"
        ],
        "x-audit": "notify.webhook.replay",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required",
        "x-permission": "notify.webhook.manage",
        "x-rate-limit": "notify.webhook.admin",
        "x-reauth": false
      }
    },
    "/api/v1/admin/notify/webhooks": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "event_types": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "items": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "event_types": {
                            "items": {
                              "enum": [
                                "iam.user.registered",
                                "commerce.order.created",
                                "commerce.order.paid",
                                "commerce.order.closed",
                                "commerce.refund.succeeded",
                                "subscription.subscription.activated",
                                "subscription.subscription.expired",
                                "subscription.subscription.cancelled",
                                "subscription.subscription.suspended",
                                "subscription.subscription.resumed",
                                "subscription.subscription.refunded",
                                "subscription.subscription.exhausted",
                                "subscription.subscription.renewed",
                                "subscription.subscription.reset",
                                "subscription.subscription.plan_changed",
                                "subscription.access.changed"
                              ],
                              "type": "string"
                            },
                            "maxItems": 20,
                            "minItems": 1,
                            "type": "array"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "name": {
                            "maxLength": 100,
                            "minLength": 1,
                            "type": "string"
                          },
                          "paused": {
                            "default": false,
                            "type": "boolean"
                          },
                          "url": {
                            "maxLength": 2048,
                            "type": "string"
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "name",
                          "url",
                          "event_types",
                          "id",
                          "version"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items",
                    "event_types"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Webhooks"
        ],
        "x-audit": "notify.webhook.list",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "notify.webhook.manage",
        "x-rate-limit": "notify.webhook.admin",
        "x-reauth": false
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "event_types": {
                    "items": {
                      "enum": [
                        "iam.user.registered",
                        "commerce.order.created",
                        "commerce.order.paid",
                        "commerce.order.closed",
                        "commerce.refund.succeeded",
                        "subscription.subscription.activated",
                        "subscription.subscription.expired",
                        "subscription.subscription.cancelled",
                        "subscription.subscription.suspended",
                        "subscription.subscription.resumed",
                        "subscription.subscription.refunded",
                        "subscription.subscription.exhausted",
                        "subscription.subscription.renewed",
                        "subscription.subscription.reset",
                        "subscription.subscription.plan_changed",
                        "subscription.access.changed"
                      ],
                      "type": "string"
                    },
                    "maxItems": 20,
                    "minItems": 1,
                    "type": "array"
                  },
                  "name": {
                    "maxLength": 100,
                    "minLength": 1,
                    "type": "string"
                  },
                  "paused": {
                    "default": false,
                    "type": "boolean"
                  },
                  "url": {
                    "maxLength": 2048,
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url",
                  "event_types"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "endpoint": {
                      "additionalProperties": false,
                      "properties": {
                        "event_types": {
                          "items": {
                            "enum": [
                              "iam.user.registered",
                              "commerce.order.created",
                              "commerce.order.paid",
                              "commerce.order.closed",
                              "commerce.refund.succeeded",
                              "subscription.subscription.activated",
                              "subscription.subscription.expired",
                              "subscription.subscription.cancelled",
                              "subscription.subscription.suspended",
                              "subscription.subscription.resumed",
                              "subscription.subscription.refunded",
                              "subscription.subscription.exhausted",
                              "subscription.subscription.renewed",
                              "subscription.subscription.reset",
                              "subscription.subscription.plan_changed",
                              "subscription.access.changed"
                            ],
                            "type": "string"
                          },
                          "maxItems": 20,
                          "minItems": 1,
                          "type": "array"
                        },
                        "id": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "name": {
                          "maxLength": 100,
                          "minLength": 1,
                          "type": "string"
                        },
                        "paused": {
                          "default": false,
                          "type": "boolean"
                        },
                        "url": {
                          "maxLength": 2048,
                          "type": "string"
                        },
                        "version": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "name",
                        "url",
                        "event_types",
                        "id",
                        "version"
                      ],
                      "type": "object"
                    },
                    "secret": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "endpoint",
                    "secret"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Webhooks"
        ],
        "x-audit": "notify.webhook.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-permission": "notify.webhook.manage",
        "x-rate-limit": "notify.webhook.admin",
        "x-reauth": true
      }
    },
    "/api/v1/admin/notify/webhooks/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "event_types": {
                      "items": {
                        "enum": [
                          "iam.user.registered",
                          "commerce.order.created",
                          "commerce.order.paid",
                          "commerce.order.closed",
                          "commerce.refund.succeeded",
                          "subscription.subscription.activated",
                          "subscription.subscription.expired",
                          "subscription.subscription.cancelled",
                          "subscription.subscription.suspended",
                          "subscription.subscription.resumed",
                          "subscription.subscription.refunded",
                          "subscription.subscription.exhausted",
                          "subscription.subscription.renewed",
                          "subscription.subscription.reset",
                          "subscription.subscription.plan_changed",
                          "subscription.access.changed"
                        ],
                        "type": "string"
                      },
                      "maxItems": 20,
                      "minItems": 1,
                      "type": "array"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "name": {
                      "maxLength": 100,
                      "minLength": 1,
                      "type": "string"
                    },
                    "paused": {
                      "default": false,
                      "type": "boolean"
                    },
                    "url": {
                      "maxLength": 2048,
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "name",
                    "url",
                    "event_types",
                    "id",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Webhooks"
        ],
        "x-audit": "notify.webhook.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "notify.webhook.manage",
        "x-rate-limit": "notify.webhook.admin",
        "x-reauth": false
      },
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "event_types": {
                    "items": {
                      "enum": [
                        "iam.user.registered",
                        "commerce.order.created",
                        "commerce.order.paid",
                        "commerce.order.closed",
                        "commerce.refund.succeeded",
                        "subscription.subscription.activated",
                        "subscription.subscription.expired",
                        "subscription.subscription.cancelled",
                        "subscription.subscription.suspended",
                        "subscription.subscription.resumed",
                        "subscription.subscription.refunded",
                        "subscription.subscription.exhausted",
                        "subscription.subscription.renewed",
                        "subscription.subscription.reset",
                        "subscription.subscription.plan_changed",
                        "subscription.access.changed"
                      ],
                      "type": "string"
                    },
                    "maxItems": 20,
                    "minItems": 1,
                    "type": "array"
                  },
                  "name": {
                    "maxLength": 100,
                    "minLength": 1,
                    "type": "string"
                  },
                  "paused": {
                    "default": false,
                    "type": "boolean"
                  },
                  "url": {
                    "maxLength": 2048,
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "url",
                  "event_types"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "event_types": {
                      "items": {
                        "enum": [
                          "iam.user.registered",
                          "commerce.order.created",
                          "commerce.order.paid",
                          "commerce.order.closed",
                          "commerce.refund.succeeded",
                          "subscription.subscription.activated",
                          "subscription.subscription.expired",
                          "subscription.subscription.cancelled",
                          "subscription.subscription.suspended",
                          "subscription.subscription.resumed",
                          "subscription.subscription.refunded",
                          "subscription.subscription.exhausted",
                          "subscription.subscription.renewed",
                          "subscription.subscription.reset",
                          "subscription.subscription.plan_changed",
                          "subscription.access.changed"
                        ],
                        "type": "string"
                      },
                      "maxItems": 20,
                      "minItems": 1,
                      "type": "array"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "name": {
                      "maxLength": 100,
                      "minLength": 1,
                      "type": "string"
                    },
                    "paused": {
                      "default": false,
                      "type": "boolean"
                    },
                    "url": {
                      "maxLength": 2048,
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "name",
                    "url",
                    "event_types",
                    "id",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Webhooks"
        ],
        "x-audit": "notify.webhook.update",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "notify.webhook.manage",
        "x-rate-limit": "notify.webhook.admin",
        "x-reauth": true
      }
    },
    "/api/v1/admin/notify/webhooks/{id}/rotate-secret": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "overlap_seconds": {
                    "default": 3600,
                    "maximum": 86400,
                    "minimum": 0,
                    "type": "integer"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "endpoint": {
                      "additionalProperties": false,
                      "properties": {
                        "event_types": {
                          "items": {
                            "enum": [
                              "iam.user.registered",
                              "commerce.order.created",
                              "commerce.order.paid",
                              "commerce.order.closed",
                              "commerce.refund.succeeded",
                              "subscription.subscription.activated",
                              "subscription.subscription.expired",
                              "subscription.subscription.cancelled",
                              "subscription.subscription.suspended",
                              "subscription.subscription.resumed",
                              "subscription.subscription.refunded",
                              "subscription.subscription.exhausted",
                              "subscription.subscription.renewed",
                              "subscription.subscription.reset",
                              "subscription.subscription.plan_changed",
                              "subscription.access.changed"
                            ],
                            "type": "string"
                          },
                          "maxItems": 20,
                          "minItems": 1,
                          "type": "array"
                        },
                        "id": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "name": {
                          "maxLength": 100,
                          "minLength": 1,
                          "type": "string"
                        },
                        "paused": {
                          "default": false,
                          "type": "boolean"
                        },
                        "url": {
                          "maxLength": 2048,
                          "type": "string"
                        },
                        "version": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "name",
                        "url",
                        "event_types",
                        "id",
                        "version"
                      ],
                      "type": "object"
                    },
                    "secret": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "endpoint",
                    "secret"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Webhooks"
        ],
        "x-audit": "notify.webhook.rotate",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "ifMatch": true
        },
        "x-idempotency": "none",
        "x-permission": "notify.webhook.manage",
        "x-rate-limit": "notify.webhook.admin",
        "x-reauth": true
      }
    },
    "/api/v1/admin/ops-records": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "action": {
                    "enum": [
                      "release",
                      "backup",
                      "restore_drill"
                    ],
                    "type": "string"
                  },
                  "detail": {
                    "additionalProperties": {},
                    "type": "object"
                  },
                  "external_run_id": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "outcome": {
                    "enum": [
                      "success",
                      "failed"
                    ],
                    "type": "string"
                  },
                  "resource_id": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "action",
                  "resource_id",
                  "external_run_id",
                  "outcome",
                  "detail"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "replayed": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "id",
                    "replayed"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Operations"
        ],
        "x-audit": "ops.record.report",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-permission": "ops.record.write",
        "x-rate-limit": "iam.service_account.admin",
        "x-reauth": false
      }
    },
    "/api/v1/admin/orders": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "maxLength": 512,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "maxLength": 40,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "enum": [
                "purchase",
                "renewal",
                "traffic_reset",
                "top_up"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "plan_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "channel_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "refund_state",
            "required": false,
            "schema": {
              "enum": [
                "none",
                "partial",
                "full"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "amount_min",
            "required": false,
            "schema": {
              "pattern": "^\\d{1,18}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "amount_max",
            "required": false,
            "schema": {
              "pattern": "^\\d{1,18}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "created_from",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "created_to",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "maxLength": 64,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "maximum": 10001,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "order",
            "required": false,
            "schema": {
              "enum": [
                "asc",
                "desc"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "$ref": "#/components/schemas/CommerceOrder"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Orders",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "commerce.order.read"
      }
    },
    "/api/v1/admin/orders/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceOrder"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such order"
          }
        },
        "summary": "Order details",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "commerce.order.read"
      }
    },
    "/api/v1/admin/orders/{id}/cancel": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceOrder"
                }
              }
            },
            "description": "Result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Order changed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "Close an unpaid order",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.order.cancel",
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "commerce.order.manage"
      }
    },
    "/api/v1/admin/orders/{id}/receipt": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceReceipt"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such receipt"
          }
        },
        "summary": "Immutable order receipt for finance",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "commerce.order.read",
        "x-reauth": false
      }
    },
    "/api/v1/admin/orders/{id}/receipt.pdf": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "locale",
            "required": false,
            "schema": {
              "default": "zh-CN",
              "enum": [
                "zh-CN",
                "en-US"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "PDF receipt"
          },
          "304": {
            "description": "Private cached receipt unchanged"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such receipt"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Private storage unavailable"
          }
        },
        "summary": "Download immutable PDF receipt",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "commerce.order.read",
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/admin/payment-channels": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "$ref": "#/components/schemas/CommerceChannel"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Channel instances in display order",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "commerce.channel.manage"
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "config": {
                    "additionalProperties": {},
                    "type": "object"
                  },
                  "currency": {
                    "pattern": "^[A-Z]{3}$",
                    "type": "string"
                  },
                  "fee_bps": {
                    "default": 0,
                    "maximum": 10000,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "fee_fixed_minor": {
                    "default": "0",
                    "pattern": "^\\d{1,18}$",
                    "type": "string"
                  },
                  "i18n": {
                    "additionalProperties": {
                      "properties": {
                        "description": {
                          "maxLength": 2000,
                          "type": "string"
                        },
                        "name": {
                          "maxLength": 200,
                          "minLength": 1,
                          "type": "string"
                        }
                      },
                      "required": [
                        "name"
                      ],
                      "type": "object"
                    },
                    "type": "object"
                  },
                  "kind": {
                    "pattern": "^(epay|stripe|alipay_f2f|crypto:[a-z0-9_]+)$",
                    "type": "string"
                  },
                  "max_amount_minor": {
                    "default": null,
                    "pattern": "^\\d{1,18}$",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "min_amount_minor": {
                    "default": null,
                    "pattern": "^\\d{1,18}$",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "name": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "secrets": {
                    "additionalProperties": {
                      "type": "string"
                    },
                    "type": "object"
                  },
                  "sort": {
                    "default": 0,
                    "maximum": 100000,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "source_locale": {
                    "default": "en-US",
                    "maxLength": 35,
                    "minLength": 2,
                    "type": "string"
                  },
                  "status": {
                    "default": "disabled",
                    "enum": [
                      "enabled",
                      "disabled"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "kind",
                  "name",
                  "i18n",
                  "currency",
                  "config"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceChannel"
                }
              }
            },
            "description": "Result"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid channel settings"
          }
        },
        "summary": "Configure a channel instance",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.channel.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "commerce.channel.manage",
        "x-reauth": true
      }
    },
    "/api/v1/admin/payment-channels/reorder": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "ids": {
                    "items": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "maxItems": 100,
                    "type": "array"
                  }
                },
                "required": [
                  "ids"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "ok": {
                      "enum": [
                        true
                      ],
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "ok"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Set channel display order",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.channel.reorder",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "commerce.channel.manage"
      }
    },
    "/api/v1/admin/payment-channels/{id}": {
      "delete": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          }
        },
        "summary": "Delete an unused channel",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.channel.delete",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional",
        "x-permission": "commerce.channel.manage"
      },
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceChannel"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Channel instance",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "commerce.channel.manage"
      },
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "config": {
                    "additionalProperties": {},
                    "type": "object"
                  },
                  "currency": {
                    "pattern": "^[A-Z]{3}$",
                    "type": "string"
                  },
                  "fee_bps": {
                    "default": 0,
                    "maximum": 10000,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "fee_fixed_minor": {
                    "default": "0",
                    "pattern": "^\\d{1,18}$",
                    "type": "string"
                  },
                  "i18n": {
                    "additionalProperties": {
                      "properties": {
                        "description": {
                          "maxLength": 2000,
                          "type": "string"
                        },
                        "name": {
                          "maxLength": 200,
                          "minLength": 1,
                          "type": "string"
                        }
                      },
                      "required": [
                        "name"
                      ],
                      "type": "object"
                    },
                    "type": "object"
                  },
                  "kind": {
                    "pattern": "^(epay|stripe|alipay_f2f|crypto:[a-z0-9_]+)$",
                    "type": "string"
                  },
                  "max_amount_minor": {
                    "default": null,
                    "pattern": "^\\d{1,18}$",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "min_amount_minor": {
                    "default": null,
                    "pattern": "^\\d{1,18}$",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "name": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "secrets": {
                    "additionalProperties": {
                      "type": "string"
                    },
                    "type": "object"
                  },
                  "sort": {
                    "default": 0,
                    "maximum": 100000,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "source_locale": {
                    "default": "en-US",
                    "maxLength": 35,
                    "minLength": 2,
                    "type": "string"
                  },
                  "status": {
                    "default": "disabled",
                    "enum": [
                      "enabled",
                      "disabled"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "kind",
                  "name",
                  "i18n",
                  "currency",
                  "config"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceChannel"
                }
              }
            },
            "description": "Result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Version changed"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid channel settings"
          }
        },
        "summary": "Update or enable a channel",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.channel.update",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "commerce.channel.manage",
        "x-reauth": true
      }
    },
    "/api/v1/admin/payment-channels/{id}/secret": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "callback_token": {
                      "type": "string"
                    },
                    "secrets": {
                      "additionalProperties": {
                        "type": "string"
                      },
                      "type": "object"
                    }
                  },
                  "required": [
                    "secrets",
                    "callback_token"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Reveal channel secrets",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.channel.read_secret",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "commerce.channel.read_secret",
        "x-reauth": true
      }
    },
    "/api/v1/admin/payment-channels/{id}/test": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "properties": {
                        "ok": {
                          "enum": [
                            true
                          ],
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "ok"
                      ],
                      "type": "object"
                    },
                    {
                      "properties": {
                        "ok": {
                          "enum": [
                            false
                          ],
                          "type": "boolean"
                        },
                        "reason": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "ok",
                        "reason"
                      ],
                      "type": "object"
                    }
                  ]
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Test channel credentials",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.channel.test",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "commerce.channel.manage"
      }
    },
    "/api/v1/admin/payment-events": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "result",
            "required": false,
            "schema": {
              "enum": [
                "applied",
                "duplicate",
                "unmatched",
                "rejected",
                "amount_mismatch",
                "late_settled",
                "unapplied",
                "ignored"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "payment_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "maxLength": 512,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "$ref": "#/components/schemas/CommercePaymentEvent"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Provider facts and exceptions",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "commerce.payment.read"
      }
    },
    "/api/v1/admin/payments": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "maxLength": 512,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "maxLength": 40,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "enum": [
                "purchase",
                "renewal",
                "traffic_reset",
                "top_up"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "plan_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "channel_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "refund_state",
            "required": false,
            "schema": {
              "enum": [
                "none",
                "partial",
                "full"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "amount_min",
            "required": false,
            "schema": {
              "pattern": "^\\d{1,18}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "amount_max",
            "required": false,
            "schema": {
              "pattern": "^\\d{1,18}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "created_from",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "created_to",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "maxLength": 64,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "maximum": 10001,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "order",
            "required": false,
            "schema": {
              "enum": [
                "asc",
                "desc"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "order_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "$ref": "#/components/schemas/CommercePayment"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Payment attempts",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "commerce.payment.read"
      }
    },
    "/api/v1/admin/payments/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercePayment"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such payment"
          }
        },
        "summary": "Payment attempt",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "commerce.payment.read"
      }
    },
    "/api/v1/admin/payments/{id}/sync": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercePayment"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Query a payment and settle its facts",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.payment.sync",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional",
        "x-permission": "commerce.payment.sync"
      }
    },
    "/api/v1/admin/permissions": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PermissionCatalogue"
                }
              }
            },
            "description": "Catalogue"
          }
        },
        "summary": "The permission and capability catalogue",
        "tags": [
          "admin"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "iam.role.manage"
      }
    },
    "/api/v1/admin/privacy/policy": {
      "put": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "cooling_off_days": {
                    "maximum": 90,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "version": {
                    "minimum": 1,
                    "type": "integer"
                  }
                },
                "required": [
                  "cooling_off_days",
                  "version"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "cooling_off_days": {
                      "type": "integer"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cooling_off_days",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Privacy"
        ],
        "x-audit": "ops.privacy.policy",
        "x-body": "json",
        "x-body-limit": 4096,
        "x-idempotency": "required",
        "x-permission": "ops.privacy.manage",
        "x-rate-limit": "ops.retention.admin",
        "x-reauth": true
      }
    },
    "/api/v1/admin/reconciliations": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "channel_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "created_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "digest": {
                            "type": "string"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "period_end_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "period_start_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "row_count": {
                            "type": "integer"
                          },
                          "source": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "channel_id",
                          "period_start_at",
                          "period_end_at",
                          "source",
                          "digest",
                          "row_count",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "has_more",
                    "next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Channel reconciliation runs",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "commerce.reconciliation.manage",
        "x-rate-limit": "commerce.reconciliation",
        "x-reauth": false
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "additionalProperties": false,
                    "properties": {
                      "channel_id": {
                        "format": "uuid",
                        "type": "string"
                      },
                      "csv": {
                        "maxLength": 1048576,
                        "type": "string"
                      },
                      "period_end_at": {
                        "format": "date-time",
                        "type": "string"
                      },
                      "period_start_at": {
                        "format": "date-time",
                        "type": "string"
                      },
                      "source": {
                        "enum": [
                          "csv"
                        ],
                        "type": "string"
                      }
                    },
                    "required": [
                      "channel_id",
                      "period_start_at",
                      "period_end_at",
                      "source",
                      "csv"
                    ],
                    "type": "object"
                  },
                  {
                    "additionalProperties": false,
                    "properties": {
                      "channel_id": {
                        "format": "uuid",
                        "type": "string"
                      },
                      "period_end_at": {
                        "format": "date-time",
                        "type": "string"
                      },
                      "period_start_at": {
                        "format": "date-time",
                        "type": "string"
                      },
                      "source": {
                        "enum": [
                          "provider"
                        ],
                        "type": "string"
                      }
                    },
                    "required": [
                      "channel_id",
                      "period_start_at",
                      "period_end_at",
                      "source"
                    ],
                    "type": "object"
                  }
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "channel_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "digest": {
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "period_end_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "period_start_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "row_count": {
                      "type": "integer"
                    },
                    "source": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "channel_id",
                    "period_start_at",
                    "period_end_at",
                    "source",
                    "digest",
                    "row_count",
                    "created_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Conflicting statement snapshot"
          },
          "502": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Provider statement incomplete"
          }
        },
        "summary": "Import a complete CSV statement or pull a provider period",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.reconciliation.create",
        "x-body": "json",
        "x-body-limit": 1048576,
        "x-idempotency": "required",
        "x-permission": "commerce.reconciliation.manage",
        "x-rate-limit": "commerce.reconciliation",
        "x-reauth": true
      }
    },
    "/api/v1/admin/reconciliations/items/{id}/adjust": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "pattern": "^[1-9]\\d{0,18}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "amount_minor": {
                    "pattern": "^-?[1-9]\\d{0,17}$",
                    "type": "string"
                  },
                  "bucket": {
                    "enum": [
                      "cash",
                      "gift"
                    ],
                    "type": "string"
                  },
                  "currency": {
                    "pattern": "^[A-Z]{3}$",
                    "type": "string"
                  },
                  "reason": {
                    "maxLength": 500,
                    "minLength": 1,
                    "type": "string"
                  },
                  "user_id": {
                    "format": "uuid",
                    "type": "string"
                  }
                },
                "required": [
                  "user_id",
                  "bucket",
                  "amount_minor",
                  "currency",
                  "reason"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "channel_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "detail": {
                      "additionalProperties": {},
                      "type": "object"
                    },
                    "handled_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "outcome": {
                      "type": "string"
                    },
                    "payment_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "provider_payment_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "refund_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "run_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "run_id",
                    "channel_id",
                    "outcome",
                    "provider_payment_id",
                    "payment_id",
                    "refund_id",
                    "detail",
                    "status",
                    "version",
                    "handled_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Ledger adjustment permission required"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Difference changed"
          }
        },
        "summary": "Resolve a difference through the ledger adjustment command",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.reconciliation.adjust",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "commerce.reconciliation.manage",
        "x-rate-limit": "commerce.reconciliation",
        "x-reauth": true
      }
    },
    "/api/v1/admin/reconciliations/items/{id}/handle": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "pattern": "^[1-9]\\d{0,18}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "additionalProperties": false,
                    "properties": {
                      "action": {
                        "enum": [
                          "acknowledge"
                        ],
                        "type": "string"
                      },
                      "reason": {
                        "maxLength": 500,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "required": [
                      "action",
                      "reason"
                    ],
                    "type": "object"
                  },
                  {
                    "additionalProperties": false,
                    "properties": {
                      "action": {
                        "enum": [
                          "link"
                        ],
                        "type": "string"
                      },
                      "reason": {
                        "maxLength": 500,
                        "minLength": 1,
                        "type": "string"
                      },
                      "target_id": {
                        "format": "uuid",
                        "type": "string"
                      }
                    },
                    "required": [
                      "action",
                      "target_id",
                      "reason"
                    ],
                    "type": "object"
                  }
                ]
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "channel_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "detail": {
                      "additionalProperties": {},
                      "type": "object"
                    },
                    "handled_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "outcome": {
                      "type": "string"
                    },
                    "payment_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "provider_payment_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "refund_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "run_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "run_id",
                    "channel_id",
                    "outcome",
                    "provider_payment_id",
                    "payment_id",
                    "refund_id",
                    "detail",
                    "status",
                    "version",
                    "handled_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Difference changed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "Acknowledge or link a statement difference",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.reconciliation.handle",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "commerce.reconciliation.manage",
        "x-rate-limit": "commerce.reconciliation",
        "x-reauth": true
      }
    },
    "/api/v1/admin/reconciliations/{id}/items": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "pattern": "^\\d{1,19}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "channel_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "detail": {
                            "additionalProperties": {},
                            "type": "object"
                          },
                          "handled_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "id": {
                            "type": "string"
                          },
                          "outcome": {
                            "type": "string"
                          },
                          "payment_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "provider_payment_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "refund_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "run_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "id",
                          "run_id",
                          "channel_id",
                          "outcome",
                          "provider_payment_id",
                          "payment_id",
                          "refund_id",
                          "detail",
                          "status",
                          "version",
                          "handled_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "has_more",
                    "next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Statement differences",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "commerce.reconciliation.manage",
        "x-rate-limit": "commerce.reconciliation",
        "x-reauth": false
      }
    },
    "/api/v1/admin/refunds": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "maxLength": 512,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "maxLength": 40,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "enum": [
                "purchase",
                "renewal",
                "traffic_reset",
                "top_up"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "plan_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "channel_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "refund_state",
            "required": false,
            "schema": {
              "enum": [
                "none",
                "partial",
                "full"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "amount_min",
            "required": false,
            "schema": {
              "pattern": "^\\d{1,18}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "amount_max",
            "required": false,
            "schema": {
              "pattern": "^\\d{1,18}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "created_from",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "created_to",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "maxLength": 64,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "maximum": 10001,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "order",
            "required": false,
            "schema": {
              "enum": [
                "asc",
                "desc"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "order_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "$ref": "#/components/schemas/CommerceRefund"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Balance refunds, including unapplied receipts",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "commerce.refund.read"
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "amount_minor": {
                    "pattern": "^\\d{1,18}$",
                    "type": "string"
                  },
                  "entitlement_action": {
                    "enum": [
                      "revoke",
                      "shorten",
                      "none"
                    ],
                    "type": "string"
                  },
                  "method": {
                    "default": "balance",
                    "enum": [
                      "balance"
                    ],
                    "type": "string"
                  },
                  "order_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "reason": {
                    "maxLength": 1000,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "order_id",
                  "amount_minor",
                  "entitlement_action",
                  "reason"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRefund"
                }
              }
            },
            "description": "Result"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Order changed or not refundable"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "Refund to cash and gift and reverse entitlements atomically",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.refund.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "commerce.refund.create"
      }
    },
    "/api/v1/admin/refunds/original": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "amount_minor": {
                    "pattern": "^\\d{1,18}$",
                    "type": "string"
                  },
                  "entitlement_action": {
                    "enum": [
                      "none",
                      "revoke",
                      "shorten"
                    ],
                    "type": "string"
                  },
                  "order_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "reason": {
                    "maxLength": 1000,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "order_id",
                  "amount_minor",
                  "entitlement_action",
                  "reason"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "amount_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "attempts": {
                      "type": "integer"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "last_error": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "method": {
                      "type": "string"
                    },
                    "next_attempt_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "order_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "payment_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "provider_refund_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "refund_no": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "order_id",
                    "payment_id",
                    "refund_no",
                    "method",
                    "amount_minor",
                    "currency",
                    "status",
                    "provider_refund_id",
                    "attempts",
                    "next_attempt_at",
                    "last_error",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Order changed or refund not allowed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "Request an original-route refund for approval",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.refund.request",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "commerce.refund.create",
        "x-rate-limit": "commerce.refund",
        "x-reauth": false
      }
    },
    "/api/v1/admin/refunds/original/preview": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "amount_minor": {
                    "pattern": "^\\d{1,18}$",
                    "type": "string"
                  },
                  "entitlement_action": {
                    "enum": [
                      "none",
                      "revoke",
                      "shorten"
                    ],
                    "type": "string"
                  },
                  "order_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "reason": {
                    "maxLength": 1000,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "order_id",
                  "amount_minor",
                  "entitlement_action",
                  "reason"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "available_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "full": {
                      "type": "boolean"
                    },
                    "fx_rate": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "payment_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "provider_amount_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "provider_currency": {
                      "type": "string"
                    },
                    "ratio_bps": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "available_minor",
                    "provider_amount_minor",
                    "provider_currency",
                    "fx_rate",
                    "payment_id",
                    "full",
                    "ratio_bps"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Preview original-route refund eligibility and locked provider amount",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.refund.preview",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-permission": "commerce.refund.create",
        "x-rate-limit": "commerce.refund",
        "x-reauth": false
      }
    },
    "/api/v1/admin/refunds/preview": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "amount_minor": {
                    "pattern": "^\\d{1,18}$",
                    "type": "string"
                  },
                  "entitlement_action": {
                    "enum": [
                      "revoke",
                      "shorten",
                      "none"
                    ],
                    "type": "string"
                  },
                  "method": {
                    "default": "balance",
                    "enum": [
                      "balance"
                    ],
                    "type": "string"
                  },
                  "order_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "reason": {
                    "maxLength": 1000,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "order_id",
                  "amount_minor",
                  "entitlement_action",
                  "reason"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "available_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "cash_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "entitlement_action": {
                      "type": "string"
                    },
                    "full": {
                      "type": "boolean"
                    },
                    "gift_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "ratio_bps": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "available_minor",
                    "cash_minor",
                    "gift_minor",
                    "full",
                    "ratio_bps",
                    "entitlement_action"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Preview a source-split refund",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.refund.preview",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-permission": "commerce.refund.create"
      }
    },
    "/api/v1/admin/refunds/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceRefund"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Refund details",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "commerce.refund.read"
      }
    },
    "/api/v1/admin/refunds/{id}/approve": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "amount_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "attempts": {
                      "type": "integer"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "last_error": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "method": {
                      "type": "string"
                    },
                    "next_attempt_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "order_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "payment_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "provider_refund_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "refund_no": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "order_id",
                    "payment_id",
                    "refund_no",
                    "method",
                    "amount_minor",
                    "currency",
                    "status",
                    "provider_refund_id",
                    "attempts",
                    "next_attempt_at",
                    "last_error",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Refund changed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "Approve an original-route refund",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.refund.approve",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required",
        "x-permission": "commerce.refund.approve",
        "x-rate-limit": "commerce.refund",
        "x-reauth": true
      }
    },
    "/api/v1/admin/refunds/{id}/cancel": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "amount_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "attempts": {
                      "type": "integer"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "last_error": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "method": {
                      "type": "string"
                    },
                    "next_attempt_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "order_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "payment_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "provider_refund_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "refund_no": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "order_id",
                    "payment_id",
                    "refund_no",
                    "method",
                    "amount_minor",
                    "currency",
                    "status",
                    "provider_refund_id",
                    "attempts",
                    "next_attempt_at",
                    "last_error",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Refund changed"
          }
        },
        "summary": "Reject a requested original-route refund",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.refund.cancel",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required",
        "x-permission": "commerce.refund.approve",
        "x-rate-limit": "commerce.refund",
        "x-reauth": true
      }
    },
    "/api/v1/admin/refunds/{id}/confirm-manual": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "expected_version": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "repair_id": {
                    "format": "uuid",
                    "type": "string"
                  }
                },
                "required": [
                  "repair_id",
                  "expected_version"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "amount_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "attempts": {
                      "type": "integer"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "last_error": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "method": {
                      "type": "string"
                    },
                    "next_attempt_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "order_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "payment_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "provider_refund_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "refund_no": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "order_id",
                    "payment_id",
                    "refund_no",
                    "method",
                    "amount_minor",
                    "currency",
                    "status",
                    "provider_refund_id",
                    "attempts",
                    "next_attempt_at",
                    "last_error",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Preview stale or expired"
          }
        },
        "summary": "Execute a previously previewed manual refund confirmation",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.refund.confirm_manual",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "commerce.refund.approve",
        "x-rate-limit": "commerce.refund",
        "x-reauth": true
      }
    },
    "/api/v1/admin/refunds/{id}/manual-preview": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "amount_minor": {
                    "pattern": "^\\d{1,18}$",
                    "type": "string"
                  },
                  "currency": {
                    "pattern": "^[A-Z]{3}$",
                    "type": "string"
                  },
                  "external_reference": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  },
                  "paid_at": {
                    "format": "date-time",
                    "type": "string"
                  },
                  "reason": {
                    "maxLength": 500,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "external_reference",
                  "amount_minor",
                  "currency",
                  "paid_at",
                  "reason"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "expected_version": {
                      "type": "string"
                    },
                    "external_reference": {
                      "type": "string"
                    },
                    "preview_expires_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "provider_amount_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "provider_currency": {
                      "type": "string"
                    },
                    "refund_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "repair_id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "repair_id",
                    "expected_version",
                    "preview_expires_at",
                    "refund_id",
                    "provider_amount_minor",
                    "provider_currency",
                    "external_reference"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Preview receipt-backed manual refund confirmation",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.refund.manual_preview",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "commerce.refund.approve",
        "x-rate-limit": "commerce.refund",
        "x-reauth": true
      }
    },
    "/api/v1/admin/refunds/{id}/provider": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "amount_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "attempts": {
                      "type": "integer"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "fx_rate": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "history": {
                      "items": {
                        "properties": {
                          "created_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "status",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "last_error": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "method": {
                      "type": "string"
                    },
                    "next_attempt_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "order_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "payment_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "provider_amount_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "provider_currency": {
                      "type": "string"
                    },
                    "provider_refund_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "receipt": {
                      "properties": {
                        "amount_minor": {
                          "pattern": "^\\d{1,18}$",
                          "type": "string"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "external_reference": {
                          "type": "string"
                        },
                        "paid_at": {
                          "format": "date-time",
                          "type": "string"
                        }
                      },
                      "required": [
                        "external_reference",
                        "amount_minor",
                        "currency",
                        "paid_at"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "refund_address": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "refund_no": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "order_id",
                    "payment_id",
                    "refund_no",
                    "method",
                    "amount_minor",
                    "currency",
                    "status",
                    "provider_refund_id",
                    "attempts",
                    "next_attempt_at",
                    "last_error",
                    "version",
                    "provider_amount_minor",
                    "provider_currency",
                    "refund_address",
                    "fx_rate",
                    "receipt",
                    "history"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Refund not found"
          }
        },
        "summary": "Refund provider status, immutable amount and retry history",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "commerce.refund.read",
        "x-rate-limit": "commerce.refund",
        "x-reauth": false
      }
    },
    "/api/v1/admin/refunds/{id}/retry": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "amount_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "attempts": {
                      "type": "integer"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "last_error": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "method": {
                      "type": "string"
                    },
                    "next_attempt_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "order_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "payment_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "provider_refund_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "refund_no": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "order_id",
                    "payment_id",
                    "refund_no",
                    "method",
                    "amount_minor",
                    "currency",
                    "status",
                    "provider_refund_id",
                    "attempts",
                    "next_attempt_at",
                    "last_error",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Refund changed"
          }
        },
        "summary": "Retry querying a failed refund",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.refund.retry",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required",
        "x-permission": "commerce.refund.approve",
        "x-rate-limit": "commerce.refund",
        "x-reauth": true
      }
    },
    "/api/v1/admin/repairs": {
      "get": {
        "parameters": [
          {
            "description": "Status; repeat the parameter for several values",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "previewed",
                    "executing",
                    "succeeded",
                    "partial",
                    "failed",
                    "expired"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "previewed",
                      "executing",
                      "succeeded",
                      "partial",
                      "failed",
                      "expired"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Status; repeat the parameter for several values"
            }
          },
          {
            "in": "query",
            "name": "command",
            "required": false,
            "schema": {
              "maxLength": 100,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "target_type",
            "required": false,
            "schema": {
              "maxLength": 100,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "target_id",
            "required": false,
            "schema": {
              "maxLength": 200,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "operator_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Return `total` (first page only)",
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "description": "Return `total` (first page only)",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepairCommandPage"
                }
              }
            },
            "description": "A page of repair commands"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid filter or cursor"
          }
        },
        "summary": "List repair commands (newest first)",
        "tags": [
          "ops"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "ops.repair.read"
      }
    },
    "/api/v1/admin/repairs/catalog": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepairCatalogue"
                }
              }
            },
            "description": "Registered repair commands"
          }
        },
        "summary": "Repair command catalogue",
        "tags": [
          "ops"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "ops.repair.read"
      }
    },
    "/api/v1/admin/repairs/preview": {
      "post": {
        "parameters": [
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "command": {
                    "maxLength": 100,
                    "minLength": 1,
                    "type": "string"
                  },
                  "input": {
                    "additionalProperties": {},
                    "description": "Command input, see the catalogue",
                    "type": "object"
                  },
                  "reason": {
                    "maxLength": 500,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "command",
                  "input",
                  "reason"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepairCommand"
                }
              }
            },
            "description": "The previewed command (the same record again for a repeated key)"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "auth.forbidden: the command permission is missing"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.idempotency_key_reused, or a business conflict raised by the command preview"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unknown command or invalid input"
          }
        },
        "summary": "Preview a repair command (valid for 10 minutes)",
        "tags": [
          "ops"
        ],
        "x-audit": "ops.repair.preview",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "ops.repair.read"
      }
    },
    "/api/v1/admin/repairs/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepairCommand"
                }
              }
            },
            "description": "The repair command"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such repair command"
          }
        },
        "summary": "One repair command",
        "tags": [
          "ops"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "ops.repair.read"
      }
    },
    "/api/v1/admin/repairs/{id}/execute": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "expected_version": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "expected_version"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RepairCommand"
                }
              }
            },
            "description": "The executed command; a finished command returns its first result"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "auth.forbidden: the command permission is missing"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such repair command"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "ops.repair_preview_expired, ops.repair_target_changed, common.version_conflict (expected_version is not the preview's), or a business conflict raised by the command"
          }
        },
        "summary": "Execute a previewed repair command",
        "tags": [
          "ops"
        ],
        "x-audit": "ops.repair.execute",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "ops.repair.read",
        "x-reauth": true
      }
    },
    "/api/v1/admin/retention": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "category": {
                            "enum": [
                              "raw_traffic",
                              "daily_aggregates",
                              "business_audit",
                              "admin_audit",
                              "job_records",
                              "runtime_files",
                              "export_files",
                              "notification_records",
                              "access_logs"
                            ],
                            "type": "string"
                          },
                          "days": {
                            "type": "integer"
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "category",
                          "days",
                          "version"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Privacy"
        ],
        "x-audit": "ops.retention.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "ops.privacy.manage",
        "x-rate-limit": "ops.retention.admin",
        "x-reauth": false
      }
    },
    "/api/v1/admin/retention/runs": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "before_id",
            "required": false,
            "schema": {
              "pattern": "^\\d+$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "category": {
                            "enum": [
                              "raw_traffic",
                              "daily_aggregates",
                              "business_audit",
                              "admin_audit",
                              "job_records",
                              "runtime_files",
                              "export_files",
                              "notification_records",
                              "access_logs"
                            ],
                            "type": "string"
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "cutoff_at": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "removed": {
                            "type": "integer"
                          },
                          "status": {
                            "enum": [
                              "completed",
                              "held",
                              "integration_pending"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "category",
                          "cutoff_at",
                          "removed",
                          "status",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Privacy"
        ],
        "x-audit": "ops.retention.history",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "ops.privacy.manage",
        "x-rate-limit": "ops.retention.admin",
        "x-reauth": false
      }
    },
    "/api/v1/admin/retention/{category}": {
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "category",
            "required": true,
            "schema": {
              "enum": [
                "raw_traffic",
                "daily_aggregates",
                "business_audit",
                "admin_audit",
                "job_records",
                "runtime_files",
                "export_files",
                "notification_records",
                "access_logs"
              ],
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "days": {
                    "maximum": 3650,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "reason": {
                    "maxLength": 500,
                    "minLength": 1,
                    "type": "string"
                  },
                  "version": {
                    "minimum": 1,
                    "type": "integer"
                  }
                },
                "required": [
                  "days",
                  "version",
                  "reason"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "category": {
                      "enum": [
                        "raw_traffic",
                        "daily_aggregates",
                        "business_audit",
                        "admin_audit",
                        "job_records",
                        "runtime_files",
                        "export_files",
                        "notification_records",
                        "access_logs"
                      ],
                      "type": "string"
                    },
                    "days": {
                      "type": "integer"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "category",
                    "days",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Privacy"
        ],
        "x-audit": "ops.retention.update",
        "x-body": "json",
        "x-body-limit": 4096,
        "x-idempotency": "required",
        "x-permission": "ops.privacy.manage",
        "x-rate-limit": "ops.retention.admin",
        "x-reauth": true
      }
    },
    "/api/v1/admin/roles": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoleList"
                }
              }
            },
            "description": "Roles"
          }
        },
        "summary": "Roles with their permission codes and whether the caller may assign them",
        "tags": [
          "admin"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": [
          "iam.role.manage",
          "iam.staff.manage"
        ]
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RoleCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Role"
                }
              }
            },
            "description": "Created",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Create a role from catalogue codes within your own permissions",
        "tags": [
          "admin"
        ],
        "x-audit": "iam.role.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true
        },
        "x-idempotency": "required",
        "x-permission": "iam.role.manage",
        "x-reauth": true
      }
    },
    "/api/v1/admin/roles/{role}": {
      "delete": {
        "parameters": [
          {
            "in": "path",
            "name": "role",
            "required": true,
            "schema": {
              "pattern": "^[a-z][a-z0-9_]{1,31}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          }
        },
        "summary": "Delete a role (removed from every member); customer cannot be deleted",
        "tags": [
          "admin"
        ],
        "x-audit": "iam.role.delete",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "iam.role.manage",
        "x-reauth": true
      },
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "role",
            "required": true,
            "schema": {
              "pattern": "^[a-z][a-z0-9_]{1,31}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Role"
                }
              }
            },
            "description": "Role",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "One role (ETag for If-Match)",
        "tags": [
          "admin"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "iam.role.manage"
      },
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "role",
            "required": true,
            "schema": {
              "pattern": "^[a-z][a-z0-9_]{1,31}$",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RoleUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Role"
                }
              }
            },
            "description": "Updated",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Replace a role’s permission codes (If-Match)",
        "tags": [
          "admin"
        ],
        "x-audit": "iam.role.update",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "none",
        "x-permission": "iam.role.manage",
        "x-reauth": true
      }
    },
    "/api/v1/admin/service-accounts": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "created_at": {
                            "type": "string"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "roles": {
                            "items": {
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "status": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "status",
                          "roles",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Service accounts"
        ],
        "x-audit": "iam.service_account.list",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "iam.api_key.manage",
        "x-rate-limit": "iam.service_account.admin",
        "x-reauth": false
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "maxLength": 100,
                    "minLength": 1,
                    "type": "string"
                  },
                  "roles": {
                    "items": {
                      "pattern": "^[a-z][a-z0-9_]{1,31}$",
                      "type": "string"
                    },
                    "maxItems": 20,
                    "type": "array"
                  }
                },
                "required": [
                  "name",
                  "roles"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "created_at": {
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "roles": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "status": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "status",
                    "roles",
                    "created_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Service accounts"
        ],
        "x-audit": "iam.service_account.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "iam.api_key.manage",
        "x-rate-limit": "iam.service_account.admin",
        "x-reauth": true
      }
    },
    "/api/v1/admin/service-accounts/{id}/api-keys": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "enabled": {
                            "type": "boolean"
                          },
                          "expires_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "last_request": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "name": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "prefix": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "rate_limit_max": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "start": {
                            "type": [
                              "string",
                              "null"
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "start",
                          "prefix",
                          "enabled",
                          "expires_at",
                          "last_request",
                          "rate_limit_max"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Service accounts"
        ],
        "x-audit": "iam.api_key.list",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "iam.api_key.manage",
        "x-rate-limit": "iam.service_account.admin",
        "x-reauth": false
      },
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "expires_in_seconds": {
                    "maximum": 31622400,
                    "minimum": 60,
                    "type": "integer"
                  },
                  "name": {
                    "maxLength": 100,
                    "minLength": 1,
                    "type": "string"
                  },
                  "rate_limit_max": {
                    "default": 100,
                    "maximum": 10000,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "rate_limit_window_seconds": {
                    "default": 60,
                    "maximum": 3600,
                    "minimum": 1,
                    "type": "integer"
                  }
                },
                "required": [
                  "name",
                  "expires_in_seconds"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "expires_at": {
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "key": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "key",
                    "expires_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Service accounts"
        ],
        "x-audit": "iam.api_key.issue",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-permission": "iam.api_key.manage",
        "x-rate-limit": "iam.service_account.admin",
        "x-reauth": true
      }
    },
    "/api/v1/admin/service-accounts/{id}/api-keys/{keyId}": {
      "delete": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "keyId",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Revoked"
          }
        },
        "tags": [
          "Service accounts"
        ],
        "x-audit": "iam.api_key.revoke",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "iam.api_key.manage",
        "x-rate-limit": "iam.service_account.admin",
        "x-reauth": true
      }
    },
    "/api/v1/admin/settings": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SettingsDomainList"
                }
              }
            },
            "description": "Domains"
          }
        },
        "summary": "Settings domains the caller may read",
        "tags": [
          "settings"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "system.settings.read"
      }
    },
    "/api/v1/admin/settings/captcha/test": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CaptchaProviderTestRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CaptchaProviderTestResult"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Check the saved configuration of one human-verification provider",
        "tags": [
          "admin"
        ],
        "x-audit": "iam.captcha.test",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-permission": "iam.auth_provider.manage"
      }
    },
    "/api/v1/admin/settings/{domain}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "domain",
            "required": true,
            "schema": {
              "example": "site",
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9_]*$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SettingsDocument"
                }
              }
            },
            "description": "Document, with ETag",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "auth.forbidden"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Unknown or not served here"
          }
        },
        "summary": "Read one settings domain",
        "tags": [
          "settings"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "system.settings.read"
      },
      "put": {
        "description": "Write permission per domain. Domains holding secrets (i18n, auth, captcha, storage, notify, webhooks) require a re-authentication within 10 minutes.",
        "parameters": [
          {
            "in": "path",
            "name": "domain",
            "required": true,
            "schema": {
              "example": "site",
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9_]*$",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SettingsUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SettingsDocument"
                }
              }
            },
            "description": "Saved document, with ETag",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "auth.forbidden or auth.reauth_required"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Unknown or not served here"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "common.version_conflict (with current) or an Idempotency-Key conflict"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Validation failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Replace one settings domain (If-Match; write permission per domain; re-auth for secret-bearing domains)",
        "tags": [
          "settings"
        ],
        "x-audit": "system.settings.update",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "system.settings.read"
      }
    },
    "/api/v1/admin/settings/{domain}/draft": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "domain",
            "required": true,
            "schema": {
              "example": "site",
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9_]*$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "draft": {
                      "allOf": [
                        {
                          "$ref": "#/components/schemas/SettingsRevision"
                        },
                        {
                          "type": [
                            "object",
                            "null"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "draft"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Settings revision result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          }
        },
        "summary": "Read the settings draft (v0 when absent)",
        "tags": [
          "settings"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-idempotency": "none",
        "x-permission": "system.settings.read",
        "x-rate-limit": "settings.revisions.read",
        "x-reauth": false
      },
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "domain",
            "required": true,
            "schema": {
              "example": "site",
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9_]*$",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "base_version": {
                    "maximum": 2147483647,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "note": {
                    "maxLength": 2000,
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "value": {
                    "additionalProperties": {},
                    "type": "object"
                  }
                },
                "required": [
                  "value",
                  "base_version"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SettingsRevision"
                }
              }
            },
            "description": "Settings revision result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          }
        },
        "summary": "Save or explicitly rebase a draft; If-Match refers to the draft version",
        "tags": [
          "settings"
        ],
        "x-audit": "system.settings.draft",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "system.settings.read",
        "x-rate-limit": "settings.revisions.write",
        "x-reauth": false
      }
    },
    "/api/v1/admin/settings/{domain}/publish": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "domain",
            "required": true,
            "schema": {
              "example": "site",
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9_]*$",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "draft_version": {
                    "maximum": 2147483647,
                    "minimum": 1,
                    "type": "integer"
                  },
                  "revision": {
                    "maximum": 2147483647,
                    "minimum": 1,
                    "type": "integer"
                  }
                },
                "required": [
                  "revision",
                  "draft_version"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SettingsDocument"
                }
              }
            },
            "description": "Settings revision result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          }
        },
        "summary": "Publish the exact draft version; If-Match refers to the live settings version",
        "tags": [
          "settings"
        ],
        "x-audit": "system.settings.publish",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "system.settings.publish",
        "x-rate-limit": "settings.revisions.write",
        "x-reauth": true
      }
    },
    "/api/v1/admin/settings/{domain}/revisions": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "domain",
            "required": true,
            "schema": {
              "example": "site",
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9_]*$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "exclusiveMinimum": 0,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "base_version": {
                            "maximum": 2147483647,
                            "minimum": 0,
                            "type": "integer"
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "domain": {
                            "type": "string"
                          },
                          "note": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "published_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "revision": {
                            "maximum": 2147483647,
                            "minimum": 0,
                            "type": "integer"
                          },
                          "status": {
                            "enum": [
                              "draft",
                              "published",
                              "superseded",
                              "rolled_back"
                            ],
                            "type": "string"
                          },
                          "version": {
                            "maximum": 2147483647,
                            "minimum": 0,
                            "type": "integer"
                          }
                        },
                        "required": [
                          "domain",
                          "revision",
                          "version",
                          "base_version",
                          "status",
                          "note",
                          "created_at",
                          "published_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "maximum": 2147483647,
                      "minimum": 0,
                      "type": [
                        "integer",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Settings revision result"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          }
        },
        "summary": "List settings revision metadata",
        "tags": [
          "settings"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "system.settings.publish",
        "x-rate-limit": "settings.revisions.read",
        "x-reauth": false
      }
    },
    "/api/v1/admin/settings/{domain}/revisions/{revision}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "domain",
            "required": true,
            "schema": {
              "example": "site",
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9_]*$",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "revision",
            "required": true,
            "schema": {
              "exclusiveMinimum": 0,
              "maximum": 2147483647,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SettingsRevision"
                }
              }
            },
            "description": "Settings revision result"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          }
        },
        "summary": "Read a redacted settings revision",
        "tags": [
          "settings"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "system.settings.publish",
        "x-rate-limit": "settings.revisions.read",
        "x-reauth": false
      }
    },
    "/api/v1/admin/settings/{domain}/revisions/{revision}/diff": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "domain",
            "required": true,
            "schema": {
              "example": "site",
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9_]*$",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "revision",
            "required": true,
            "schema": {
              "exclusiveMinimum": 0,
              "maximum": 2147483647,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SettingsRevisionDiff"
                }
              }
            },
            "description": "Settings revision result"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          }
        },
        "summary": "Compare a revision with the current published settings; secret values are never returned",
        "tags": [
          "settings"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "system.settings.publish",
        "x-rate-limit": "settings.revisions.read",
        "x-reauth": false
      }
    },
    "/api/v1/admin/settings/{domain}/rollback": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "domain",
            "required": true,
            "schema": {
              "example": "site",
              "maxLength": 64,
              "pattern": "^[a-z][a-z0-9_]*$",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "revision": {
                    "maximum": 2147483647,
                    "minimum": 1,
                    "type": "integer"
                  }
                },
                "required": [
                  "revision"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SettingsDocument"
                }
              }
            },
            "description": "Settings revision result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Permission, revision, validation or concurrency error"
          }
        },
        "summary": "Restore a previously published revision as a new live version",
        "tags": [
          "settings"
        ],
        "x-audit": "system.settings.rollback",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "system.settings.publish",
        "x-rate-limit": "settings.revisions.write",
        "x-reauth": true
      }
    },
    "/api/v1/admin/site/content/publish": {
      "post": {
        "parameters": [
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "draft_version": {
                    "exclusiveMinimum": 0,
                    "type": "integer"
                  },
                  "revision": {
                    "exclusiveMinimum": 0,
                    "type": "integer"
                  }
                },
                "required": [
                  "revision",
                  "draft_version"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SettingsDocument"
                }
              }
            },
            "description": "Published site document",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Publish the site content draft without reauthentication",
        "tags": [
          "site"
        ],
        "x-audit": "system.settings.publish",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "system.settings.publish",
        "x-rate-limit": "settings.revisions.write",
        "x-reauth": false
      }
    },
    "/api/v1/admin/staff": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StaffList"
                }
              }
            },
            "description": "Staff"
          }
        },
        "summary": "Staff members",
        "tags": [
          "admin"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "iam.staff.manage"
      }
    },
    "/api/v1/admin/staff/{userId}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StaffDetail"
                }
              }
            },
            "description": "Staff member",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Staff member with assignable roles",
        "tags": [
          "admin"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "iam.staff.manage"
      }
    },
    "/api/v1/admin/staff/{userId}/reset-mfa": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StaffMfaReset"
                }
              }
            },
            "description": "Reset"
          }
        },
        "summary": "Remove the TOTP enrollment and every session of a staff account",
        "tags": [
          "admin"
        ],
        "x-audit": "iam.staff.mfa.reset",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "iam.staff.manage",
        "x-reauth": true
      }
    },
    "/api/v1/admin/staff/{userId}/roles": {
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StaffRolesUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StaffRoles"
                }
              }
            },
            "description": "Roles",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Set a member’s roles (customer is kept; empty list demotes to customer). If-Match.",
        "tags": [
          "admin"
        ],
        "x-audit": "iam.staff.roles.update",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "none",
        "x-permission": "iam.staff.manage",
        "x-reauth": true
      }
    },
    "/api/v1/admin/status": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "before",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "components": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "state": {
                            "enum": [
                              "operational",
                              "degraded",
                              "partial_outage",
                              "major_outage",
                              "maintenance"
                            ],
                            "type": "string"
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "state",
                          "version"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "events": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "component_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "ends_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "kind": {
                            "enum": [
                              "incident",
                              "maintenance"
                            ],
                            "type": "string"
                          },
                          "phase": {
                            "enum": [
                              "draft",
                              "published",
                              "active",
                              "resolved"
                            ],
                            "type": "string"
                          },
                          "published_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "resolved_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "starts_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "state": {
                            "enum": [
                              "degraded",
                              "partial_outage",
                              "major_outage",
                              "maintenance"
                            ],
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "title",
                          "state",
                          "phase",
                          "component_ids",
                          "starts_at",
                          "ends_at",
                          "published_at",
                          "resolved_at",
                          "version"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "suggestions": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "component_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "observed_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "samples": {
                            "type": "integer"
                          },
                          "state": {
                            "enum": [
                              "operational",
                              "degraded",
                              "partial_outage",
                              "major_outage",
                              "maintenance"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "component_id",
                          "state",
                          "observed_at",
                          "samples"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "components",
                    "events",
                    "has_more",
                    "next_cursor",
                    "suggestions"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "status"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "support.announcement.manage",
        "x-rate-limit": "support.status",
        "x-reauth": false
      }
    },
    "/api/v1/admin/status/components": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "maxLength": 4000,
                    "minLength": 1,
                    "type": "string"
                  },
                  "state": {
                    "enum": [
                      "operational",
                      "degraded",
                      "partial_outage",
                      "major_outage",
                      "maintenance"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "state"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "state": {
                      "enum": [
                        "operational",
                        "degraded",
                        "partial_outage",
                        "major_outage",
                        "maintenance"
                      ],
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "state",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          }
        },
        "tags": [
          "status"
        ],
        "x-audit": "support.status.component_create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "support.announcement.manage",
        "x-rate-limit": "support.status",
        "x-reauth": false
      }
    },
    "/api/v1/admin/status/components/{id}": {
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "maxLength": 4000,
                    "minLength": 1,
                    "type": "string"
                  },
                  "state": {
                    "enum": [
                      "operational",
                      "degraded",
                      "partial_outage",
                      "major_outage",
                      "maintenance"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "state"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "name": {
                      "type": "string"
                    },
                    "state": {
                      "enum": [
                        "operational",
                        "degraded",
                        "partial_outage",
                        "major_outage",
                        "maintenance"
                      ],
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "name",
                    "state",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          }
        },
        "tags": [
          "status"
        ],
        "x-audit": "support.status.component_update",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "support.announcement.manage",
        "x-rate-limit": "support.status",
        "x-reauth": false
      }
    },
    "/api/v1/admin/status/incidents": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "body": {
                    "maxLength": 4000,
                    "minLength": 1,
                    "type": "string"
                  },
                  "component_ids": {
                    "items": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "maxItems": 100,
                    "minItems": 1,
                    "type": "array"
                  },
                  "ends_at": {
                    "format": "date-time",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "kind": {
                    "enum": [
                      "incident",
                      "maintenance"
                    ],
                    "type": "string"
                  },
                  "starts_at": {
                    "format": "date-time",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "state": {
                    "enum": [
                      "degraded",
                      "partial_outage",
                      "major_outage",
                      "maintenance"
                    ],
                    "type": "string"
                  },
                  "title": {
                    "maxLength": 4000,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "kind",
                  "title",
                  "state",
                  "component_ids",
                  "starts_at",
                  "ends_at",
                  "body"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "component_ids": {
                      "items": {
                        "format": "uuid",
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "ends_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "incident",
                        "maintenance"
                      ],
                      "type": "string"
                    },
                    "phase": {
                      "enum": [
                        "draft",
                        "published",
                        "active",
                        "resolved"
                      ],
                      "type": "string"
                    },
                    "published_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolved_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "starts_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "state": {
                      "enum": [
                        "degraded",
                        "partial_outage",
                        "major_outage",
                        "maintenance"
                      ],
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "kind",
                    "title",
                    "state",
                    "phase",
                    "component_ids",
                    "starts_at",
                    "ends_at",
                    "published_at",
                    "resolved_at",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          }
        },
        "tags": [
          "status"
        ],
        "x-audit": "support.status.event_create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "support.announcement.manage",
        "x-rate-limit": "support.status",
        "x-reauth": false
      }
    },
    "/api/v1/admin/status/incidents/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "before",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "component_ids": {
                      "items": {
                        "format": "uuid",
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "ends_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "incident",
                        "maintenance"
                      ],
                      "type": "string"
                    },
                    "phase": {
                      "enum": [
                        "draft",
                        "published",
                        "active",
                        "resolved"
                      ],
                      "type": "string"
                    },
                    "published_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolved_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "starts_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "state": {
                      "enum": [
                        "degraded",
                        "partial_outage",
                        "major_outage",
                        "maintenance"
                      ],
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "updates": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "body": {
                            "type": "string"
                          },
                          "created_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "body",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "updates_has_more": {
                      "type": "boolean"
                    },
                    "updates_next_cursor": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "kind",
                    "title",
                    "state",
                    "phase",
                    "component_ids",
                    "starts_at",
                    "ends_at",
                    "published_at",
                    "resolved_at",
                    "version",
                    "updates",
                    "updates_has_more",
                    "updates_next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          }
        },
        "tags": [
          "status"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "support.announcement.manage",
        "x-rate-limit": "support.status",
        "x-reauth": false
      }
    },
    "/api/v1/admin/status/incidents/{id}/updates": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "action": {
                    "enum": [
                      "publish",
                      "update",
                      "resolve"
                    ],
                    "type": "string"
                  },
                  "body": {
                    "maxLength": 4000,
                    "minLength": 1,
                    "type": "string"
                  },
                  "state": {
                    "enum": [
                      "degraded",
                      "partial_outage",
                      "major_outage",
                      "maintenance"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "action",
                  "body"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "component_ids": {
                      "items": {
                        "format": "uuid",
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "ends_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "incident",
                        "maintenance"
                      ],
                      "type": "string"
                    },
                    "phase": {
                      "enum": [
                        "draft",
                        "published",
                        "active",
                        "resolved"
                      ],
                      "type": "string"
                    },
                    "published_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolved_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "starts_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "state": {
                      "enum": [
                        "degraded",
                        "partial_outage",
                        "major_outage",
                        "maintenance"
                      ],
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "kind",
                    "title",
                    "state",
                    "phase",
                    "component_ids",
                    "starts_at",
                    "ends_at",
                    "published_at",
                    "resolved_at",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          }
        },
        "tags": [
          "status"
        ],
        "x-audit": "support.status.event_update",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "support.announcement.manage",
        "x-rate-limit": "support.status",
        "x-reauth": false
      }
    },
    "/api/v1/admin/subscriptions": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Status; repeat the parameter for several values",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "scheduled",
                    "active",
                    "exhausted",
                    "expired",
                    "cancelled",
                    "refunded"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "scheduled",
                      "active",
                      "exhausted",
                      "expired",
                      "cancelled",
                      "refunded"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Status; repeat the parameter for several values"
            }
          },
          {
            "description": "Source; repeat the parameter for several values",
            "in": "query",
            "name": "source",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "order",
                    "code",
                    "admin",
                    "trial",
                    "apple"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "order",
                      "code",
                      "admin",
                      "trial",
                      "apple"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Source; repeat the parameter for several values"
            }
          },
          {
            "in": "query",
            "name": "plan_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Subscription id, public id (S…), node short id or node UUID",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "description": "Subscription id, public id (S…), node short id or node UUID",
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "term_end_from",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "term_end_to",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Return `total` (first page only)",
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "description": "Return `total` (first page only)",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminSubscriptionPage"
                }
              }
            },
            "description": "A page of subscriptions"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid filter or cursor"
          }
        },
        "summary": "Search subscriptions, newest first (keyset pages)",
        "tags": [
          "subscriptions"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "subscription.subscription.read"
      },
      "post": {
        "parameters": [
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminSubscriptionCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminSubscription"
                }
              }
            },
            "description": "The new subscription",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Unknown user, plan or price option; a retired plan; validation failed"
          }
        },
        "summary": "Open a subscription for a user (queued behind a running one unless activation is immediate)",
        "tags": [
          "subscriptions"
        ],
        "x-audit": "subscription.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true
        },
        "x-idempotency": "required",
        "x-permission": "subscription.subscription.manage"
      }
    },
    "/api/v1/admin/subscriptions/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminSubscription"
                }
              }
            },
            "description": "The subscription",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such subscription"
          }
        },
        "summary": "One subscription with its available actions (ETag: version)",
        "tags": [
          "subscriptions"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "subscription.subscription.read"
      }
    },
    "/api/v1/admin/subscriptions/{id}/activate": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminSubscription"
                }
              }
            },
            "description": "The subscription"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such subscription"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current) or a subscription.* conflict"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Start a queued subscription now (If-Match)",
        "tags": [
          "subscriptions"
        ],
        "x-audit": "subscription.activate",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional",
        "x-permission": "subscription.subscription.manage"
      }
    },
    "/api/v1/admin/subscriptions/{id}/auto-renew/disable": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminSubscription"
                }
              }
            },
            "description": "The subscription"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such subscription"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current) or a subscription.* conflict"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Switch balance auto-renew off (If-Match)",
        "tags": [
          "subscriptions"
        ],
        "x-audit": "subscription.auto_renew.disable",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional",
        "x-permission": "subscription.subscription.manage"
      }
    },
    "/api/v1/admin/subscriptions/{id}/cancel": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminSubscriptionReason"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminSubscription"
                }
              }
            },
            "description": "The subscription"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such subscription"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current) or a subscription.* conflict"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Cancel (If-Match)",
        "tags": [
          "subscriptions"
        ],
        "x-audit": "subscription.cancel",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "optional",
        "x-permission": "subscription.subscription.manage"
      }
    },
    "/api/v1/admin/subscriptions/{id}/device-counting-policy": {
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "mode": {
                    "enum": [
                      "ip",
                      "hwid",
                      "both"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "mode"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HardwareDevicePolicy"
                }
              }
            },
            "description": "Policy",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such subscription"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current)"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid policy"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Change IP/HWID counting policy",
        "tags": [
          "usage"
        ],
        "x-audit": "usage.device.policy",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "subscription.subscription.manage"
      }
    },
    "/api/v1/admin/subscriptions/{id}/devices": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageDevices"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          }
        },
        "summary": "Online devices (masked addresses)",
        "tags": [
          "usage"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "subscription.subscription.read",
        "x-reauth": false
      }
    },
    "/api/v1/admin/subscriptions/{id}/devices/{deviceKey}/kick": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "deviceKey",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{64}$",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageKickedDevice"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          }
        },
        "summary": "Block a device for 30 minutes",
        "tags": [
          "usage"
        ],
        "x-audit": "usage.device.kick",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required",
        "x-permission": "subscription.subscription.manage",
        "x-reauth": false
      }
    },
    "/api/v1/admin/subscriptions/{id}/events": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionEventPage"
                }
              }
            },
            "description": "A page of events"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such subscription"
          }
        },
        "summary": "Lifecycle events of a subscription, newest first",
        "tags": [
          "subscriptions"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "subscription.subscription.read"
      }
    },
    "/api/v1/admin/subscriptions/{id}/extend": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminSubscriptionExtend"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminSubscription"
                }
              }
            },
            "description": "The subscription"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such subscription"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current) or a subscription.* conflict"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Extend by a term or set the end (If-Match)",
        "tags": [
          "subscriptions"
        ],
        "x-audit": "subscription.extend",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "optional",
        "x-permission": "subscription.subscription.manage"
      }
    },
    "/api/v1/admin/subscriptions/{id}/grant-traffic": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminSubscriptionGrantTraffic"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminSubscription"
                }
              }
            },
            "description": "The subscription"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such subscription"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current) or a subscription.* conflict"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Grant bonus traffic for the current period (If-Match)",
        "tags": [
          "subscriptions"
        ],
        "x-audit": "subscription.grant_traffic",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "optional",
        "x-permission": "subscription.subscription.manage"
      }
    },
    "/api/v1/admin/subscriptions/{id}/grants": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionGrantPage"
                }
              }
            },
            "description": "A page of grants"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such subscription"
          }
        },
        "summary": "Entitlement grants of a subscription, newest first",
        "tags": [
          "subscriptions"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "subscription.subscription.read"
      }
    },
    "/api/v1/admin/subscriptions/{id}/hardware-devices": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HardwareDevices"
                }
              }
            },
            "description": "Devices",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such subscription"
          }
        },
        "summary": "Hardware device policy and masked observations",
        "tags": [
          "usage"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "subscription.subscription.read"
      }
    },
    "/api/v1/admin/subscriptions/{id}/hardware-devices/{deviceKey}/revoke": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "deviceKey",
            "required": true,
            "schema": {
              "pattern": "^v[1-9]\\d*\\.[0-9a-f]{64}$",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "revoked_until": {
                      "format": "date-time",
                      "type": "string"
                    }
                  },
                  "required": [
                    "revoked_until"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Revocation"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such device"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid device"
          }
        },
        "summary": "Revoke a hardware hint for 30 minutes",
        "tags": [
          "usage"
        ],
        "x-audit": "usage.device.revoke",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required",
        "x-permission": "subscription.subscription.manage"
      }
    },
    "/api/v1/admin/subscriptions/{id}/preview": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "client",
            "required": false,
            "schema": {
              "maxLength": 64,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "ver",
            "required": false,
            "schema": {
              "maxLength": 32,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "region",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "protocol",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "tag",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "ip_family",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "isp",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "exclude_keyword",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "maxLength": 128,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "maxLength": 128,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "client": {
                      "enum": [
                        "mihomo",
                        "sing_box@1.11",
                        "sing_box@1.12",
                        "sing_box@1.13",
                        "uri_base64",
                        "hiddify",
                        "stash",
                        "surge",
                        "quantumult_x",
                        "loon",
                        "surfboard",
                        "shadowrocket"
                      ],
                      "type": "string"
                    },
                    "failed_nodes": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "fallback": {
                      "type": "boolean"
                    },
                    "format": {
                      "enum": [
                        "yaml",
                        "json",
                        "conf",
                        "text",
                        "base64"
                      ],
                      "type": "string"
                    },
                    "nodes": {
                      "items": {
                        "properties": {
                          "address_family": {
                            "type": "string"
                          },
                          "health": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "load": {
                            "additionalProperties": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "type": "object"
                          },
                          "name": {
                            "type": "string"
                          },
                          "protocol": {
                            "type": "string"
                          },
                          "region": {
                            "type": "string"
                          },
                          "tags": {
                            "items": {
                              "type": "string"
                            },
                            "type": "array"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "protocol",
                          "region",
                          "tags"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "output": {
                      "type": "string"
                    },
                    "result": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "client",
                    "format",
                    "output",
                    "result",
                    "nodes",
                    "fallback",
                    "failed_nodes"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Preview a subscription using the delivery selector",
        "tags": [
          "distribution"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "distribution.preview"
      }
    },
    "/api/v1/admin/subscriptions/{id}/reset-usage": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminSubscriptionReason"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminSubscription"
                }
              }
            },
            "description": "The subscription"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such subscription"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current) or a subscription.* conflict"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Reset the usage period (If-Match)",
        "tags": [
          "subscriptions"
        ],
        "x-audit": "subscription.reset_usage",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "optional",
        "x-permission": "subscription.subscription.manage"
      }
    },
    "/api/v1/admin/subscriptions/{id}/resume": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminSubscription"
                }
              }
            },
            "description": "The subscription"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such subscription"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current) or a subscription.* conflict"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Resume (If-Match)",
        "tags": [
          "subscriptions"
        ],
        "x-audit": "subscription.resume",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional",
        "x-permission": "subscription.subscription.manage"
      }
    },
    "/api/v1/admin/subscriptions/{id}/rotate-credential": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminSubscription"
                }
              }
            },
            "description": "The subscription"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such subscription"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current) or a subscription.* conflict"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Rotate the node credential (If-Match)",
        "tags": [
          "subscriptions"
        ],
        "x-audit": "subscription.credential.rotate",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional",
        "x-permission": "subscription.subscription.manage"
      }
    },
    "/api/v1/admin/subscriptions/{id}/rotate-link": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "rotated_at": {
                      "type": "string"
                    },
                    "token_fingerprint": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "token_fingerprint",
                    "rotated_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Replace a subscription link token immediately",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.link.rotate",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required",
        "x-permission": "distribution.token.manage"
      }
    },
    "/api/v1/admin/subscriptions/{id}/routing-rules": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "rules": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "target": {
                            "maxLength": 200,
                            "minLength": 1,
                            "pattern": "^[^,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                            "type": "string"
                          },
                          "type": {
                            "enum": [
                              "domain",
                              "domain-suffix",
                              "domain-keyword",
                              "IP-CIDR",
                              "GEOIP",
                              "GEOSITE",
                              "process-name"
                            ],
                            "type": "string"
                          },
                          "value": {
                            "maxLength": 253,
                            "minLength": 1,
                            "pattern": "^[^\\s,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "value",
                          "target"
                        ],
                        "type": "object"
                      },
                      "maxItems": 200,
                      "type": "array"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "rules",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Read subscription routing rules without editing",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.user_routing.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "distribution.preview",
        "x-rate-limit": "distribution.user_routing.user",
        "x-reauth": false
      }
    },
    "/api/v1/admin/subscriptions/{id}/set-limits": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminSubscriptionLimits"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminSubscription"
                }
              }
            },
            "description": "The subscription"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such subscription"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current) or a subscription.* conflict"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Adjust device, speed and traffic limits (If-Match)",
        "tags": [
          "subscriptions"
        ],
        "x-audit": "subscription.set_limits",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "optional",
        "x-permission": "subscription.subscription.manage"
      }
    },
    "/api/v1/admin/subscriptions/{id}/suspend": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminSubscriptionReason"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminSubscription"
                }
              }
            },
            "description": "The subscription"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such subscription"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current) or a subscription.* conflict"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Suspend (If-Match)",
        "tags": [
          "subscriptions"
        ],
        "x-audit": "subscription.suspend",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "optional",
        "x-permission": "subscription.subscription.manage"
      }
    },
    "/api/v1/admin/subscriptions/{id}/team": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "member_limit": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "members": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "allocation_bytes": {
                            "pattern": "^\\d{1,19}$",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "role": {
                            "enum": [
                              "owner",
                              "manager",
                              "member"
                            ],
                            "type": "string"
                          },
                          "subscription_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "used_bytes": {
                            "pattern": "^\\d{1,19}$",
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "role",
                          "subscription_id",
                          "allocation_bytes",
                          "used_bytes"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "name": {
                      "type": "string"
                    },
                    "role": {
                      "enum": [
                        "owner",
                        "manager",
                        "member"
                      ],
                      "type": "string"
                    },
                    "team_id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "team_id",
                    "name",
                    "role",
                    "member_limit",
                    "members"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Team usage"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Team role does not permit this action"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Team or member not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Subscription, membership or allocation conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Team usage for an enterprise subscription",
        "tags": [
          "teams"
        ],
        "x-audit": "subscription.team.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "subscription.subscription.read",
        "x-rate-limit": "subscription.teams.user",
        "x-reauth": false
      }
    },
    "/api/v1/admin/telegram/health": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "failures": {
                      "type": "integer"
                    },
                    "last_sync_at": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "pending": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "pending",
                    "failures",
                    "last_sync_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Mirror health"
          }
        },
        "summary": "Telegram ticket mirror health",
        "x-audit": "support.telegram.health",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "notify.delivery.read",
        "x-rate-limit": "notify.telegram.callback",
        "x-reauth": false
      }
    },
    "/api/v1/admin/tickets": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "enum": [
                "open",
                "awaiting_staff",
                "awaiting_user",
                "resolved",
                "closed"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "maxLength": 4096,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "default": "false",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          },
          {
            "description": "`me`, `unassigned` or a staff user id",
            "in": "query",
            "name": "assignee",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "me",
                    "unassigned"
                  ],
                  "type": "string"
                },
                {
                  "format": "uuid",
                  "type": "string"
                }
              ],
              "description": "`me`, `unassigned` or a staff user id"
            }
          },
          {
            "description": "Ticket number (with or without `T-`), ticket id, or a customer as the admin user search reads it",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "description": "Ticket number (with or without `T-`), ticket id, or a customer as the admin user search reads it",
              "maxLength": 256,
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "assignee_staff_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "available_actions": {
                            "items": {
                              "enum": [
                                "assign",
                                "reply",
                                "note",
                                "close",
                                "reopen",
                                "transition:open",
                                "transition:awaiting_staff",
                                "transition:awaiting_user",
                                "transition:resolved",
                                "transition:closed"
                              ],
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "category": {
                            "type": "string"
                          },
                          "created_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "customer": {
                            "properties": {
                              "email": {
                                "description": "Masked customer email",
                                "type": "string"
                              },
                              "public_id": {
                                "type": "string"
                              }
                            },
                            "required": [
                              "public_id",
                              "email"
                            ],
                            "type": "object"
                          },
                          "first_responded_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "first_response_due_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "last_message_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "priority": {
                            "enum": [
                              "low",
                              "normal",
                              "high",
                              "urgent"
                            ],
                            "type": "string"
                          },
                          "related_order_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "related_subscription_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "resolution_due_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "resolved_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "staff_unread": {
                            "type": "boolean"
                          },
                          "status": {
                            "enum": [
                              "open",
                              "awaiting_staff",
                              "awaiting_user",
                              "resolved",
                              "closed"
                            ],
                            "type": "string"
                          },
                          "subject": {
                            "type": "string"
                          },
                          "ticket_no": {
                            "type": "string"
                          },
                          "user_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "user_unread": {
                            "type": "boolean"
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "id",
                          "ticket_no",
                          "user_id",
                          "subject",
                          "category",
                          "priority",
                          "status",
                          "assignee_staff_id",
                          "related_order_id",
                          "related_subscription_id",
                          "first_response_due_at",
                          "resolution_due_at",
                          "first_responded_at",
                          "resolved_at",
                          "last_message_at",
                          "user_unread",
                          "staff_unread",
                          "created_at",
                          "version",
                          "available_actions",
                          "customer"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "summary": "List tickets",
        "tags": [
          "tickets"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "support.ticket.handle",
        "x-rate-limit": "support.tickets",
        "x-reauth": false
      }
    },
    "/api/v1/admin/tickets/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "assignee_staff_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "available_actions": {
                      "items": {
                        "enum": [
                          "assign",
                          "reply",
                          "note",
                          "close",
                          "reopen",
                          "transition:open",
                          "transition:awaiting_staff",
                          "transition:awaiting_user",
                          "transition:resolved",
                          "transition:closed"
                        ],
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "category": {
                      "type": "string"
                    },
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "customer": {
                      "properties": {
                        "email": {
                          "description": "Masked customer email",
                          "type": "string"
                        },
                        "public_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "public_id",
                        "email"
                      ],
                      "type": "object"
                    },
                    "first_responded_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "first_response_due_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "last_message_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "priority": {
                      "enum": [
                        "low",
                        "normal",
                        "high",
                        "urgent"
                      ],
                      "type": "string"
                    },
                    "related_order_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "related_subscription_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolution_due_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolved_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "staff_unread": {
                      "type": "boolean"
                    },
                    "status": {
                      "enum": [
                        "open",
                        "awaiting_staff",
                        "awaiting_user",
                        "resolved",
                        "closed"
                      ],
                      "type": "string"
                    },
                    "subject": {
                      "type": "string"
                    },
                    "ticket_no": {
                      "type": "string"
                    },
                    "user_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "user_unread": {
                      "type": "boolean"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "ticket_no",
                    "user_id",
                    "subject",
                    "category",
                    "priority",
                    "status",
                    "assignee_staff_id",
                    "related_order_id",
                    "related_subscription_id",
                    "first_response_due_at",
                    "resolution_due_at",
                    "first_responded_at",
                    "resolved_at",
                    "last_message_at",
                    "user_unread",
                    "staff_unread",
                    "created_at",
                    "version",
                    "available_actions",
                    "customer"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid transition or stale version"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid ticket input"
          }
        },
        "summary": "Ticket detail",
        "tags": [
          "tickets"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "support.ticket.handle",
        "x-rate-limit": "support.tickets",
        "x-reauth": false
      }
    },
    "/api/v1/admin/tickets/{id}/assign": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "assignee_staff_id": {
                    "format": "uuid",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "assignee_staff_id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "assignee_staff_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "available_actions": {
                      "items": {
                        "enum": [
                          "assign",
                          "reply",
                          "note",
                          "close",
                          "reopen",
                          "transition:open",
                          "transition:awaiting_staff",
                          "transition:awaiting_user",
                          "transition:resolved",
                          "transition:closed"
                        ],
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "category": {
                      "type": "string"
                    },
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "customer": {
                      "properties": {
                        "email": {
                          "description": "Masked customer email",
                          "type": "string"
                        },
                        "public_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "public_id",
                        "email"
                      ],
                      "type": "object"
                    },
                    "first_responded_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "first_response_due_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "last_message_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "priority": {
                      "enum": [
                        "low",
                        "normal",
                        "high",
                        "urgent"
                      ],
                      "type": "string"
                    },
                    "related_order_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "related_subscription_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolution_due_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolved_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "staff_unread": {
                      "type": "boolean"
                    },
                    "status": {
                      "enum": [
                        "open",
                        "awaiting_staff",
                        "awaiting_user",
                        "resolved",
                        "closed"
                      ],
                      "type": "string"
                    },
                    "subject": {
                      "type": "string"
                    },
                    "ticket_no": {
                      "type": "string"
                    },
                    "user_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "user_unread": {
                      "type": "boolean"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "ticket_no",
                    "user_id",
                    "subject",
                    "category",
                    "priority",
                    "status",
                    "assignee_staff_id",
                    "related_order_id",
                    "related_subscription_id",
                    "first_response_due_at",
                    "resolution_due_at",
                    "first_responded_at",
                    "resolved_at",
                    "last_message_at",
                    "user_unread",
                    "staff_unread",
                    "created_at",
                    "version",
                    "available_actions",
                    "customer"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid transition or stale version"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid ticket input"
          }
        },
        "summary": "Assign a ticket",
        "tags": [
          "tickets"
        ],
        "x-audit": "support.ticket.assign",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "support.ticket.handle",
        "x-rate-limit": "support.tickets",
        "x-reauth": false
      }
    },
    "/api/v1/admin/tickets/{id}/messages": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "before",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "author_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "author_type": {
                            "enum": [
                              "user",
                              "staff",
                              "system"
                            ],
                            "type": "string"
                          },
                          "body_md": {
                            "type": "string"
                          },
                          "created_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "file_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "internal": {
                            "type": "boolean"
                          },
                          "ticket_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "ticket_id",
                          "author_type",
                          "author_id",
                          "internal",
                          "body_md",
                          "file_ids",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not found"
          }
        },
        "summary": "Ticket messages",
        "tags": [
          "tickets"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "support.ticket.handle",
        "x-rate-limit": "support.tickets",
        "x-reauth": false
      },
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "body_md": {
                    "maxLength": 40000,
                    "minLength": 1,
                    "type": "string"
                  },
                  "file_ids": {
                    "default": [],
                    "items": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "maxItems": 10,
                    "type": "array"
                  }
                },
                "required": [
                  "body_md"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid transition or stale version"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid ticket input"
          }
        },
        "summary": "Reply to a ticket",
        "tags": [
          "tickets"
        ],
        "x-audit": "support.ticket.reply",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "optional",
        "x-permission": "support.ticket.handle",
        "x-rate-limit": "support.tickets",
        "x-reauth": false
      }
    },
    "/api/v1/admin/tickets/{id}/notes": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "body_md": {
                    "maxLength": 40000,
                    "minLength": 1,
                    "type": "string"
                  },
                  "file_ids": {
                    "default": [],
                    "items": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "maxItems": 10,
                    "type": "array"
                  }
                },
                "required": [
                  "body_md"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid transition or stale version"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid ticket input"
          }
        },
        "summary": "Add an internal note",
        "tags": [
          "tickets"
        ],
        "x-audit": "support.ticket.note",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "optional",
        "x-permission": "support.ticket.handle",
        "x-rate-limit": "support.tickets",
        "x-reauth": false
      }
    },
    "/api/v1/admin/tickets/{id}/transition": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "reopen": {
                    "default": false,
                    "type": "boolean"
                  },
                  "status": {
                    "enum": [
                      "open",
                      "awaiting_staff",
                      "awaiting_user",
                      "resolved",
                      "closed"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "status"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "assignee_staff_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "available_actions": {
                      "items": {
                        "enum": [
                          "assign",
                          "reply",
                          "note",
                          "close",
                          "reopen",
                          "transition:open",
                          "transition:awaiting_staff",
                          "transition:awaiting_user",
                          "transition:resolved",
                          "transition:closed"
                        ],
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "category": {
                      "type": "string"
                    },
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "customer": {
                      "properties": {
                        "email": {
                          "description": "Masked customer email",
                          "type": "string"
                        },
                        "public_id": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "public_id",
                        "email"
                      ],
                      "type": "object"
                    },
                    "first_responded_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "first_response_due_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "last_message_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "priority": {
                      "enum": [
                        "low",
                        "normal",
                        "high",
                        "urgent"
                      ],
                      "type": "string"
                    },
                    "related_order_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "related_subscription_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolution_due_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolved_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "staff_unread": {
                      "type": "boolean"
                    },
                    "status": {
                      "enum": [
                        "open",
                        "awaiting_staff",
                        "awaiting_user",
                        "resolved",
                        "closed"
                      ],
                      "type": "string"
                    },
                    "subject": {
                      "type": "string"
                    },
                    "ticket_no": {
                      "type": "string"
                    },
                    "user_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "user_unread": {
                      "type": "boolean"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "ticket_no",
                    "user_id",
                    "subject",
                    "category",
                    "priority",
                    "status",
                    "assignee_staff_id",
                    "related_order_id",
                    "related_subscription_id",
                    "first_response_due_at",
                    "resolution_due_at",
                    "first_responded_at",
                    "resolved_at",
                    "last_message_at",
                    "user_unread",
                    "staff_unread",
                    "created_at",
                    "version",
                    "available_actions",
                    "customer"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid transition or stale version"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid ticket input"
          }
        },
        "summary": "Transition a ticket",
        "tags": [
          "tickets"
        ],
        "x-audit": "support.ticket.transition",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "support.ticket.handle",
        "x-rate-limit": "support.tickets",
        "x-reauth": false
      }
    },
    "/api/v1/admin/usage/rankings": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "date",
            "required": true,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "by",
            "required": true,
            "schema": {
              "enum": [
                "subscription",
                "server"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "maxLength": 200,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageRankings"
                }
              }
            },
            "description": "Success"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          }
        },
        "summary": "Daily traffic rankings",
        "tags": [
          "usage"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "usage.read",
        "x-reauth": false
      }
    },
    "/api/v1/admin/usage/reconciliations": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "created_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "report": {
                            "$ref": "#/components/schemas/UsageReconciliationReport"
                          }
                        },
                        "required": [
                          "id",
                          "created_at",
                          "report"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "has_more",
                    "next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          }
        },
        "summary": "Usage reconciliation reports with evidence gaps and exception links",
        "tags": [
          "usage"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "usage.reconciliation.run",
        "x-rate-limit": "usage.reconciliation.read",
        "x-reauth": false
      },
      "post": {
        "parameters": [
          {
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {},
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "job_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "queued": {
                      "enum": [
                        true
                      ],
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "job_id",
                    "queued"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          }
        },
        "summary": "Enqueue usage reconciliation on the heavy queue",
        "tags": [
          "usage"
        ],
        "x-audit": "usage.reconciliation.run",
        "x-body": "json",
        "x-body-limit": 1024,
        "x-idempotency": "required",
        "x-permission": "usage.reconciliation.run",
        "x-rate-limit": "usage.reconciliation.run",
        "x-reauth": true
      }
    },
    "/api/v1/admin/usage/servers/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "date_from",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageDaily"
                }
              }
            },
            "description": "Success"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          }
        },
        "summary": "Daily traffic drill-down",
        "tags": [
          "usage"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "usage.read",
        "x-reauth": false
      }
    },
    "/api/v1/admin/usage/subscriptions/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "date_from",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageDaily"
                }
              }
            },
            "description": "Success"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          }
        },
        "summary": "Daily traffic drill-down",
        "tags": [
          "usage"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "usage.read",
        "x-reauth": false
      }
    },
    "/api/v1/admin/user-coupons/{id}/revoke": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserCouponRevoke"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserCoupon"
                }
              }
            },
            "description": "The revoked coupon"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such coupon"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "growth.coupon_unavailable: held by an order, used, expired or already revoked (with current)"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Validation failed"
          }
        },
        "summary": "Revoke an unused coupon (reason required)",
        "tags": [
          "coupons"
        ],
        "x-audit": "growth.user_coupon.revoke",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "optional",
        "x-permission": "growth.coupon.issue"
      }
    },
    "/api/v1/admin/users": {
      "get": {
        "parameters": [
          {
            "description": "Email (exact, or prefix), phone, user id, public id, subscription id, node credential UUID or node id, or the lowercase hex SHA-256 fingerprint (≥ 12 digits, prefix) of a subscription-link token or node credential — hash secrets client-side, never send them",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "description": "Email (exact, or prefix), phone, user id, public id, subscription id, node credential UUID or node id, or the lowercase hex SHA-256 fingerprint (≥ 12 digits, prefix) of a subscription-link token or node credential — hash secrets client-side, never send them",
              "maxLength": 64,
              "type": "string"
            }
          },
          {
            "description": "Account status; repeat the parameter for several values",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "active",
                    "disabled",
                    "banned",
                    "deactivating",
                    "deleted"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "active",
                      "disabled",
                      "banned",
                      "deactivating",
                      "deleted"
                    ],
                    "type": "string"
                  },
                  "maxItems": 20,
                  "type": "array"
                }
              ],
              "description": "Account status; repeat the parameter for several values"
            }
          },
          {
            "description": "Holds this staff role (not customer: use staff=false); repeat the parameter for several values",
            "in": "query",
            "name": "role",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "items": {
                    "type": "string"
                  },
                  "maxItems": 20,
                  "type": "array"
                }
              ],
              "description": "Holds this staff role (not customer: use staff=false); repeat the parameter for several values"
            }
          },
          {
            "description": "true: holds a role other than customer; false: customers only",
            "in": "query",
            "name": "staff",
            "required": false,
            "schema": {
              "description": "true: holds a role other than customer; false: customers only",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          },
          {
            "description": "Referrer user id",
            "in": "query",
            "name": "invited_by",
            "required": false,
            "schema": {
              "description": "Referrer user id",
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Registered at or after",
            "in": "query",
            "name": "created_from",
            "required": false,
            "schema": {
              "description": "Registered at or after",
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Registered before",
            "in": "query",
            "name": "created_to",
            "required": false,
            "schema": {
              "description": "Registered before",
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Holds an active or exhausted subscription ending at or after",
            "in": "query",
            "name": "subscription_ends_from",
            "required": false,
            "schema": {
              "description": "Holds an active or exhausted subscription ending at or after",
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "… ending before",
            "in": "query",
            "name": "subscription_ends_to",
            "required": false,
            "schema": {
              "description": "… ending before",
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Default created_at (desc); email (asc)",
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "description": "Default created_at (desc); email (asc)",
              "enum": [
                "created_at",
                "email"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "order",
            "required": false,
            "schema": {
              "enum": [
                "asc",
                "desc"
              ],
              "type": "string"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 2048,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Jump to page (admin only; not with cursor; offset ≤ 10,000)",
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "description": "Jump to page (admin only; not with cursor; offset ≤ 10,000)",
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "Return `total` (first page only)",
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "description": "Return `total` (first page only)",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminUserPage"
                }
              }
            },
            "description": "A page of accounts"
          }
        },
        "summary": "Search and list accounts (masked; keyset pagination)",
        "tags": [
          "admin"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "iam.user.read"
      }
    },
    "/api/v1/admin/users/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminUserDetail"
                }
              }
            },
            "description": "Account",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Account detail with roles (masked; ETag = user version)",
        "tags": [
          "admin"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "iam.user.read"
      },
      "patch": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AdminUserPatch"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminUserDetail"
                }
              }
            },
            "description": "Updated account",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Edit name, language, time zone or email using If-Match. For staff targets, the caller must hold every target permission and cannot target itself.",
        "tags": [
          "admin"
        ],
        "x-audit": "iam.user.update",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "none",
        "x-permission": "iam.user.update"
      }
    },
    "/api/v1/admin/users/{id}/coupons": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Status; repeat the parameter for several values",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "available",
                    "reserved",
                    "consumed",
                    "released",
                    "reversed",
                    "expired",
                    "revoked"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "available",
                      "reserved",
                      "consumed",
                      "released",
                      "reversed",
                      "expired",
                      "revoked"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Status; repeat the parameter for several values"
            }
          },
          {
            "description": "Return `total` (first page only)",
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "description": "Return `total` (first page only)",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserCouponPage"
                }
              }
            },
            "description": "A page of the user’s coupons"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid filter or cursor"
          }
        },
        "summary": "A user's coupons and code uses, newest first",
        "tags": [
          "coupons"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "growth.coupon.issue"
      }
    },
    "/api/v1/admin/users/{id}/referral-level": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "level": {
                      "additionalProperties": false,
                      "properties": {
                        "first_order_rate_bps": {
                          "maximum": 10000,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "i18n": {
                          "additionalProperties": {
                            "additionalProperties": false,
                            "properties": {
                              "_meta": {
                                "additionalProperties": false,
                                "properties": {
                                  "origin": {
                                    "enum": [
                                      "manual",
                                      "machine",
                                      "builtin"
                                    ],
                                    "type": "string"
                                  },
                                  "provider": {
                                    "maxLength": 64,
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "origin"
                                ],
                                "type": "object"
                              },
                              "description": {
                                "maxLength": 1000,
                                "type": "string"
                              },
                              "name": {
                                "maxLength": 64,
                                "minLength": 1,
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "default": {},
                          "type": "object"
                        },
                        "id": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "is_base": {
                          "type": "boolean"
                        },
                        "name": {
                          "maxLength": 64,
                          "minLength": 1,
                          "type": "string"
                        },
                        "rank": {
                          "type": "integer"
                        },
                        "recurring_rate_bps": {
                          "maximum": 10000,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "retain_min_net_paid_minor": {
                          "default": null,
                          "pattern": "^[1-9]\\d{0,17}$",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "retain_min_paid_invitees": {
                          "default": null,
                          "exclusiveMinimum": 0,
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "source_locale": {
                          "default": "zh-CN",
                          "maxLength": 20,
                          "minLength": 2,
                          "type": "string"
                        },
                        "status": {
                          "default": "active",
                          "enum": [
                            "active",
                            "disabled"
                          ],
                          "type": "string"
                        },
                        "upgrade_min_net_paid_minor": {
                          "default": null,
                          "pattern": "^[1-9]\\d{0,17}$",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "upgrade_min_paid_invitees": {
                          "default": null,
                          "exclusiveMinimum": 0,
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "version": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "name",
                        "rank",
                        "first_order_rate_bps",
                        "recurring_rate_bps",
                        "id",
                        "is_base",
                        "version"
                      ],
                      "type": "object"
                    },
                    "locked": {
                      "type": "boolean"
                    },
                    "next_level": {
                      "additionalProperties": false,
                      "properties": {
                        "first_order_rate_bps": {
                          "maximum": 10000,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "i18n": {
                          "additionalProperties": {
                            "additionalProperties": false,
                            "properties": {
                              "_meta": {
                                "additionalProperties": false,
                                "properties": {
                                  "origin": {
                                    "enum": [
                                      "manual",
                                      "machine",
                                      "builtin"
                                    ],
                                    "type": "string"
                                  },
                                  "provider": {
                                    "maxLength": 64,
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "origin"
                                ],
                                "type": "object"
                              },
                              "description": {
                                "maxLength": 1000,
                                "type": "string"
                              },
                              "name": {
                                "maxLength": 64,
                                "minLength": 1,
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "default": {},
                          "type": "object"
                        },
                        "id": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "is_base": {
                          "type": "boolean"
                        },
                        "name": {
                          "maxLength": 64,
                          "minLength": 1,
                          "type": "string"
                        },
                        "rank": {
                          "type": "integer"
                        },
                        "recurring_rate_bps": {
                          "maximum": 10000,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "retain_min_net_paid_minor": {
                          "default": null,
                          "pattern": "^[1-9]\\d{0,17}$",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "retain_min_paid_invitees": {
                          "default": null,
                          "exclusiveMinimum": 0,
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "source_locale": {
                          "default": "zh-CN",
                          "maxLength": 20,
                          "minLength": 2,
                          "type": "string"
                        },
                        "status": {
                          "default": "active",
                          "enum": [
                            "active",
                            "disabled"
                          ],
                          "type": "string"
                        },
                        "upgrade_min_net_paid_minor": {
                          "default": null,
                          "pattern": "^[1-9]\\d{0,17}$",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "upgrade_min_paid_invitees": {
                          "default": null,
                          "exclusiveMinimum": 0,
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "version": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "name",
                        "rank",
                        "first_order_rate_bps",
                        "recurring_rate_bps",
                        "id",
                        "is_base",
                        "version"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "performance": {
                      "properties": {
                        "net_paid_minor": {
                          "pattern": "^\\d{1,18}$",
                          "type": "string"
                        },
                        "paid_invitees": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "paid_invitees",
                        "net_paid_minor"
                      ],
                      "type": "object"
                    },
                    "referral_level_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "until": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "referral_level_id",
                    "until",
                    "locked",
                    "version",
                    "level",
                    "performance",
                    "next_level"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Resource not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "State or version conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "User referral level and assessment progress",
        "tags": [
          "referral"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "growth.referral.read"
      },
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "level_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "locked": {
                    "type": "boolean"
                  },
                  "reason": {
                    "maxLength": 500,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "reason"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "level": {
                      "additionalProperties": false,
                      "properties": {
                        "first_order_rate_bps": {
                          "maximum": 10000,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "i18n": {
                          "additionalProperties": {
                            "additionalProperties": false,
                            "properties": {
                              "_meta": {
                                "additionalProperties": false,
                                "properties": {
                                  "origin": {
                                    "enum": [
                                      "manual",
                                      "machine",
                                      "builtin"
                                    ],
                                    "type": "string"
                                  },
                                  "provider": {
                                    "maxLength": 64,
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "origin"
                                ],
                                "type": "object"
                              },
                              "description": {
                                "maxLength": 1000,
                                "type": "string"
                              },
                              "name": {
                                "maxLength": 64,
                                "minLength": 1,
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "default": {},
                          "type": "object"
                        },
                        "id": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "is_base": {
                          "type": "boolean"
                        },
                        "name": {
                          "maxLength": 64,
                          "minLength": 1,
                          "type": "string"
                        },
                        "rank": {
                          "type": "integer"
                        },
                        "recurring_rate_bps": {
                          "maximum": 10000,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "retain_min_net_paid_minor": {
                          "default": null,
                          "pattern": "^[1-9]\\d{0,17}$",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "retain_min_paid_invitees": {
                          "default": null,
                          "exclusiveMinimum": 0,
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "source_locale": {
                          "default": "zh-CN",
                          "maxLength": 20,
                          "minLength": 2,
                          "type": "string"
                        },
                        "status": {
                          "default": "active",
                          "enum": [
                            "active",
                            "disabled"
                          ],
                          "type": "string"
                        },
                        "upgrade_min_net_paid_minor": {
                          "default": null,
                          "pattern": "^[1-9]\\d{0,17}$",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "upgrade_min_paid_invitees": {
                          "default": null,
                          "exclusiveMinimum": 0,
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "version": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "name",
                        "rank",
                        "first_order_rate_bps",
                        "recurring_rate_bps",
                        "id",
                        "is_base",
                        "version"
                      ],
                      "type": "object"
                    },
                    "locked": {
                      "type": "boolean"
                    },
                    "next_level": {
                      "additionalProperties": false,
                      "properties": {
                        "first_order_rate_bps": {
                          "maximum": 10000,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "i18n": {
                          "additionalProperties": {
                            "additionalProperties": false,
                            "properties": {
                              "_meta": {
                                "additionalProperties": false,
                                "properties": {
                                  "origin": {
                                    "enum": [
                                      "manual",
                                      "machine",
                                      "builtin"
                                    ],
                                    "type": "string"
                                  },
                                  "provider": {
                                    "maxLength": 64,
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "origin"
                                ],
                                "type": "object"
                              },
                              "description": {
                                "maxLength": 1000,
                                "type": "string"
                              },
                              "name": {
                                "maxLength": 64,
                                "minLength": 1,
                                "type": "string"
                              }
                            },
                            "type": "object"
                          },
                          "default": {},
                          "type": "object"
                        },
                        "id": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "is_base": {
                          "type": "boolean"
                        },
                        "name": {
                          "maxLength": 64,
                          "minLength": 1,
                          "type": "string"
                        },
                        "rank": {
                          "type": "integer"
                        },
                        "recurring_rate_bps": {
                          "maximum": 10000,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "retain_min_net_paid_minor": {
                          "default": null,
                          "pattern": "^[1-9]\\d{0,17}$",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "retain_min_paid_invitees": {
                          "default": null,
                          "exclusiveMinimum": 0,
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "source_locale": {
                          "default": "zh-CN",
                          "maxLength": 20,
                          "minLength": 2,
                          "type": "string"
                        },
                        "status": {
                          "default": "active",
                          "enum": [
                            "active",
                            "disabled"
                          ],
                          "type": "string"
                        },
                        "upgrade_min_net_paid_minor": {
                          "default": null,
                          "pattern": "^[1-9]\\d{0,17}$",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "upgrade_min_paid_invitees": {
                          "default": null,
                          "exclusiveMinimum": 0,
                          "type": [
                            "integer",
                            "null"
                          ]
                        },
                        "version": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "name",
                        "rank",
                        "first_order_rate_bps",
                        "recurring_rate_bps",
                        "id",
                        "is_base",
                        "version"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "performance": {
                      "properties": {
                        "net_paid_minor": {
                          "pattern": "^\\d{1,18}$",
                          "type": "string"
                        },
                        "paid_invitees": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "paid_invitees",
                        "net_paid_minor"
                      ],
                      "type": "object"
                    },
                    "referral_level_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "until": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "referral_level_id",
                    "until",
                    "locked",
                    "version",
                    "level",
                    "performance",
                    "next_level"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Resource not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "State or version conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Assign or lock a referral level",
        "tags": [
          "referral"
        ],
        "x-audit": "growth.level.assign",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "growth.referral.manage",
        "x-reauth": false
      }
    },
    "/api/v1/admin/users/{id}/referrer": {
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "reason": {
                    "maxLength": 500,
                    "minLength": 1,
                    "type": "string"
                  },
                  "referrer_user_id": {
                    "format": "uuid",
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                },
                "required": [
                  "referrer_user_id",
                  "reason"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "referrer_user_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "user_id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "user_id",
                    "referrer_user_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Resource not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "State or version conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Correct referrer for future orders",
        "tags": [
          "referral"
        ],
        "x-audit": "growth.referrer.correct",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "ifMatch": true
        },
        "x-idempotency": "optional",
        "x-permission": "growth.referral.manage",
        "x-reauth": false
      }
    },
    "/api/v1/admin/users/{id}/sensitive": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminUserSensitive"
                }
              }
            },
            "description": "Contact data"
          }
        },
        "summary": "Full email and phone (re-authentication; audited)",
        "tags": [
          "admin"
        ],
        "x-audit": "iam.user.sensitive.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "iam.user.read_sensitive",
        "x-reauth": true
      }
    },
    "/api/v1/admin/users/{id}/sessions/revoke": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SessionsRevoked"
                }
              }
            },
            "description": "Revoked"
          }
        },
        "summary": "Revoke every session of an account",
        "tags": [
          "admin"
        ],
        "x-audit": "iam.user.sessions.revoke",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "iam.user.session_revoke"
      }
    },
    "/api/v1/admin/users/{id}/status": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserStatusChange"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserStatus"
                }
              }
            },
            "description": "Status",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Enable, disable or ban an account (deletes its sessions; If-Match = user version)",
        "tags": [
          "admin"
        ],
        "x-audit": "iam.user.status",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "none",
        "x-permission": "iam.user.status"
      }
    },
    "/api/v1/admin/users/{id}/wallet": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wallet"
                }
              }
            },
            "description": "The wallet",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No wallet for this user"
          }
        },
        "summary": "A user's balances (ETag: wallet version)",
        "tags": [
          "wallet"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "ledger.entry.read"
      }
    },
    "/api/v1/admin/users/{userId}/privacy": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "anonymized": {
                      "type": "boolean"
                    },
                    "policy": {
                      "properties": {
                        "cooling_off_days": {
                          "type": "integer"
                        },
                        "version": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "cooling_off_days",
                        "version"
                      ],
                      "type": "object"
                    },
                    "request": {
                      "properties": {
                        "blocked_reasons": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "completed_steps": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "cooling_off_until": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "id": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "user_id": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "version": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "id",
                        "user_id",
                        "status",
                        "cooling_off_until",
                        "completed_steps",
                        "blocked_reasons",
                        "version"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "retention_hold": {
                      "type": "boolean"
                    },
                    "settlement": {
                      "properties": {
                        "balances": {
                          "properties": {
                            "cash_minor": {
                              "type": "string"
                            },
                            "commission_minor": {
                              "type": "string"
                            },
                            "commission_pending_minor": {
                              "type": "string"
                            },
                            "gift_minor": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "cash_minor",
                            "gift_minor",
                            "commission_pending_minor",
                            "commission_minor"
                          ],
                          "type": "object"
                        },
                        "blocked_reasons": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "can_forfeit": {
                          "type": "boolean"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "version": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "blocked_reasons",
                        "currency",
                        "version",
                        "can_forfeit",
                        "balances"
                      ],
                      "type": "object"
                    },
                    "status": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "status",
                    "retention_hold",
                    "anonymized",
                    "version",
                    "policy",
                    "request"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Privacy"
        ],
        "x-audit": "ops.privacy.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "ops.privacy.manage",
        "x-rate-limit": "iam.privacy.user",
        "x-reauth": false
      }
    },
    "/api/v1/admin/users/{userId}/privacy/cancel": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Cancelled"
          }
        },
        "tags": [
          "Privacy"
        ],
        "x-audit": "ops.privacy.cancel",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required",
        "x-permission": "ops.privacy.manage",
        "x-rate-limit": "iam.privacy.user",
        "x-reauth": true
      }
    },
    "/api/v1/admin/users/{userId}/privacy/hold": {
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "reason": {
                    "maxLength": 500,
                    "minLength": 1,
                    "type": "string"
                  },
                  "retention_hold": {
                    "type": "boolean"
                  },
                  "version": {
                    "minimum": 1,
                    "type": "integer"
                  }
                },
                "required": [
                  "retention_hold",
                  "version",
                  "reason"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "retention_hold": {
                      "type": "boolean"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "retention_hold",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Privacy"
        ],
        "x-audit": "ops.privacy.hold",
        "x-body": "json",
        "x-body-limit": 4096,
        "x-idempotency": "required",
        "x-permission": "ops.privacy.manage",
        "x-rate-limit": "iam.privacy.user",
        "x-reauth": true
      }
    },
    "/api/v1/admin/wallet-adjustments": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "enum": [
                "pending",
                "approved",
                "rejected",
                "withdrawn",
                "expired"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "$ref": "#/components/schemas/WalletAdjustmentReview"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "policy": {
                      "properties": {
                        "adjustment_approval_threshold_units": {
                          "type": "string"
                        },
                        "adjustment_request_ttl_days": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "adjustment_approval_threshold_units",
                        "adjustment_request_ttl_days"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "items",
                    "has_more",
                    "next_cursor",
                    "policy"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Review requests"
          }
        },
        "summary": "Adjustment approval queue",
        "tags": [
          "wallet"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "ledger.entry.read"
      },
      "post": {
        "parameters": [
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WalletAdjustmentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WalletAdjustment"
                }
              }
            },
            "description": "Posted below threshold, otherwise pending independent review"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "auth.reauth_required"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such user"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "ledger.insufficient_balance: a debit would overdraw the bucket"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "ledger.amount_invalid (currency other than the wallet’s) or common.validation_failed"
          }
        },
        "summary": "Adjust the cash or gift balance of a user (reason required)",
        "tags": [
          "wallet"
        ],
        "x-audit": "ledger.adjustment.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-permission": "ledger.adjustment.create",
        "x-reauth": true
      }
    },
    "/api/v1/admin/wallet-adjustments/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WalletAdjustmentReview"
                }
              }
            },
            "description": "Request",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found"
          }
        },
        "summary": "Adjustment review request",
        "tags": [
          "wallet"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-permission": "ledger.entry.read"
      }
    },
    "/api/v1/admin/wallet-adjustments/{id}/approve": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "if-match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "reason": {
                    "maxLength": 500,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WalletAdjustmentReview"
                }
              }
            },
            "description": "Decision",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Independent reviewer required"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Stale, expired, decided or insufficient balance"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "approve an adjustment request",
        "tags": [
          "wallet"
        ],
        "x-audit": "ledger.adjustment.approve",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "ledger.adjustment.approve",
        "x-reauth": true
      }
    },
    "/api/v1/admin/wallet-adjustments/{id}/reject": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "if-match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "reason": {
                    "maxLength": 500,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "reason"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WalletAdjustmentReview"
                }
              }
            },
            "description": "Decision",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Independent reviewer required"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Stale, expired, decided or insufficient balance"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "reject an adjustment request",
        "tags": [
          "wallet"
        ],
        "x-audit": "ledger.adjustment.reject",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "ledger.adjustment.approve",
        "x-reauth": true
      }
    },
    "/api/v1/admin/wallet-adjustments/{id}/withdraw": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "if-match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "reason": {
                    "maxLength": 500,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WalletAdjustmentReview"
                }
              }
            },
            "description": "Decision",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Independent reviewer required"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Stale, expired, decided or insufficient balance"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "withdraw an adjustment request",
        "tags": [
          "wallet"
        ],
        "x-audit": "ledger.adjustment.withdraw",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "ledger.adjustment.create",
        "x-reauth": false
      }
    },
    "/api/v1/admin/wallet-entries": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "reference_type",
            "required": false,
            "schema": {
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "reference_id",
            "required": false,
            "schema": {
              "maxLength": 200,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "operation_key",
            "required": false,
            "schema": {
              "maxLength": 200,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Bucket; repeat the parameter for several values",
            "in": "query",
            "name": "bucket",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "cash",
                    "gift",
                    "commission_pending",
                    "commission"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "cash",
                      "gift",
                      "commission_pending",
                      "commission"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Bucket; repeat the parameter for several values"
            }
          },
          {
            "description": "Entry kind; repeat the parameter for several values",
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "top_up",
                    "order_apply",
                    "order_release",
                    "order_reapply",
                    "order_payment",
                    "refund",
                    "admin_adjust",
                    "gift_grant",
                    "commission_accrue",
                    "commission_release",
                    "commission_reverse",
                    "commission_to_cash",
                    "withdraw_hold",
                    "withdraw_release",
                    "commission_withdraw_hold",
                    "commission_withdraw_release",
                    "commission_withdraw_settle",
                    "correction"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "top_up",
                      "order_apply",
                      "order_release",
                      "order_reapply",
                      "order_payment",
                      "refund",
                      "admin_adjust",
                      "gift_grant",
                      "commission_accrue",
                      "commission_release",
                      "commission_reverse",
                      "commission_to_cash",
                      "withdraw_hold",
                      "withdraw_release",
                      "commission_withdraw_hold",
                      "commission_withdraw_release",
                      "commission_withdraw_settle",
                      "correction"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Entry kind; repeat the parameter for several values"
            }
          },
          {
            "description": "Inclusive lower bound (ISO-8601)",
            "in": "query",
            "name": "created_from",
            "required": false,
            "schema": {
              "description": "Inclusive lower bound (ISO-8601)",
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Exclusive upper bound (ISO-8601)",
            "in": "query",
            "name": "created_to",
            "required": false,
            "schema": {
              "description": "Exclusive upper bound (ISO-8601)",
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Return `total` (first page only)",
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "description": "Return `total` (first page only)",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AdminWalletEntryPage"
                }
              }
            },
            "description": "A page of entries"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid filter or cursor"
          }
        },
        "summary": "Wallet entries of all users, newest first (keyset pages)",
        "tags": [
          "wallet"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-permission": "ledger.entry.read"
      }
    },
    "/api/v1/admin/withdrawals": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "enum": [
                "requested",
                "approved",
                "paid",
                "rejected",
                "cancelled"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "amount_minor": {
                            "type": "string"
                          },
                          "created_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "fee_minor": {
                            "type": "string"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "method": {
                            "type": "string"
                          },
                          "paid_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "paid_reference": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "payee_masked": {
                            "type": "string"
                          },
                          "payout_minor": {
                            "type": "string"
                          },
                          "review_reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reviewed_by": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "enum": [
                              "requested",
                              "approved",
                              "paid",
                              "rejected",
                              "cancelled"
                            ],
                            "type": "string"
                          },
                          "updated_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "user_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "version": {
                            "type": "integer"
                          },
                          "withdrawal_no": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "withdrawal_no",
                          "user_id",
                          "amount_minor",
                          "fee_minor",
                          "payout_minor",
                          "currency",
                          "method",
                          "payee_masked",
                          "status",
                          "review_reason",
                          "reviewed_by",
                          "paid_reference",
                          "paid_at",
                          "created_at",
                          "updated_at",
                          "version"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Withdrawal conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid withdrawal"
          }
        },
        "summary": "Withdrawal review queue",
        "tags": [
          "withdrawals"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "ledger.withdrawal.review",
        "x-rate-limit": "growth.withdrawal.command",
        "x-reauth": false
      }
    },
    "/api/v1/admin/withdrawals/{id}/approve": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "reason": {
                    "maxLength": 500,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "reason"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "amount_minor": {
                      "type": "string"
                    },
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "fee_minor": {
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "method": {
                      "type": "string"
                    },
                    "paid_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "paid_reference": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "payee_masked": {
                      "type": "string"
                    },
                    "payout_minor": {
                      "type": "string"
                    },
                    "review_reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reviewed_by": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "enum": [
                        "requested",
                        "approved",
                        "paid",
                        "rejected",
                        "cancelled"
                      ],
                      "type": "string"
                    },
                    "updated_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "user_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    },
                    "withdrawal_no": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "withdrawal_no",
                    "user_id",
                    "amount_minor",
                    "fee_minor",
                    "payout_minor",
                    "currency",
                    "method",
                    "payee_masked",
                    "status",
                    "review_reason",
                    "reviewed_by",
                    "paid_reference",
                    "paid_at",
                    "created_at",
                    "updated_at",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Withdrawal conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid withdrawal"
          }
        },
        "summary": "Approve withdrawal",
        "tags": [
          "withdrawals"
        ],
        "x-audit": "growth.withdrawal.approve",
        "x-body": "json",
        "x-body-limit": 8192,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "ledger.withdrawal.review",
        "x-rate-limit": "growth.withdrawal.command",
        "x-reauth": false
      }
    },
    "/api/v1/admin/withdrawals/{id}/mark-paid": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "reference": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "reference"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "amount_minor": {
                      "type": "string"
                    },
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "fee_minor": {
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "method": {
                      "type": "string"
                    },
                    "paid_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "paid_reference": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "payee_masked": {
                      "type": "string"
                    },
                    "payout_minor": {
                      "type": "string"
                    },
                    "review_reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reviewed_by": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "enum": [
                        "requested",
                        "approved",
                        "paid",
                        "rejected",
                        "cancelled"
                      ],
                      "type": "string"
                    },
                    "updated_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "user_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    },
                    "withdrawal_no": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "withdrawal_no",
                    "user_id",
                    "amount_minor",
                    "fee_minor",
                    "payout_minor",
                    "currency",
                    "method",
                    "payee_masked",
                    "status",
                    "review_reason",
                    "reviewed_by",
                    "paid_reference",
                    "paid_at",
                    "created_at",
                    "updated_at",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Withdrawal conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid withdrawal"
          }
        },
        "summary": "Record payment reference and settle commission",
        "tags": [
          "withdrawals"
        ],
        "x-audit": "growth.withdrawal.mark_paid",
        "x-body": "json",
        "x-body-limit": 8192,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "ledger.withdrawal.review",
        "x-rate-limit": "growth.withdrawal.command",
        "x-reauth": true
      }
    },
    "/api/v1/admin/withdrawals/{id}/payee": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "account": {
                      "maxLength": 200,
                      "minLength": 1,
                      "type": "string"
                    },
                    "bank": {
                      "maxLength": 200,
                      "minLength": 1,
                      "type": "string"
                    },
                    "name": {
                      "maxLength": 200,
                      "minLength": 1,
                      "type": "string"
                    }
                  },
                  "required": [
                    "name",
                    "account"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Withdrawal conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid withdrawal"
          }
        },
        "summary": "Reveal full payee details",
        "tags": [
          "withdrawals"
        ],
        "x-audit": "growth.withdrawal.reveal_payee",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-permission": "ledger.withdrawal.review",
        "x-rate-limit": "growth.withdrawal.command",
        "x-reauth": true
      }
    },
    "/api/v1/admin/withdrawals/{id}/reject": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "reason": {
                    "maxLength": 500,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "reason"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "amount_minor": {
                      "type": "string"
                    },
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "fee_minor": {
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "method": {
                      "type": "string"
                    },
                    "paid_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "paid_reference": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "payee_masked": {
                      "type": "string"
                    },
                    "payout_minor": {
                      "type": "string"
                    },
                    "review_reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reviewed_by": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "enum": [
                        "requested",
                        "approved",
                        "paid",
                        "rejected",
                        "cancelled"
                      ],
                      "type": "string"
                    },
                    "updated_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "user_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    },
                    "withdrawal_no": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "withdrawal_no",
                    "user_id",
                    "amount_minor",
                    "fee_minor",
                    "payout_minor",
                    "currency",
                    "method",
                    "payee_masked",
                    "status",
                    "review_reason",
                    "reviewed_by",
                    "paid_reference",
                    "paid_at",
                    "created_at",
                    "updated_at",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Withdrawal conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid withdrawal"
          }
        },
        "summary": "Reject withdrawal and release hold",
        "tags": [
          "withdrawals"
        ],
        "x-audit": "growth.withdrawal.reject",
        "x-body": "json",
        "x-body-limit": 8192,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-permission": "ledger.withdrawal.review",
        "x-rate-limit": "growth.withdrawal.command",
        "x-reauth": false
      }
    },
    "/api/v1/auth/callback/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "OAuth authorization-code callback",
        "tags": [
          "auth"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/auth/change-password": {
      "post": {
        "description": "Change the password of the user",
        "operationId": "changePassword",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "currentPassword": {
                    "description": "The current password is required",
                    "type": "string"
                  },
                  "newPassword": {
                    "description": "The new password to set",
                    "type": "string"
                  },
                  "revokeOtherSessions": {
                    "description": "Must be a boolean value",
                    "type": "boolean"
                  }
                },
                "required": [
                  "newPassword",
                  "currentPassword"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "token": {
                      "description": "New session token if other sessions were revoked",
                      "nullable": true,
                      "type": "string"
                    },
                    "user": {
                      "properties": {
                        "createdAt": {
                          "description": "When the user was created",
                          "format": "date-time",
                          "type": "string"
                        },
                        "email": {
                          "description": "The email address of the user",
                          "format": "email",
                          "type": "string"
                        },
                        "emailVerified": {
                          "description": "Whether the email has been verified",
                          "type": "boolean"
                        },
                        "id": {
                          "description": "The unique identifier of the user",
                          "type": "string"
                        },
                        "image": {
                          "description": "The profile image URL of the user",
                          "format": "uri",
                          "nullable": true,
                          "type": "string"
                        },
                        "name": {
                          "description": "The name of the user",
                          "type": "string"
                        },
                        "updatedAt": {
                          "description": "When the user was last updated",
                          "format": "date-time",
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "email",
                        "name",
                        "emailVerified",
                        "createdAt",
                        "updatedAt"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "user"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Password successfully changed"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Change the password (revokes the other sessions)",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.password.change",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none"
      }
    },
    "/api/v1/auth/device": {
      "get": {
        "description": "Verify user code and get device authorization status",
        "parameters": [
          {
            "in": "query",
            "name": "user_code",
            "schema": {
              "description": "The user code to verify",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "client_id": {
                      "description": "The client requesting authorization, returned only to the authenticated user who owns this request",
                      "type": "string"
                    },
                    "scope": {
                      "description": "The requested scopes, returned only to the authenticated user who owns this request",
                      "type": "string"
                    },
                    "status": {
                      "description": "Current status of the device authorization",
                      "enum": [
                        "pending",
                        "approved",
                        "denied"
                      ],
                      "type": "string"
                    },
                    "user_code": {
                      "description": "The user code to verify",
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Device authorization status"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Review and claim device user code",
        "tags": [
          "auth"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/auth/device/approve": {
      "post": {
        "description": "Approve device authorization",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "userCode": {
                    "description": "The user code to approve",
                    "type": "string"
                  }
                },
                "required": [
                  "userCode"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Approve device authorization",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.device.approve",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.mfa.ip"
      }
    },
    "/api/v1/auth/device/code": {
      "post": {
        "description": "Request a device and user code\n\nFollow [rfc8628#section-3.2](https://datatracker.ietf.org/doc/html/rfc8628#section-3.2)",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "client_id": {
                    "description": "The client ID of the application",
                    "type": "string"
                  },
                  "scope": {
                    "description": "Space-separated list of scopes",
                    "type": "string"
                  },
                  "user_id": {
                    "description": "The user ID to which the device code should be pre-bound.",
                    "type": "string"
                  }
                },
                "required": [
                  "client_id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "device_code": {
                      "description": "The device verification code",
                      "type": "string"
                    },
                    "expires_in": {
                      "description": "Lifetime in seconds of the device code",
                      "type": "number"
                    },
                    "interval": {
                      "description": "Minimum polling interval in seconds",
                      "type": "number"
                    },
                    "user_code": {
                      "description": "The user code to display",
                      "type": "string"
                    },
                    "verification_uri": {
                      "description": "The URL for user verification. Defaults to /device if not configured.",
                      "format": "uri",
                      "type": "string"
                    },
                    "verification_uri_complete": {
                      "description": "The complete URL with user code as query parameter.",
                      "format": "uri",
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "error": {
                      "enum": [
                        "invalid_request",
                        "invalid_client",
                        "unauthorized_client",
                        "invalid_scope"
                      ],
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Error response"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "error": {
                      "enum": [
                        "server_error"
                      ],
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Server error"
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Request device authorization",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.device.code",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.code.ip"
      }
    },
    "/api/v1/auth/device/deny": {
      "post": {
        "description": "Deny device authorization",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "userCode": {
                    "description": "The user code to deny",
                    "type": "string"
                  }
                },
                "required": [
                  "userCode"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Deny device authorization",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.device.deny",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.mfa.ip"
      }
    },
    "/api/v1/auth/device/token": {
      "post": {
        "description": "Exchange device code for access token\n\nFollow [rfc8628#section-3.4](https://datatracker.ietf.org/doc/html/rfc8628#section-3.4)",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "client_id": {
                    "description": "The client ID of the application",
                    "type": "string"
                  },
                  "device_code": {
                    "description": "The device verification code",
                    "type": "string"
                  },
                  "grant_type": {
                    "description": "The grant type for device flow",
                    "enum": [
                      "urn:ietf:params:oauth:grant-type:device_code"
                    ]
                  }
                },
                "required": [
                  "grant_type",
                  "device_code",
                  "client_id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "access_token": {
                      "type": "string"
                    },
                    "expires_in": {
                      "type": "integer"
                    },
                    "scope": {
                      "type": "string"
                    },
                    "token_type": {
                      "enum": [
                        "Bearer"
                      ],
                      "type": "string"
                    }
                  },
                  "required": [
                    "access_token",
                    "token_type",
                    "expires_in",
                    "scope"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Signed bearer session token"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "error": {
                      "enum": [
                        "authorization_pending",
                        "slow_down",
                        "expired_token",
                        "access_denied",
                        "invalid_request",
                        "invalid_grant"
                      ],
                      "type": "string"
                    },
                    "error_description": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Error response"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Poll device authorization",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.device.token",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.code.ip"
      }
    },
    "/api/v1/auth/email-otp/reset-password": {
      "post": {
        "description": "Reset password with email and OTP",
        "operationId": "resetPasswordWithEmailOTP",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "email": {
                    "description": "Email address to reset the password",
                    "type": "string"
                  },
                  "otp": {
                    "description": "OTP sent to the email",
                    "type": "string"
                  },
                  "password": {
                    "description": "New password",
                    "type": "string"
                  }
                },
                "required": [
                  "email",
                  "otp",
                  "password"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Reset the password with a code (revokes every session)",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.password.reset",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.code.ip"
      }
    },
    "/api/v1/auth/email-otp/send-verification-otp": {
      "post": {
        "description": "Send a verification OTP to an email",
        "operationId": "sendEmailVerificationOTP",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "email": {
                    "description": "Email address to send the OTP",
                    "type": "string"
                  },
                  "type": {
                    "description": "Type of the OTP",
                    "enum": [
                      "email-verification",
                      "sign-in",
                      "forget-password",
                      "change-email"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "email",
                  "type"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Send an email verification code",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.code.send",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.code.target"
      }
    },
    "/api/v1/auth/email-otp/verify-email": {
      "post": {
        "description": "Verify email with OTP",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "email": {
                    "description": "Email address to verify",
                    "type": "string"
                  },
                  "otp": {
                    "description": "OTP to verify",
                    "type": "string"
                  }
                },
                "required": [
                  "email",
                  "otp"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "status": {
                      "description": "Indicates if the verification was successful",
                      "enum": [
                        true
                      ],
                      "type": "boolean"
                    },
                    "token": {
                      "description": "Session token if autoSignInAfterVerification is enabled, otherwise null",
                      "nullable": true,
                      "type": "string"
                    },
                    "user": {
                      "properties": {
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "emailVerified": {
                          "default": false,
                          "readOnly": true,
                          "type": "boolean"
                        },
                        "id": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "image": {
                          "type": "string"
                        },
                        "inviteCodeId": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "invitedByUserId": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "invitedVia": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "locale": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "phoneNumber": {
                          "type": "string"
                        },
                        "phoneNumberVerified": {
                          "readOnly": true,
                          "type": "boolean"
                        },
                        "publicId": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "registeredVia": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "status": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "timeZone": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "twoFactorEnabled": {
                          "default": false,
                          "readOnly": true,
                          "type": "boolean"
                        },
                        "updatedAt": {
                          "format": "date-time",
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "email",
                        "emailVerified",
                        "createdAt",
                        "updatedAt"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "status",
                    "token",
                    "user"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Verify the email with a code (signs in)",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.email.verify",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.code.ip"
      }
    },
    "/api/v1/auth/get-session": {
      "get": {
        "description": "Get the current session",
        "operationId": "getSession",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "session": {
                      "properties": {
                        "absoluteExpiresAt": {
                          "format": "date-time",
                          "readOnly": true,
                          "type": "string"
                        },
                        "activeOrganizationId": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "clientKind": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "expiresAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "id": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "ipAddress": {
                          "type": "string"
                        },
                        "mfaVerifiedAt": {
                          "format": "date-time",
                          "readOnly": true,
                          "type": "string"
                        },
                        "reauthAt": {
                          "format": "date-time",
                          "readOnly": true,
                          "type": "string"
                        },
                        "token": {
                          "type": "string"
                        },
                        "updatedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "userAgent": {
                          "type": "string"
                        },
                        "userId": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "expiresAt",
                        "token",
                        "createdAt",
                        "updatedAt",
                        "userId"
                      ],
                      "type": "object"
                    },
                    "user": {
                      "properties": {
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "emailVerified": {
                          "default": false,
                          "readOnly": true,
                          "type": "boolean"
                        },
                        "id": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "image": {
                          "type": "string"
                        },
                        "inviteCodeId": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "invitedByUserId": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "invitedVia": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "locale": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "phoneNumber": {
                          "type": "string"
                        },
                        "phoneNumberVerified": {
                          "readOnly": true,
                          "type": "boolean"
                        },
                        "publicId": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "registeredVia": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "status": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "timeZone": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "twoFactorEnabled": {
                          "default": false,
                          "readOnly": true,
                          "type": "boolean"
                        },
                        "updatedAt": {
                          "format": "date-time",
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "email",
                        "emailVerified",
                        "createdAt",
                        "updatedAt"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "session",
                    "user"
                  ],
                  "type": [
                    "object",
                    "null"
                  ]
                }
              }
            },
            "description": "Success"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Current session",
        "tags": [
          "auth"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/auth/link-social": {
      "post": {
        "description": "Link a social account to the user",
        "operationId": "linkSocialAccount",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "additionalData": {
                    "additionalProperties": {},
                    "propertyNames": {
                      "type": "string"
                    },
                    "type": "object"
                  },
                  "additionalParams": {
                    "additionalProperties": {
                      "type": "string"
                    },
                    "description": "Extra query parameters to append to the provider authorization URL (e.g. Cognito identity_provider, Google hd).",
                    "propertyNames": {
                      "type": "string"
                    },
                    "type": "object"
                  },
                  "callbackURL": {
                    "description": "The URL to redirect to after the user has signed in",
                    "type": "string"
                  },
                  "disableRedirect": {
                    "description": "Disable automatic redirection to the provider. Useful for handling the redirection yourself",
                    "type": "boolean"
                  },
                  "errorCallbackURL": {
                    "description": "The URL to redirect to if there is an error during the link process",
                    "type": "string"
                  },
                  "idToken": {
                    "properties": {
                      "accessToken": {
                        "type": "string"
                      },
                      "nonce": {
                        "type": "string"
                      },
                      "refreshToken": {
                        "type": "string"
                      },
                      "token": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "token"
                    ],
                    "type": "object"
                  },
                  "loginHint": {
                    "description": "The login hint to use for the authorization code request",
                    "type": "string"
                  },
                  "provider": {
                    "anyOf": [
                      {
                        "enum": [
                          "apple",
                          "atlassian",
                          "cloudflare",
                          "cognito",
                          "discord",
                          "facebook",
                          "figma",
                          "github",
                          "microsoft",
                          "google",
                          "huggingface",
                          "slack",
                          "spotify",
                          "twitch",
                          "twitter",
                          "dropbox",
                          "kick",
                          "linear",
                          "linkedin",
                          "gitlab",
                          "tiktok",
                          "reddit",
                          "roblox",
                          "salesforce",
                          "vk",
                          "zoom",
                          "notion",
                          "kakao",
                          "naver",
                          "line",
                          "paybin",
                          "paypal",
                          "polar",
                          "railway",
                          "vercel",
                          "wechat"
                        ],
                        "type": "string"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  },
                  "requestSignUp": {
                    "type": "boolean"
                  },
                  "scopes": {
                    "description": "Additional scopes to request from the provider",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  }
                },
                "required": [
                  "provider"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "redirect": {
                      "description": "Indicates if the user should be redirected to the authorization URL",
                      "type": "boolean"
                    },
                    "status": {
                      "type": "boolean"
                    },
                    "url": {
                      "description": "The authorization URL to redirect the user to",
                      "type": "string"
                    }
                  },
                  "required": [
                    "redirect"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Link a provider after reauthentication",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.account.link",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.login.account",
        "x-reauth": true
      }
    },
    "/api/v1/auth/linked-accounts": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "accounts": {
                      "items": {
                        "properties": {
                          "account_id": {
                            "type": "string"
                          },
                          "created_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "provider_id": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "provider_id",
                          "account_id",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "email_sign_in": {
                      "type": "boolean"
                    },
                    "phone_number": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "phone_number_verified": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "accounts",
                    "phone_number",
                    "phone_number_verified",
                    "email_sign_in"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Sign-in methods"
          }
        },
        "summary": "Current user sign-in methods",
        "tags": [
          "auth"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-reauth": false
      }
    },
    "/api/v1/auth/list-sessions": {
      "get": {
        "description": "List all active sessions for the user",
        "operationId": "listUserSessions",
        "parameters": [],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "properties": {
                      "absoluteExpiresAt": {
                        "format": "date-time",
                        "readOnly": true,
                        "type": "string"
                      },
                      "activeOrganizationId": {
                        "readOnly": true,
                        "type": "string"
                      },
                      "clientKind": {
                        "readOnly": true,
                        "type": "string"
                      },
                      "createdAt": {
                        "format": "date-time",
                        "type": "string"
                      },
                      "expiresAt": {
                        "format": "date-time",
                        "type": "string"
                      },
                      "id": {
                        "readOnly": true,
                        "type": "string"
                      },
                      "ipAddress": {
                        "type": "string"
                      },
                      "mfaVerifiedAt": {
                        "format": "date-time",
                        "readOnly": true,
                        "type": "string"
                      },
                      "reauthAt": {
                        "format": "date-time",
                        "readOnly": true,
                        "type": "string"
                      },
                      "token": {
                        "type": "string"
                      },
                      "updatedAt": {
                        "format": "date-time",
                        "type": "string"
                      },
                      "userAgent": {
                        "type": "string"
                      },
                      "userId": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "id",
                      "expiresAt",
                      "token",
                      "createdAt",
                      "updatedAt",
                      "userId"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                }
              }
            },
            "description": "Success"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Sessions of the current user",
        "tags": [
          "auth"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/auth/phone-number/remove": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "accountId": {
                    "format": "uuid",
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "status": {
                      "enum": [
                        true
                      ],
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "status"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Removed"
          }
        },
        "summary": "Remove verified phone number",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.phone.remove",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.reauth.session",
        "x-reauth": true
      }
    },
    "/api/v1/auth/phone-number/send-otp": {
      "post": {
        "description": "Use this endpoint to send OTP to phone number",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "phoneNumber": {
                    "description": "Phone number to send OTP. Eg: \"+1234567890\"",
                    "type": "string"
                  }
                },
                "required": [
                  "phoneNumber"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Send phone verification code",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.phone.code",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.code.target"
      }
    },
    "/api/v1/auth/phone-number/verify": {
      "post": {
        "description": "Use this endpoint to verify phone number",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": {},
                "properties": {
                  "code": {
                    "description": "OTP code. Eg: \"123456\"",
                    "type": "string"
                  },
                  "disableSession": {
                    "description": "Disable session creation after verification. Eg: false",
                    "type": "boolean"
                  },
                  "phoneNumber": {
                    "description": "Phone number to verify. Eg: \"+1234567890\"",
                    "type": "string"
                  },
                  "updatePhoneNumber": {
                    "description": "Check if there is a session and update the phone number. Eg: true",
                    "type": "boolean"
                  }
                },
                "propertyNames": {
                  "type": "string"
                },
                "required": [
                  "phoneNumber",
                  "code"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "status": {
                      "description": "Indicates if the verification was successful",
                      "enum": [
                        true
                      ],
                      "type": "boolean"
                    },
                    "token": {
                      "description": "Session token if session is created, null if disableSession is true or no session is created",
                      "nullable": true,
                      "type": "string"
                    },
                    "user": {
                      "description": "User object with phone number details, null if no user is created or found",
                      "nullable": true,
                      "properties": {
                        "createdAt": {
                          "description": "Timestamp when the user was created",
                          "format": "date-time",
                          "type": "string"
                        },
                        "email": {
                          "description": "User's email address",
                          "format": "email",
                          "nullable": true,
                          "type": "string"
                        },
                        "emailVerified": {
                          "description": "Whether the email is verified",
                          "nullable": true,
                          "type": "boolean"
                        },
                        "id": {
                          "description": "Unique identifier of the user",
                          "type": "string"
                        },
                        "image": {
                          "description": "User's profile image URL",
                          "format": "uri",
                          "nullable": true,
                          "type": "string"
                        },
                        "name": {
                          "description": "User's name",
                          "nullable": true,
                          "type": "string"
                        },
                        "phoneNumber": {
                          "description": "User's phone number",
                          "type": "string"
                        },
                        "phoneNumberVerified": {
                          "description": "Whether the phone number is verified",
                          "type": "boolean"
                        },
                        "updatedAt": {
                          "description": "Timestamp when the user was last updated",
                          "format": "date-time",
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "phoneNumber",
                        "phoneNumberVerified",
                        "createdAt",
                        "updatedAt"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "status"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Phone number verified successfully"
          },
          "400": {
            "description": "Invalid OTP"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Verify phone, sign in or bind",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.phone.verify",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.login.account"
      }
    },
    "/api/v1/auth/reauth": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReauthRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReauthResult"
                }
              }
            },
            "description": "Re-verified"
          }
        },
        "summary": "Re-verify with password or authenticator code (sensitive operations, 10-minute window)",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.reauth",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.reauth.session"
      }
    },
    "/api/v1/auth/revoke-other-sessions": {
      "post": {
        "description": "Revoke all other sessions for the user except the current one",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {},
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "status": {
                      "description": "Indicates if all other sessions were revoked successfully",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "status"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Revoke all other sessions",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.session.revoke_others",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none"
      }
    },
    "/api/v1/auth/revoke-session": {
      "post": {
        "description": "Revoke a single session",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "token": {
                    "description": "The token to revoke",
                    "type": "string"
                  }
                },
                "required": [
                  "token"
                ],
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "status": {
                      "description": "Indicates if the session was revoked successfully",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "status"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Revoke one session",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.session.revoke",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none"
      }
    },
    "/api/v1/auth/sign-in-options": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "device": {
                      "type": "boolean"
                    },
                    "phone": {
                      "type": "boolean"
                    },
                    "providers": {
                      "items": {
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "telegram": {
                      "properties": {
                        "bot_id": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "username": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "username",
                        "bot_id"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "phone",
                    "providers",
                    "telegram",
                    "device"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Enabled methods without credentials"
          }
        },
        "summary": "Enabled public sign-in methods",
        "tags": [
          "auth"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/auth/sign-in/email": {
      "post": {
        "description": "Sign in with email and password",
        "operationId": "signInEmail",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "callbackURL": {
                    "description": "Callback URL to use as a redirect for email verification",
                    "type": "string"
                  },
                  "email": {
                    "description": "Email of the user",
                    "type": "string"
                  },
                  "password": {
                    "description": "Password of the user",
                    "type": "string"
                  },
                  "rememberMe": {
                    "description": "If this is false, the session will not be remembered. Default is `true`.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "email",
                  "password"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "Session response when idToken is provided",
                  "properties": {
                    "redirect": {
                      "enum": [
                        false
                      ],
                      "type": "boolean"
                    },
                    "token": {
                      "description": "Session token",
                      "type": "string"
                    },
                    "url": {
                      "nullable": true,
                      "type": "string"
                    },
                    "user": {
                      "properties": {
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "emailVerified": {
                          "default": false,
                          "readOnly": true,
                          "type": "boolean"
                        },
                        "id": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "image": {
                          "type": "string"
                        },
                        "inviteCodeId": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "invitedByUserId": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "invitedVia": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "locale": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "phoneNumber": {
                          "type": "string"
                        },
                        "phoneNumberVerified": {
                          "readOnly": true,
                          "type": "boolean"
                        },
                        "publicId": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "registeredVia": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "status": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "timeZone": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "twoFactorEnabled": {
                          "default": false,
                          "readOnly": true,
                          "type": "boolean"
                        },
                        "updatedAt": {
                          "format": "date-time",
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "email",
                        "emailVerified",
                        "createdAt",
                        "updatedAt"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "redirect",
                    "token",
                    "user"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success - Returns either session details or redirect URL"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Sign in with email and password",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.sign_in",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.login.account"
      }
    },
    "/api/v1/auth/sign-in/email-otp": {
      "post": {
        "description": "Sign in with email and OTP",
        "operationId": "signInWithEmailOTP",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": {},
                "properties": {
                  "email": {
                    "description": "Email address to sign in",
                    "type": "string"
                  },
                  "image": {
                    "description": "User profile image URL. Only used if the user is registering for the first time.",
                    "type": "string"
                  },
                  "name": {
                    "description": "User display name. Only used if the user is registering for the first time. Eg: \"my-name\"",
                    "type": "string"
                  },
                  "otp": {
                    "description": "OTP sent to the email",
                    "type": "string"
                  }
                },
                "propertyNames": {
                  "type": "string"
                },
                "required": [
                  "email",
                  "otp"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "token": {
                      "description": "Session token for the authenticated session",
                      "type": "string"
                    },
                    "user": {
                      "properties": {
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "emailVerified": {
                          "default": false,
                          "readOnly": true,
                          "type": "boolean"
                        },
                        "id": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "image": {
                          "type": "string"
                        },
                        "inviteCodeId": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "invitedByUserId": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "invitedVia": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "locale": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "phoneNumber": {
                          "type": "string"
                        },
                        "phoneNumberVerified": {
                          "readOnly": true,
                          "type": "boolean"
                        },
                        "publicId": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "registeredVia": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "status": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "timeZone": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "twoFactorEnabled": {
                          "default": false,
                          "readOnly": true,
                          "type": "boolean"
                        },
                        "updatedAt": {
                          "format": "date-time",
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "email",
                        "emailVerified",
                        "createdAt",
                        "updatedAt"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "token",
                    "user"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Sign in with an email code",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.sign_in",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.login.account"
      }
    },
    "/api/v1/auth/sign-in/phone-number": {
      "post": {
        "description": "Use this endpoint to sign in with phone number",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "password": {
                    "description": "Password to use for sign in.",
                    "type": "string"
                  },
                  "phoneNumber": {
                    "description": "Phone number to sign in. Eg: \"+1234567890\"",
                    "type": "string"
                  },
                  "rememberMe": {
                    "description": "Remember the session. Eg: true",
                    "type": "boolean"
                  }
                },
                "required": [
                  "phoneNumber",
                  "password"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "session": {
                      "properties": {
                        "absoluteExpiresAt": {
                          "format": "date-time",
                          "readOnly": true,
                          "type": "string"
                        },
                        "activeOrganizationId": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "clientKind": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "expiresAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "id": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "ipAddress": {
                          "type": "string"
                        },
                        "mfaVerifiedAt": {
                          "format": "date-time",
                          "readOnly": true,
                          "type": "string"
                        },
                        "reauthAt": {
                          "format": "date-time",
                          "readOnly": true,
                          "type": "string"
                        },
                        "token": {
                          "type": "string"
                        },
                        "updatedAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "userAgent": {
                          "type": "string"
                        },
                        "userId": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "expiresAt",
                        "token",
                        "createdAt",
                        "updatedAt",
                        "userId"
                      ],
                      "type": "object"
                    },
                    "user": {
                      "properties": {
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "emailVerified": {
                          "default": false,
                          "readOnly": true,
                          "type": "boolean"
                        },
                        "id": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "image": {
                          "type": "string"
                        },
                        "inviteCodeId": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "invitedByUserId": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "invitedVia": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "locale": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "phoneNumber": {
                          "type": "string"
                        },
                        "phoneNumberVerified": {
                          "readOnly": true,
                          "type": "boolean"
                        },
                        "publicId": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "registeredVia": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "status": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "timeZone": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "twoFactorEnabled": {
                          "default": false,
                          "readOnly": true,
                          "type": "boolean"
                        },
                        "updatedAt": {
                          "format": "date-time",
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "email",
                        "emailVerified",
                        "createdAt",
                        "updatedAt"
                      ],
                      "type": "object"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "400": {
            "description": "Invalid phone number or password"
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Sign in with verified phone and password",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.sign_in",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.login.account"
      }
    },
    "/api/v1/auth/sign-in/social": {
      "post": {
        "description": "Sign in with a social provider",
        "operationId": "socialSignIn",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "additionalData": {
                    "additionalProperties": {},
                    "propertyNames": {
                      "type": "string"
                    },
                    "type": "object"
                  },
                  "additionalParams": {
                    "additionalProperties": {
                      "type": "string"
                    },
                    "description": "Extra query parameters to append to the provider authorization URL (e.g. Cognito identity_provider, Google hd).",
                    "propertyNames": {
                      "type": "string"
                    },
                    "type": "object"
                  },
                  "callbackURL": {
                    "description": "Callback URL to redirect to after the user has signed in",
                    "type": "string"
                  },
                  "disableRedirect": {
                    "description": "Disable automatic redirection to the provider. Useful for handling the redirection yourself",
                    "type": "boolean"
                  },
                  "errorCallbackURL": {
                    "description": "Callback URL to redirect to if an error happens",
                    "type": "string"
                  },
                  "idToken": {
                    "properties": {
                      "accessToken": {
                        "description": "Access token from the provider",
                        "type": "string"
                      },
                      "expiresAt": {
                        "description": "Expiry date of the token",
                        "type": "number"
                      },
                      "nonce": {
                        "description": "Nonce used to generate the token",
                        "type": "string"
                      },
                      "refreshToken": {
                        "description": "Refresh token from the provider",
                        "type": "string"
                      },
                      "token": {
                        "description": "ID token from the provider",
                        "type": "string"
                      },
                      "user": {
                        "description": "The user object from the provider. Only available for some providers like Apple.",
                        "properties": {
                          "email": {
                            "type": "string"
                          },
                          "name": {
                            "properties": {
                              "firstName": {
                                "type": "string"
                              },
                              "lastName": {
                                "type": "string"
                              }
                            },
                            "type": "object"
                          }
                        },
                        "type": "object"
                      }
                    },
                    "required": [
                      "token"
                    ],
                    "type": "object"
                  },
                  "loginHint": {
                    "description": "The login hint to use for the authorization code request",
                    "type": "string"
                  },
                  "newUserCallbackURL": {
                    "type": "string"
                  },
                  "provider": {
                    "anyOf": [
                      {
                        "enum": [
                          "apple",
                          "atlassian",
                          "cloudflare",
                          "cognito",
                          "discord",
                          "facebook",
                          "figma",
                          "github",
                          "microsoft",
                          "google",
                          "huggingface",
                          "slack",
                          "spotify",
                          "twitch",
                          "twitter",
                          "dropbox",
                          "kick",
                          "linear",
                          "linkedin",
                          "gitlab",
                          "tiktok",
                          "reddit",
                          "roblox",
                          "salesforce",
                          "vk",
                          "zoom",
                          "notion",
                          "kakao",
                          "naver",
                          "line",
                          "paybin",
                          "paypal",
                          "polar",
                          "railway",
                          "vercel",
                          "wechat"
                        ],
                        "type": "string"
                      },
                      {
                        "type": "string"
                      }
                    ]
                  },
                  "requestSignUp": {
                    "description": "Explicitly request sign-up. Useful when disableImplicitSignUp is true for this provider",
                    "type": "boolean"
                  },
                  "scopes": {
                    "description": "Array of scopes to request from the provider. This will override the default scopes passed.",
                    "items": {
                      "type": "string"
                    },
                    "type": "array"
                  }
                },
                "required": [
                  "provider"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "description": "Returns session details when idToken is provided, or an authorize URL otherwise",
                  "properties": {
                    "redirect": {
                      "type": "boolean"
                    },
                    "token": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "user": {
                      "properties": {
                        "createdAt": {
                          "format": "date-time",
                          "type": "string"
                        },
                        "email": {
                          "type": "string"
                        },
                        "emailVerified": {
                          "default": false,
                          "readOnly": true,
                          "type": "boolean"
                        },
                        "id": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "image": {
                          "type": "string"
                        },
                        "inviteCodeId": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "invitedByUserId": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "invitedVia": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "locale": {
                          "type": "string"
                        },
                        "name": {
                          "type": "string"
                        },
                        "phoneNumber": {
                          "type": "string"
                        },
                        "phoneNumberVerified": {
                          "readOnly": true,
                          "type": "boolean"
                        },
                        "publicId": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "registeredVia": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "status": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "timeZone": {
                          "readOnly": true,
                          "type": "string"
                        },
                        "twoFactorEnabled": {
                          "default": false,
                          "readOnly": true,
                          "type": "boolean"
                        },
                        "updatedAt": {
                          "format": "date-time",
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "name",
                        "email",
                        "emailVerified",
                        "createdAt",
                        "updatedAt"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "redirect"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success - Returns session details (idToken branch) or an authorize URL (redirect branch)"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Start social or OIDC sign-in",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.sign_in",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.login.account"
      }
    },
    "/api/v1/auth/sign-in/telegram": {
      "post": {
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "auth_date": {
                    "type": "number"
                  },
                  "first_name": {
                    "maxLength": 256,
                    "minLength": 1,
                    "type": "string"
                  },
                  "hash": {
                    "type": "string"
                  },
                  "id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "number"
                      }
                    ]
                  },
                  "invitationId": {
                    "type": "string"
                  },
                  "inviteCode": {
                    "maxLength": 128,
                    "type": "string"
                  },
                  "last_name": {
                    "maxLength": 256,
                    "type": "string"
                  },
                  "link": {
                    "type": "boolean"
                  },
                  "photo_url": {
                    "type": "string"
                  },
                  "username": {
                    "maxLength": 64,
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "first_name",
                  "auth_date",
                  "hash"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "status": {
                      "type": "boolean"
                    },
                    "token": {
                      "type": "string"
                    },
                    "user": {
                      "type": "object"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Authenticated"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Verify Telegram Login Widget proof",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.sign_in",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.login.account"
      }
    },
    "/api/v1/auth/sign-out": {
      "post": {
        "description": "Sign out the current user",
        "operationId": "signOut",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "callbackURL": {
                    "description": "The URL to redirect to after provider logout",
                    "type": "string"
                  },
                  "disableRedirect": {
                    "description": "Return the provider logout URL without redirecting",
                    "type": "boolean"
                  },
                  "state": {
                    "description": "State to pass to the provider logout endpoint",
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": false
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "redirect": {
                      "description": "Whether the client should redirect to the provider logout URL",
                      "type": "boolean"
                    },
                    "success": {
                      "type": "boolean"
                    },
                    "url": {
                      "description": "Provider logout URL when RP-initiated logout is available",
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Sign out",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.sign_out",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none"
      }
    },
    "/api/v1/auth/sign-up/email": {
      "post": {
        "description": "Sign up a user using email and password",
        "operationId": "signUpWithEmailAndPassword",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "callbackURL": {
                    "description": "The URL to use for email verification callback",
                    "type": "string"
                  },
                  "email": {
                    "description": "The email of the user",
                    "type": "string"
                  },
                  "image": {
                    "description": "The profile image URL of the user",
                    "type": "string"
                  },
                  "invitationId": {
                    "description": "Email invitation being accepted at registration",
                    "format": "uuid",
                    "type": "string"
                  },
                  "inviteCode": {
                    "description": "Personal or universal invite code (case-insensitive)",
                    "type": "string"
                  },
                  "locale": {
                    "type": "string"
                  },
                  "name": {
                    "description": "The name of the user",
                    "type": "string"
                  },
                  "password": {
                    "description": "The password of the user",
                    "type": "string"
                  },
                  "phoneNumber": {
                    "type": "string"
                  },
                  "rememberMe": {
                    "description": "If this is false, the session will not be remembered. Default is `true`.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "name",
                  "email",
                  "password"
                ],
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "token": {
                      "description": "Authentication token for the session",
                      "nullable": true,
                      "type": "string"
                    },
                    "user": {
                      "properties": {
                        "createdAt": {
                          "description": "When the user was created",
                          "format": "date-time",
                          "type": "string"
                        },
                        "email": {
                          "description": "The email address of the user",
                          "format": "email",
                          "type": "string"
                        },
                        "emailVerified": {
                          "description": "Whether the email has been verified",
                          "type": "boolean"
                        },
                        "id": {
                          "description": "The unique identifier of the user",
                          "type": "string"
                        },
                        "image": {
                          "description": "The profile image URL of the user",
                          "format": "uri",
                          "nullable": true,
                          "type": "string"
                        },
                        "name": {
                          "description": "The name of the user",
                          "type": "string"
                        },
                        "updatedAt": {
                          "description": "When the user was last updated",
                          "format": "date-time",
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "email",
                        "name",
                        "emailVerified",
                        "createdAt",
                        "updatedAt"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "user"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Successfully created user"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "422": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Unprocessable Entity. User already exists or failed to create user."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Register (inviteCode, invitationId, locale)",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.sign_up",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.signup.ip"
      }
    },
    "/api/v1/auth/two-factor/disable": {
      "post": {
        "description": "Use this endpoint to disable two factor authentication.",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "password": {
                    "description": "User password",
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "status": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Successful response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Disable TOTP",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.mfa.disable",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.mfa.ip"
      }
    },
    "/api/v1/auth/two-factor/enable": {
      "post": {
        "description": "Enable two factor authentication. Pass method 'totp' (default) to set up an authenticator app (returns TOTP URI and backup codes), or 'otp' to enable email/SMS-based codes immediately.",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "issuer": {
                    "description": "Custom issuer for the TOTP URI",
                    "type": "string"
                  },
                  "method": {
                    "enum": [
                      "otp",
                      "totp"
                    ],
                    "type": "string"
                  },
                  "password": {
                    "description": "User password",
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "backupCodes": {
                      "description": "Recovery backup codes. Only present when method is 'totp'.",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "method": {
                      "description": "The 2FA method that was enabled.",
                      "enum": [
                        "otp",
                        "totp"
                      ],
                      "type": "string"
                    },
                    "totpURI": {
                      "description": "TOTP URI for authenticator app setup. Only present when method is 'totp'.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "method"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Successful response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Start TOTP enrollment",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.mfa.enable",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.mfa.ip"
      }
    },
    "/api/v1/auth/two-factor/generate-backup-codes": {
      "post": {
        "description": "Generate new backup codes for two-factor authentication",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "password": {
                    "description": "The users password.",
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "backupCodes": {
                      "description": "Array of generated backup codes in plain text",
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "status": {
                      "description": "Indicates if the backup codes were generated successfully",
                      "enum": [
                        true
                      ],
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "status",
                    "backupCodes"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Backup codes generated successfully"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Replace backup codes",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.mfa.backup_codes",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.mfa.ip"
      }
    },
    "/api/v1/auth/two-factor/verify-backup-code": {
      "post": {
        "description": "Verify a backup code for two-factor authentication",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "code": {
                    "description": "A backup code to verify. Eg: \"123456\"",
                    "type": "string"
                  },
                  "disableSession": {
                    "description": "If true, the session cookie will not be set.",
                    "type": "boolean"
                  },
                  "trustDevice": {
                    "description": "If true, the device will be trusted for 30 days. It'll be refreshed on every sign in request within this time. Eg: true",
                    "type": "boolean"
                  }
                },
                "required": [
                  "code"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "session": {
                      "description": "The current session object, included unless disableSession is true",
                      "properties": {
                        "createdAt": {
                          "description": "Timestamp when the session was created",
                          "format": "date-time",
                          "type": "string"
                        },
                        "expiresAt": {
                          "description": "Timestamp when the session expires",
                          "format": "date-time",
                          "type": "string"
                        },
                        "token": {
                          "description": "Session token",
                          "type": "string"
                        },
                        "userId": {
                          "description": "ID of the user associated with the session",
                          "type": "string"
                        }
                      },
                      "required": [
                        "token",
                        "userId",
                        "createdAt",
                        "expiresAt"
                      ],
                      "type": "object"
                    },
                    "user": {
                      "description": "The authenticated user object with two-factor details",
                      "properties": {
                        "createdAt": {
                          "description": "Timestamp when the user was created",
                          "format": "date-time",
                          "type": "string"
                        },
                        "email": {
                          "description": "User's email address",
                          "format": "email",
                          "nullable": true,
                          "type": "string"
                        },
                        "emailVerified": {
                          "description": "Whether the email is verified",
                          "nullable": true,
                          "type": "boolean"
                        },
                        "id": {
                          "description": "Unique identifier of the user",
                          "type": "string"
                        },
                        "image": {
                          "description": "User's profile image URL",
                          "format": "uri",
                          "nullable": true,
                          "type": "string"
                        },
                        "name": {
                          "description": "User's name",
                          "nullable": true,
                          "type": "string"
                        },
                        "twoFactorEnabled": {
                          "description": "Whether two-factor authentication is enabled for the user",
                          "type": "boolean"
                        },
                        "updatedAt": {
                          "description": "Timestamp when the user was last updated",
                          "format": "date-time",
                          "type": "string"
                        }
                      },
                      "required": [
                        "id",
                        "twoFactorEnabled",
                        "createdAt",
                        "updatedAt"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "user",
                    "session"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Backup code verified successfully"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Consume a backup code",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.mfa.verify",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.mfa.ip"
      }
    },
    "/api/v1/auth/two-factor/verify-totp": {
      "post": {
        "description": "Verify two factor TOTP",
        "parameters": [],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "code": {
                    "description": "The otp code to verify. Eg: \"012345\"",
                    "type": "string"
                  },
                  "trustDevice": {
                    "description": "If true, the device will be trusted for 30 days. It'll be refreshed on every sign in request within this time. Eg: true",
                    "type": "boolean"
                  }
                },
                "required": [
                  "code"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "status": {
                      "type": "boolean"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Successful response"
          },
          "400": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Bad Request. Usually due to missing parameters, or invalid parameters."
          },
          "401": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "message"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unauthorized. Due to missing or invalid authentication."
          },
          "403": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Forbidden. You do not have permission to access this resource or to perform this action."
          },
          "404": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Not Found. The requested resource was not found."
          },
          "429": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Too Many Requests. You have exceeded the rate limit. Try again later."
          },
          "500": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "message": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Internal Server Error. This is a problem with the server that you cannot fix."
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "summary": "Verify a TOTP code (sets the session mfa_verified_at)",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.mfa.verify",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.mfa.ip"
      }
    },
    "/api/v1/auth/unlink-account": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "accountId": {
                    "format": "uuid",
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "status": {
                      "enum": [
                        true
                      ],
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "status"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Removed"
          }
        },
        "summary": "Unlink a sign-in account",
        "tags": [
          "auth"
        ],
        "x-audit": "auth.account.unlink",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "auth.reauth.session",
        "x-reauth": true
      }
    },
    "/api/v1/me": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            },
            "description": "Profile",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Profile, language, time zone and the capabilities of the signed-in user",
        "tags": [
          "me"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        }
      },
      "patch": {
        "parameters": [
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MePatch"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Me"
                }
              }
            },
            "description": "Updated",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Update name, language or time zone (If-Match)",
        "tags": [
          "me"
        ],
        "x-audit": "me.profile.update",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "none"
      }
    },
    "/api/v1/me/announcements": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "before",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "body_md": {
                            "type": "string"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "kind": {
                            "enum": [
                              "normal",
                              "important",
                              "maintenance"
                            ],
                            "type": "string"
                          },
                          "pinned": {
                            "type": "boolean"
                          },
                          "popup": {
                            "type": "boolean"
                          },
                          "publish_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "title": {
                            "type": "string"
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "pinned",
                          "popup",
                          "version",
                          "publish_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "summary": "Announcements for the current user",
        "tags": [
          "announcements"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-rate-limit": "support.content.read"
      }
    },
    "/api/v1/me/announcements/{id}/seen": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "version": {
                    "minimum": 1,
                    "type": "integer"
                  }
                },
                "required": [
                  "version"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Acknowledged"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not visible"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Announcement changed"
          }
        },
        "summary": "Acknowledge a popup once per announcement revision",
        "tags": [
          "announcements"
        ],
        "x-audit": "support.announcement.seen",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "optional"
      }
    },
    "/api/v1/me/apple/account-token": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "app_account_token": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "app_account_token"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Stable StoreKit appAccountToken",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-reauth": false
      }
    },
    "/api/v1/me/apple/subscriptions": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "environment",
            "required": false,
            "schema": {
              "default": "production",
              "enum": [
                "sandbox",
                "production"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "pattern": "^\\d{1,64}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "auto_renew": {
                            "type": "boolean"
                          },
                          "current_product_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "current_transaction_id": {
                            "pattern": "^\\d{1,64}$",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "environment": {
                            "enum": [
                              "sandbox",
                              "production"
                            ],
                            "type": "string"
                          },
                          "grace_expires_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "last_signed_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "last_synced_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "next_product_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "original_transaction_id": {
                            "pattern": "^\\d{1,64}$",
                            "type": "string"
                          },
                          "state": {
                            "enum": [
                              "pending",
                              "active",
                              "grace",
                              "billing_retry",
                              "expired",
                              "revoked"
                            ],
                            "type": "string"
                          },
                          "subscription_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "user_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "environment",
                          "original_transaction_id",
                          "user_id",
                          "subscription_id",
                          "current_transaction_id",
                          "current_product_id",
                          "next_product_id",
                          "state",
                          "auto_renew",
                          "grace_expires_at",
                          "last_signed_at",
                          "last_synced_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "has_more",
                    "next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "My Apple subscriptions",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-reauth": false
      }
    },
    "/api/v1/me/apple/transactions": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "environment": {
                    "enum": [
                      "sandbox",
                      "production"
                    ],
                    "type": "string"
                  },
                  "transaction_id": {
                    "pattern": "^\\d{1,64}$",
                    "type": "string"
                  }
                },
                "required": [
                  "environment",
                  "transaction_id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "stale": {
                      "type": "boolean"
                    },
                    "subscription_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "subscription_id",
                    "stale"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Restore or verify an Apple purchase",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.apple.purchase",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/me/checkout-links/orders": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "embedding_origin": {
                    "format": "uri",
                    "maxLength": 2048,
                    "type": "string"
                  },
                  "token": {
                    "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\.[A-Za-z0-9_-]{43}$",
                    "type": "string"
                  }
                },
                "required": [
                  "token",
                  "embedding_origin"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceOrder"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid link"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Order conflict"
          }
        },
        "summary": "Buy the signed selection after mailbox-proof registration",
        "tags": [
          "checkout-links"
        ],
        "x-audit": "commerce.order.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/me/coupons": {
      "get": {
        "parameters": [
          {
            "description": "available (default), used or expired",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "description": "available (default), used or expired",
              "enum": [
                "available",
                "used",
                "expired"
              ],
              "type": "string"
            }
          },
          {
            "description": "Preferred locale; else Accept-Language",
            "in": "query",
            "name": "locale",
            "required": false,
            "schema": {
              "description": "Preferred locale; else Accept-Language",
              "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
              "type": "string"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MyCouponPage"
                }
              }
            },
            "description": "A page of my coupons, with Content-Language"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid cursor"
          }
        },
        "summary": "My coupons: available (default), used or expired",
        "tags": [
          "coupons"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/me/docs": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "category",
            "required": false,
            "schema": {
              "maxLength": 80,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "after",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "body_md": {
                            "type": "string"
                          },
                          "category": {
                            "type": "string"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "sort": {
                            "type": "integer"
                          },
                          "title": {
                            "type": "string"
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "id",
                          "slug",
                          "category",
                          "sort",
                          "title",
                          "body_md",
                          "version"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "summary": "Published knowledge base",
        "tags": [
          "docs"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-rate-limit": "support.docs"
      }
    },
    "/api/v1/me/docs/{slug}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "maxLength": 150,
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "body_md": {
                      "type": "string"
                    },
                    "category": {
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "sort": {
                      "type": "integer"
                    },
                    "title": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "slug",
                    "category",
                    "sort",
                    "title",
                    "body_md",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not published"
          }
        },
        "summary": "Published knowledge base article",
        "tags": [
          "docs"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-rate-limit": "support.docs"
      }
    },
    "/api/v1/me/files": {
      "post": {
        "parameters": [
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PortalFileUploadCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/File"
                }
              }
            },
            "description": "The file in `uploading`"
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.file_too_large"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.file_type_not_allowed or validation failed"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.storage_quota_exceeded"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.storage_unavailable"
          }
        },
        "summary": "Open an upload session for a ticket attachment (one part)",
        "tags": [
          "files"
        ],
        "x-audit": "support.file.upload_create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required"
      }
    },
    "/api/v1/me/files/{id}/complete": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FileUploadComplete"
              }
            }
          },
          "required": false
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/File"
                }
              }
            },
            "description": "The ready file"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such upload"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.upload_incomplete or support.upload_expired"
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.file_too_large"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.file_type_mismatch / support.checksum_mismatch"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.storage_unavailable"
          }
        },
        "summary": "Complete the upload (type check; ready or rejected)",
        "tags": [
          "files"
        ],
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "optional"
      }
    },
    "/api/v1/me/files/{id}/content": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/gzip": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/pdf": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/vnd.android.package-archive": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/vnd.appimage": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/vnd.debian.binary-package": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/vnd.microsoft.portable-executable": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-7z-compressed": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-apple-diskimage": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-msi": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-rpm": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-xar": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/zip": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/avif": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/gif": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/jpeg": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/png": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/svg+xml": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/webp": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/x-icon": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "text/csv": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "text/plain": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "video/mp4": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "video/webm": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "The file (attachment, `Cache-Control: private, no-store`)"
          },
          "206": {
            "content": {
              "application/gzip": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/pdf": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/vnd.android.package-archive": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/vnd.appimage": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/vnd.debian.binary-package": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/vnd.microsoft.portable-executable": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-7z-compressed": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-apple-diskimage": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-msi": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-rpm": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-xar": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/zip": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/avif": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/gif": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/jpeg": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/png": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/svg+xml": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/webp": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/x-icon": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "text/csv": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "text/plain": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "video/mp4": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "video/webm": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "The requested range"
          },
          "304": {
            "description": "Not modified"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such file"
          },
          "416": {
            "description": "Range not satisfiable"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.storage_unavailable"
          }
        },
        "summary": "Download one of your files",
        "tags": [
          "files"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/me/files/{id}/parts/1": {
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/octet-stream": {
              "schema": {
                "format": "binary",
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FilePartResult"
                }
              }
            },
            "description": "Stored"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such upload"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.upload_expired"
          },
          "413": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Request body above the part size"
          },
          "415": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not application/octet-stream"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Wrong length or support.checksum_mismatch"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "support.storage_unavailable"
          }
        },
        "summary": "Upload the file (raw bytes)",
        "tags": [
          "files"
        ],
        "x-body": "octet-stream",
        "x-body-limit": 16777216,
        "x-idempotency": "none"
      }
    },
    "/api/v1/me/invitations/{id}/accept": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InvitationAccepted"
                }
              }
            },
            "description": "Accepted"
          }
        },
        "summary": "Accept an invitation as a registered user (roles merged, referrer unchanged)",
        "tags": [
          "me"
        ],
        "x-audit": "me.invitation.accept",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none"
      }
    },
    "/api/v1/me/notification-preferences": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationPreferences"
                }
              }
            },
            "description": "Preferences"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Authentication required"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Read my optional notification preferences",
        "tags": [
          "notification-center"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "notify.center",
        "x-reauth": false
      },
      "put": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NotificationPreferences"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotificationPreferences"
                }
              }
            },
            "description": "Preferences"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Authentication required"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Save optional notification preferences",
        "tags": [
          "notification-center"
        ],
        "x-audit": "notify.preferences.update",
        "x-body": "json",
        "x-body-limit": 4096,
        "x-idempotency": "none",
        "x-rate-limit": "notify.center",
        "x-reauth": false
      }
    },
    "/api/v1/me/notifications": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "unread",
            "required": false,
            "schema": {
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "$ref": "#/components/schemas/InboxMessage"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Inbox page"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Authentication required"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "List my inbox",
        "tags": [
          "notification-center"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "notify.center",
        "x-reauth": false
      }
    },
    "/api/v1/me/notifications/read-all": {
      "post": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxUnreadCount"
                }
              }
            },
            "description": "Unread count"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Authentication required"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Mark my inbox read",
        "tags": [
          "notification-center"
        ],
        "x-audit": "notify.inbox.read_all",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "notify.center",
        "x-reauth": false
      }
    },
    "/api/v1/me/notifications/telegram": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "bound": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "bound"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Binding status"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Authentication required"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Read my Telegram binding status",
        "tags": [
          "notification-center"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "notify.center",
        "x-reauth": false
      }
    },
    "/api/v1/me/notifications/telegram/bind": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "bot_key": {
                    "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$",
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "expires_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "url",
                    "expires_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Private binding link"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Authentication required"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Reauthentication required"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Bot unavailable"
          }
        },
        "summary": "Create a one-time Telegram binding link",
        "tags": [
          "notification-center"
        ],
        "x-audit": "notify.telegram.bind",
        "x-body": "json",
        "x-body-limit": 1024,
        "x-idempotency": "none",
        "x-rate-limit": "notify.telegram.bind",
        "x-reauth": true
      }
    },
    "/api/v1/me/notifications/unread-count": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxUnreadCount"
                }
              }
            },
            "description": "Unread count"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Authentication required"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Count my unread messages",
        "tags": [
          "notification-center"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "notify.center",
        "x-reauth": false
      }
    },
    "/api/v1/me/notifications/{id}/read": {
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InboxMessage"
                }
              }
            },
            "description": "Read message"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Authentication required"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Mark my message read",
        "tags": [
          "notification-center"
        ],
        "x-audit": "notify.inbox.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "notify.center",
        "x-reauth": false
      }
    },
    "/api/v1/me/orders": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "maxLength": 512,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "maxLength": 40,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "user_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "enum": [
                "purchase",
                "renewal",
                "traffic_reset",
                "top_up"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "plan_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "channel_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "refund_state",
            "required": false,
            "schema": {
              "enum": [
                "none",
                "partial",
                "full"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "amount_min",
            "required": false,
            "schema": {
              "pattern": "^\\d{1,18}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "amount_max",
            "required": false,
            "schema": {
              "pattern": "^\\d{1,18}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "created_from",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "created_to",
            "required": false,
            "schema": {
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "maxLength": 64,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page",
            "required": false,
            "schema": {
              "maximum": 10001,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "order",
            "required": false,
            "schema": {
              "enum": [
                "asc",
                "desc"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "$ref": "#/components/schemas/CommerceOrder"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "My orders",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none"
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "activation_mode": {
                    "enum": [
                      "immediate",
                      "queued"
                    ],
                    "type": "string"
                  },
                  "amount_minor": {
                    "pattern": "^\\d{1,18}$",
                    "type": "string"
                  },
                  "channel_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "code": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "coupon": {
                    "enum": [
                      "none"
                    ],
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "purchase",
                      "renewal",
                      "traffic_reset",
                      "top_up"
                    ],
                    "type": "string"
                  },
                  "plan_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "price_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "quote_fingerprint": {
                    "pattern": "^[a-f0-9]{64}$",
                    "type": "string"
                  },
                  "subscription_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "use_gift": {
                    "type": "boolean"
                  },
                  "user_code_id": {
                    "format": "uuid",
                    "type": "string"
                  }
                },
                "required": [
                  "kind"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceOrder"
                }
              }
            },
            "description": "Result"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Order conflict"
          }
        },
        "summary": "Create an order",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.order.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-rate-limit": "commerce.checkout"
      }
    },
    "/api/v1/me/orders/quote": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "activation_mode": {
                    "enum": [
                      "immediate",
                      "queued"
                    ],
                    "type": "string"
                  },
                  "amount_minor": {
                    "pattern": "^\\d{1,18}$",
                    "type": "string"
                  },
                  "channel_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "code": {
                    "maxLength": 64,
                    "minLength": 1,
                    "type": "string"
                  },
                  "coupon": {
                    "enum": [
                      "none"
                    ],
                    "type": "string"
                  },
                  "kind": {
                    "enum": [
                      "purchase",
                      "renewal",
                      "traffic_reset",
                      "top_up"
                    ],
                    "type": "string"
                  },
                  "plan_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "price_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "quote_fingerprint": {
                    "pattern": "^[a-f0-9]{64}$",
                    "type": "string"
                  },
                  "subscription_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "use_gift": {
                    "type": "boolean"
                  },
                  "user_code_id": {
                    "format": "uuid",
                    "type": "string"
                  }
                },
                "required": [
                  "kind"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceQuote"
                }
              }
            },
            "description": "Result"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Quote unavailable"
          }
        },
        "summary": "Quote a purchase or renewal",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.quote",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "commerce.checkout"
      }
    },
    "/api/v1/me/orders/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceOrder"
                }
              }
            },
            "description": "Result"
          },
          "304": {
            "description": "Unchanged"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such order"
          }
        },
        "summary": "My order",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none"
      }
    },
    "/api/v1/me/orders/{id}/cancel": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceOrder"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such order"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Order changed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "Cancel my unpaid order",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.order.cancel",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional"
      }
    },
    "/api/v1/me/orders/{id}/combined-payments": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "balance_minor": {
                    "pattern": "^[1-9]\\d{0,17}$",
                    "type": "string"
                  },
                  "channel_id": {
                    "format": "uuid",
                    "type": "string"
                  }
                },
                "required": [
                  "channel_id",
                  "balance_minor"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercePayment"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Checkout unavailable or no such order"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Payment conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid allocation"
          },
          "502": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Channel error"
          }
        },
        "summary": "Reserve cash and start one online payment",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.payment.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-mfa": true,
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/me/orders/{id}/pay-with-balance": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceOrder"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such order"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Insufficient balance or order not payable"
          }
        },
        "summary": "Pay an order with cash balance",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.order.pay_balance",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required",
        "x-mfa": true,
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/me/orders/{id}/payments": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "channel_id": {
                    "format": "uuid",
                    "type": "string"
                  }
                },
                "required": [
                  "channel_id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommercePayment"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such order"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Order not payable"
          },
          "502": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Channel unavailable"
          }
        },
        "summary": "Start a channel payment",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.payment.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-rate-limit": "commerce.checkout"
      }
    },
    "/api/v1/me/orders/{id}/plan-change/pay-balance": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceOrder"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Subscription not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Quote, path or version changed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "Pay a plan change with all source wallets locked first",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.plan_change.pay",
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": false,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-mfa": true,
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/me/orders/{id}/receipt": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceReceipt"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such receipt"
          }
        },
        "summary": "Immutable paid-order receipt",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/me/orders/{id}/receipt.pdf": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "locale",
            "required": false,
            "schema": {
              "default": "zh-CN",
              "enum": [
                "zh-CN",
                "en-US"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/pdf": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "PDF receipt"
          },
          "304": {
            "description": "Private cached receipt unchanged"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such receipt"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Private storage unavailable"
          }
        },
        "summary": "Download immutable PDF receipt",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/me/privacy": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "anonymized": {
                      "type": "boolean"
                    },
                    "policy": {
                      "properties": {
                        "cooling_off_days": {
                          "type": "integer"
                        },
                        "version": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "cooling_off_days",
                        "version"
                      ],
                      "type": "object"
                    },
                    "request": {
                      "properties": {
                        "blocked_reasons": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "completed_steps": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "cooling_off_until": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "id": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "status": {
                          "type": "string"
                        },
                        "user_id": {
                          "format": "uuid",
                          "type": "string"
                        },
                        "version": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "id",
                        "user_id",
                        "status",
                        "cooling_off_until",
                        "completed_steps",
                        "blocked_reasons",
                        "version"
                      ],
                      "type": [
                        "object",
                        "null"
                      ]
                    },
                    "retention_hold": {
                      "type": "boolean"
                    },
                    "settlement": {
                      "properties": {
                        "balances": {
                          "properties": {
                            "cash_minor": {
                              "type": "string"
                            },
                            "commission_minor": {
                              "type": "string"
                            },
                            "commission_pending_minor": {
                              "type": "string"
                            },
                            "gift_minor": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "cash_minor",
                            "gift_minor",
                            "commission_pending_minor",
                            "commission_minor"
                          ],
                          "type": "object"
                        },
                        "blocked_reasons": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array"
                        },
                        "can_forfeit": {
                          "type": "boolean"
                        },
                        "currency": {
                          "type": "string"
                        },
                        "version": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "blocked_reasons",
                        "currency",
                        "version",
                        "can_forfeit",
                        "balances"
                      ],
                      "type": "object"
                    },
                    "status": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "status",
                    "retention_hold",
                    "anonymized",
                    "version",
                    "policy",
                    "request"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Privacy"
        ],
        "x-audit": "iam.privacy.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "iam.privacy.user",
        "x-reauth": false
      }
    },
    "/api/v1/me/privacy/cancel": {
      "post": {
        "responses": {
          "204": {
            "description": "Cancelled; old sessions and credentials stay revoked"
          }
        },
        "tags": [
          "Privacy"
        ],
        "x-audit": "iam.privacy.cancel",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required",
        "x-rate-limit": "iam.privacy.user",
        "x-reauth": true
      }
    },
    "/api/v1/me/privacy/deactivate": {
      "post": {
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Privacy"
        ],
        "x-audit": "iam.privacy.deactivate",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required",
        "x-rate-limit": "iam.privacy.user",
        "x-reauth": true
      }
    },
    "/api/v1/me/privacy/export": {
      "post": {
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Privacy"
        ],
        "x-audit": "ops.privacy.export",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required",
        "x-rate-limit": "iam.privacy.user",
        "x-reauth": true
      }
    },
    "/api/v1/me/privacy/export/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "expires_at": {
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "status": {
                      "enum": [
                        "pending",
                        "ready",
                        "failed",
                        "expired"
                      ],
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "expires_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "Privacy"
        ],
        "x-audit": "ops.privacy.export_read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "iam.privacy.user",
        "x-reauth": false
      }
    },
    "/api/v1/me/privacy/export/{id}/download": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/octet-stream": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "Private JSON export"
          }
        },
        "tags": [
          "Privacy"
        ],
        "x-audit": "ops.privacy.download",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "iam.privacy.user",
        "x-reauth": false
      }
    },
    "/api/v1/me/privacy/forfeit": {
      "post": {
        "parameters": [
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "confirm": {
                    "enum": [
                      true
                    ],
                    "type": "boolean"
                  }
                },
                "required": [
                  "confirm"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "tags": [
          "Privacy"
        ],
        "x-audit": "iam.privacy.forfeit",
        "x-body": "json",
        "x-body-limit": 1024,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-rate-limit": "iam.privacy.user",
        "x-reauth": true
      }
    },
    "/api/v1/me/redeem": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "code": {
                    "description": "R- plus 40 Crockford base32 characters; lowercase, spaces, missing hyphen and I/L/O aliases are accepted.",
                    "maxLength": 128,
                    "type": "string"
                  },
                  "subscription_id": {
                    "format": "uuid",
                    "type": "string"
                  }
                },
                "required": [
                  "code"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "grant_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "replayed": {
                      "type": "boolean"
                    },
                    "subscription_id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "subscription_id",
                    "grant_id",
                    "replayed"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "summary": "Redeem a single-use entitlement code",
        "tags": [
          "redeem"
        ],
        "x-audit": "growth.redeem.use",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-capability": "me.redeem.use",
        "x-idempotency": "required",
        "x-rate-limit": "growth.code.user",
        "x-reauth": false
      }
    },
    "/api/v1/me/referral": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "level": {
                      "properties": {
                        "level": {
                          "additionalProperties": false,
                          "properties": {
                            "first_order_rate_bps": {
                              "maximum": 10000,
                              "minimum": 0,
                              "type": "integer"
                            },
                            "i18n": {
                              "additionalProperties": {
                                "additionalProperties": false,
                                "properties": {
                                  "_meta": {
                                    "additionalProperties": false,
                                    "properties": {
                                      "origin": {
                                        "enum": [
                                          "manual",
                                          "machine",
                                          "builtin"
                                        ],
                                        "type": "string"
                                      },
                                      "provider": {
                                        "maxLength": 64,
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "origin"
                                    ],
                                    "type": "object"
                                  },
                                  "description": {
                                    "maxLength": 1000,
                                    "type": "string"
                                  },
                                  "name": {
                                    "maxLength": 64,
                                    "minLength": 1,
                                    "type": "string"
                                  }
                                },
                                "type": "object"
                              },
                              "default": {},
                              "type": "object"
                            },
                            "id": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "is_base": {
                              "type": "boolean"
                            },
                            "name": {
                              "maxLength": 64,
                              "minLength": 1,
                              "type": "string"
                            },
                            "rank": {
                              "type": "integer"
                            },
                            "recurring_rate_bps": {
                              "maximum": 10000,
                              "minimum": 0,
                              "type": "integer"
                            },
                            "retain_min_net_paid_minor": {
                              "default": null,
                              "pattern": "^[1-9]\\d{0,17}$",
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "retain_min_paid_invitees": {
                              "default": null,
                              "exclusiveMinimum": 0,
                              "type": [
                                "integer",
                                "null"
                              ]
                            },
                            "source_locale": {
                              "default": "zh-CN",
                              "maxLength": 20,
                              "minLength": 2,
                              "type": "string"
                            },
                            "status": {
                              "default": "active",
                              "enum": [
                                "active",
                                "disabled"
                              ],
                              "type": "string"
                            },
                            "upgrade_min_net_paid_minor": {
                              "default": null,
                              "pattern": "^[1-9]\\d{0,17}$",
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "upgrade_min_paid_invitees": {
                              "default": null,
                              "exclusiveMinimum": 0,
                              "type": [
                                "integer",
                                "null"
                              ]
                            },
                            "version": {
                              "type": "integer"
                            }
                          },
                          "required": [
                            "name",
                            "rank",
                            "first_order_rate_bps",
                            "recurring_rate_bps",
                            "id",
                            "is_base",
                            "version"
                          ],
                          "type": "object"
                        },
                        "locked": {
                          "type": "boolean"
                        },
                        "next_level": {
                          "additionalProperties": false,
                          "properties": {
                            "first_order_rate_bps": {
                              "maximum": 10000,
                              "minimum": 0,
                              "type": "integer"
                            },
                            "i18n": {
                              "additionalProperties": {
                                "additionalProperties": false,
                                "properties": {
                                  "_meta": {
                                    "additionalProperties": false,
                                    "properties": {
                                      "origin": {
                                        "enum": [
                                          "manual",
                                          "machine",
                                          "builtin"
                                        ],
                                        "type": "string"
                                      },
                                      "provider": {
                                        "maxLength": 64,
                                        "type": "string"
                                      }
                                    },
                                    "required": [
                                      "origin"
                                    ],
                                    "type": "object"
                                  },
                                  "description": {
                                    "maxLength": 1000,
                                    "type": "string"
                                  },
                                  "name": {
                                    "maxLength": 64,
                                    "minLength": 1,
                                    "type": "string"
                                  }
                                },
                                "type": "object"
                              },
                              "default": {},
                              "type": "object"
                            },
                            "id": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "is_base": {
                              "type": "boolean"
                            },
                            "name": {
                              "maxLength": 64,
                              "minLength": 1,
                              "type": "string"
                            },
                            "rank": {
                              "type": "integer"
                            },
                            "recurring_rate_bps": {
                              "maximum": 10000,
                              "minimum": 0,
                              "type": "integer"
                            },
                            "retain_min_net_paid_minor": {
                              "default": null,
                              "pattern": "^[1-9]\\d{0,17}$",
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "retain_min_paid_invitees": {
                              "default": null,
                              "exclusiveMinimum": 0,
                              "type": [
                                "integer",
                                "null"
                              ]
                            },
                            "source_locale": {
                              "default": "zh-CN",
                              "maxLength": 20,
                              "minLength": 2,
                              "type": "string"
                            },
                            "status": {
                              "default": "active",
                              "enum": [
                                "active",
                                "disabled"
                              ],
                              "type": "string"
                            },
                            "upgrade_min_net_paid_minor": {
                              "default": null,
                              "pattern": "^[1-9]\\d{0,17}$",
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "upgrade_min_paid_invitees": {
                              "default": null,
                              "exclusiveMinimum": 0,
                              "type": [
                                "integer",
                                "null"
                              ]
                            },
                            "version": {
                              "type": "integer"
                            }
                          },
                          "required": [
                            "name",
                            "rank",
                            "first_order_rate_bps",
                            "recurring_rate_bps",
                            "id",
                            "is_base",
                            "version"
                          ],
                          "type": [
                            "object",
                            "null"
                          ]
                        },
                        "performance": {
                          "properties": {
                            "net_paid_minor": {
                              "pattern": "^\\d{1,18}$",
                              "type": "string"
                            },
                            "paid_invitees": {
                              "type": "integer"
                            }
                          },
                          "required": [
                            "paid_invitees",
                            "net_paid_minor"
                          ],
                          "type": "object"
                        },
                        "referral_level_id": {
                          "format": "uuid",
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "until": {
                          "type": [
                            "string",
                            "null"
                          ]
                        },
                        "version": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "referral_level_id",
                        "until",
                        "locked",
                        "version",
                        "level",
                        "performance",
                        "next_level"
                      ],
                      "type": "object"
                    },
                    "stats": {
                      "properties": {
                        "clicks": {
                          "pattern": "^\\d{1,18}$",
                          "type": "string"
                        },
                        "commission_minor": {
                          "pattern": "^\\d{1,18}$",
                          "type": "string"
                        },
                        "currency": {
                          "pattern": "^[A-Z]{3}$",
                          "type": "string"
                        },
                        "daily": {
                          "items": {
                            "properties": {
                              "clicks": {
                                "pattern": "^\\d{1,18}$",
                                "type": "string"
                              },
                              "code": {
                                "type": [
                                  "string",
                                  "null"
                                ]
                              },
                              "commission_minor": {
                                "pattern": "^\\d{1,18}$",
                                "type": "string"
                              },
                              "date": {
                                "format": "date",
                                "type": "string"
                              },
                              "first_paid": {
                                "type": "integer"
                              },
                              "paid_minor": {
                                "pattern": "^\\d{1,18}$",
                                "type": "string"
                              },
                              "registrations": {
                                "type": "integer"
                              },
                              "rewards": {
                                "type": "integer"
                              }
                            },
                            "required": [
                              "date",
                              "code",
                              "clicks",
                              "registrations",
                              "first_paid",
                              "paid_minor",
                              "commission_minor",
                              "rewards"
                            ],
                            "type": "object"
                          },
                          "type": "array"
                        },
                        "first_paid": {
                          "type": "integer"
                        },
                        "paid_minor": {
                          "pattern": "^\\d{1,18}$",
                          "type": "string"
                        },
                        "registrations": {
                          "type": "integer"
                        },
                        "rewards": {
                          "type": "integer"
                        }
                      },
                      "required": [
                        "daily",
                        "currency",
                        "clicks",
                        "registrations",
                        "first_paid",
                        "paid_minor",
                        "commission_minor",
                        "rewards"
                      ],
                      "type": "object"
                    }
                  },
                  "required": [
                    "code",
                    "stats",
                    "level"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "My referral centre",
        "tags": [
          "referral"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/me/referral/invitations": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "created_at": {
                            "type": "string"
                          },
                          "email": {
                            "type": "string"
                          },
                          "expires_at": {
                            "type": "string"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "role": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "email",
                          "role",
                          "status",
                          "expires_at",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "My sent invitations",
        "tags": [
          "referral"
        ],
        "x-body": "none",
        "x-body-limit": 0
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "email": {
                    "format": "email",
                    "maxLength": 254,
                    "type": "string"
                  }
                },
                "required": [
                  "email"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "created_at": {
                      "type": "string"
                    },
                    "email": {
                      "type": "string"
                    },
                    "expires_at": {
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "role": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "email",
                    "role",
                    "status",
                    "expires_at",
                    "created_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Invite a friend",
        "tags": [
          "referral"
        ],
        "x-audit": "growth.invitation.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-capability": "me.referral.invite",
        "x-idempotency": "required",
        "x-rate-limit": "growth.invitation.user",
        "x-reauth": false
      }
    },
    "/api/v1/me/referral/invitees": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "created_at": {
                            "type": "string"
                          },
                          "email_masked": {
                            "type": "string"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "invite_code_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "invited_via": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "public_id": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "public_id",
                          "email_masked",
                          "invited_via",
                          "invite_code_id",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "My invited users",
        "tags": [
          "referral"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/me/referral/links": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "channel": {
                    "pattern": "^[a-zA-Z0-9_-]{1,64}$",
                    "type": "string"
                  },
                  "to": {
                    "default": "/",
                    "pattern": "^(?:\\/|\\/pricing|\\/docs(?:\\/[a-zA-Z0-9_-]+)*|\\/app\\/(?:en-US\\/)?checkout\\?kind=purchase&plan=[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}&price=[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12})$",
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "code",
                    "url"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Generate a referral link",
        "tags": [
          "referral"
        ],
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "optional",
        "x-reauth": false
      }
    },
    "/api/v1/me/referral/rewards": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "amount_minor": {
                            "pattern": "^\\d{1,18}$",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "available_at": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "base_minor": {
                            "pattern": "^\\d{1,18}$",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "beneficiary_user_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "currency": {
                            "pattern": "^[A-Z]{3}$",
                            "type": "string"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "idempotency_key": {
                            "type": "string"
                          },
                          "invite_code_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "invitee_user_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "inviter_user_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "kind": {
                            "enum": [
                              "commission",
                              "gift_credit",
                              "coupon",
                              "traffic_bonus",
                              "term_extend",
                              "trial"
                            ],
                            "type": "string"
                          },
                          "order_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "rate_bps": {
                            "type": [
                              "integer",
                              "null"
                            ]
                          },
                          "reversed_minor": {
                            "pattern": "^\\d{1,18}$",
                            "type": "string"
                          },
                          "review_reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "role": {
                            "enum": [
                              "inviter",
                              "invitee"
                            ],
                            "type": "string"
                          },
                          "rule_key": {
                            "type": "string"
                          },
                          "rule_snapshot": {
                            "additionalProperties": {},
                            "type": "object"
                          },
                          "status": {
                            "enum": [
                              "pending",
                              "held",
                              "available",
                              "granted",
                              "reversed",
                              "rejected"
                            ],
                            "type": "string"
                          },
                          "trigger": {
                            "enum": [
                              "registered",
                              "first_paid",
                              "paid"
                            ],
                            "type": "string"
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "currency",
                          "id",
                          "beneficiary_user_id",
                          "invitee_user_id",
                          "inviter_user_id",
                          "invite_code_id",
                          "role",
                          "trigger",
                          "order_id",
                          "kind",
                          "rule_key",
                          "rule_snapshot",
                          "base_minor",
                          "rate_bps",
                          "amount_minor",
                          "reversed_minor",
                          "status",
                          "available_at",
                          "idempotency_key",
                          "review_reason",
                          "version"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "My referral rewards",
        "tags": [
          "referral"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/me/status-subscriptions": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "component_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "enabled": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "component_id",
                          "enabled"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "tags": [
          "status"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "support.status",
        "x-reauth": false
      },
      "put": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "component_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "enabled": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "component_id",
                  "enabled"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "component_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "enabled": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "component_id",
                    "enabled"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          }
        },
        "tags": [
          "status"
        ],
        "x-audit": "support.status.subscribe",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-rate-limit": "support.status",
        "x-reauth": false
      }
    },
    "/api/v1/me/subscriptions": {
      "get": {
        "parameters": [
          {
            "description": "Status; repeat the parameter for several values",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "scheduled",
                    "active",
                    "exhausted",
                    "expired",
                    "cancelled",
                    "refunded"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "scheduled",
                      "active",
                      "exhausted",
                      "expired",
                      "cancelled",
                      "refunded"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Status; repeat the parameter for several values"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Return `total` (first page only)",
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "description": "Return `total` (first page only)",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MySubscriptionPage"
                }
              }
            },
            "description": "A page of my subscriptions"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid filter or cursor"
          }
        },
        "summary": "My subscriptions, newest first (keyset pages)",
        "tags": [
          "subscriptions"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/me/subscriptions/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/MySubscription"
                    },
                    {
                      "properties": {
                        "team_eligible": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "team_eligible"
                      ],
                      "type": "object"
                    }
                  ]
                }
              }
            },
            "description": "The subscription"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such subscription"
          }
        },
        "summary": "One of my subscriptions (ETag: version)",
        "tags": [
          "subscriptions"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/me/subscriptions/{id}/access-logs": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "subscription_id",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "pattern": "^[1-9]\\d{0,18}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "accessed_at": {
                            "type": "string"
                          },
                          "asn": {
                            "type": [
                              "number",
                              "null"
                            ]
                          },
                          "carrier": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "client_key": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "id": {
                            "type": "string"
                          },
                          "ip_masked": {
                            "type": "string"
                          },
                          "result": {
                            "type": "string"
                          },
                          "subscription_id": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "token_fingerprint": {
                            "type": "string"
                          },
                          "user_agent_summary": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "via_node": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "id",
                          "accessed_at",
                          "subscription_id",
                          "token_fingerprint",
                          "client_key",
                          "result",
                          "ip_masked",
                          "user_agent_summary",
                          "asn",
                          "carrier",
                          "via_node"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "has_more",
                    "next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "My subscription link access history",
        "tags": [
          "distribution"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/me/subscriptions/{id}/activate": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MySubscription"
                }
              }
            },
            "description": "The started subscription"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such subscription"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current) or a subscription.* conflict"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Start a queued subscription now, beside the current one (If-Match)",
        "tags": [
          "subscriptions"
        ],
        "x-audit": "subscription.activate",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional"
      }
    },
    "/api/v1/me/subscriptions/{id}/auto-renew": {
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "enabled": {
                    "type": "boolean"
                  },
                  "price_id": {
                    "format": "uuid",
                    "type": "string"
                  }
                },
                "required": [
                  "enabled"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/MySubscription"
                    },
                    {
                      "properties": {
                        "auto_renew_estimate": {
                          "properties": {
                            "amount_minor": {
                              "type": "string"
                            },
                            "balance_minor": {
                              "type": "string"
                            },
                            "next_charge_at": {
                              "format": "date-time",
                              "type": [
                                "string",
                                "null"
                              ]
                            },
                            "sufficient": {
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "amount_minor",
                            "balance_minor",
                            "sufficient",
                            "next_charge_at"
                          ],
                          "type": [
                            "object",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "auto_renew_estimate"
                      ],
                      "type": "object"
                    }
                  ]
                }
              }
            },
            "description": "Subscription and renewal estimate"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such subscription"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "common.version_conflict (with current) or a subscription.* conflict"
          },
          "412": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Malformed If-Match"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match missing"
          }
        },
        "summary": "Set balance auto-renew and its price option",
        "tags": [
          "subscriptions"
        ],
        "x-audit": "subscription.auto_renew.update",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "optional"
      }
    },
    "/api/v1/me/subscriptions/{id}/change": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "quote_fingerprint": {
                    "pattern": "^[a-f0-9]{64}$",
                    "type": "string"
                  },
                  "target_plan_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "target_price_id": {
                    "format": "uuid",
                    "type": "string"
                  }
                },
                "required": [
                  "target_plan_id",
                  "target_price_id",
                  "quote_fingerprint"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommerceOrder"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Subscription not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Quote, path or version changed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "Create a server-priced plan-change checkout order",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.plan_change.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": false,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/me/subscriptions/{id}/change-paths": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "direction": {
                            "enum": [
                              "upgrade",
                              "downgrade"
                            ],
                            "type": "string"
                          },
                          "source_price_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "target_price_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "source_price_id",
                          "target_price_id",
                          "direction"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Subscription not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Quote, path or version changed"
          }
        },
        "summary": "Allowed target price options for an owned subscription",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/me/subscriptions/{id}/change/preview": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "target_plan_id": {
                    "format": "uuid",
                    "type": "string"
                  },
                  "target_price_id": {
                    "format": "uuid",
                    "type": "string"
                  }
                },
                "required": [
                  "target_plan_id",
                  "target_price_id"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "applied_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "balance_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "credit_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "direction": {
                      "enum": [
                        "upgrade",
                        "downgrade"
                      ],
                      "type": "string"
                    },
                    "due_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "effective_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "excess_policy": {
                      "enum": [
                        "balance",
                        "forfeit"
                      ],
                      "type": "string"
                    },
                    "fingerprint": {
                      "type": "string"
                    },
                    "forfeited_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "subscription_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "target_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "subscription_id",
                    "version",
                    "currency",
                    "direction",
                    "effective_at",
                    "target_minor",
                    "credit_minor",
                    "applied_minor",
                    "due_minor",
                    "balance_minor",
                    "forfeited_minor",
                    "excess_policy",
                    "fingerprint"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Subscription not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Quote, path or version changed"
          }
        },
        "summary": "Quote an allowed plan change",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.plan_change.preview",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/me/subscriptions/{id}/devices": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageDevices"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          }
        },
        "summary": "Online devices (masked addresses)",
        "tags": [
          "usage"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-reauth": false
      }
    },
    "/api/v1/me/subscriptions/{id}/devices/{deviceKey}/kick": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "deviceKey",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{64}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageKickedDevice"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          }
        },
        "summary": "Block a device for 30 minutes",
        "tags": [
          "usage"
        ],
        "x-audit": "usage.device.kick",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-reauth": false
      }
    },
    "/api/v1/me/subscriptions/{id}/link": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionLink"
                }
              }
            },
            "description": "The link"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such subscription"
          }
        },
        "summary": "The subscription link (issued on first view)",
        "tags": [
          "subscriptions"
        ],
        "x-audit": "subscription.link.read",
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/me/subscriptions/{id}/link-options": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "client",
            "required": false,
            "schema": {
              "maxLength": 64,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "ver",
            "required": false,
            "schema": {
              "maxLength": 32,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "region",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "protocol",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "tag",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "ip_family",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "isp",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "exclude_keyword",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "maxLength": 128,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "maxLength": 128,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "url": {
                      "type": "string"
                    },
                    "user_params": {
                      "additionalProperties": {
                        "items": {
                          "type": "string"
                        },
                        "type": "array"
                      },
                      "type": "object"
                    }
                  },
                  "required": [
                    "url",
                    "user_params"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Build a subscription link with permitted conditions",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.link.build",
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/me/subscriptions/{id}/node-multipliers": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "nodes": {
                      "items": {
                        "properties": {
                          "effective_multiplier": {
                            "type": "string"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "rule_version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "id",
                          "effective_multiplier",
                          "rule_version"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "at",
                    "nodes"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Current rates"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Subscription not found"
          }
        },
        "summary": "Current effective multipliers for my subscription nodes",
        "tags": [
          "network"
        ],
        "x-audit": "network.multiplier.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "network.multiplier.read",
        "x-reauth": false
      }
    },
    "/api/v1/me/subscriptions/{id}/nodes": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "client",
            "required": false,
            "schema": {
              "maxLength": 64,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "ver",
            "required": false,
            "schema": {
              "maxLength": 32,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "region",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "protocol",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "tag",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "ip_family",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "isp",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "exclude_keyword",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "maxLength": 128,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "maxLength": 128,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "client": {
                      "enum": [
                        "mihomo",
                        "sing_box@1.11",
                        "sing_box@1.12",
                        "sing_box@1.13",
                        "uri_base64",
                        "hiddify",
                        "stash",
                        "surge",
                        "quantumult_x",
                        "loon",
                        "surfboard",
                        "shadowrocket"
                      ],
                      "type": "string"
                    },
                    "failed_nodes": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "fallback": {
                      "type": "boolean"
                    },
                    "format": {
                      "enum": [
                        "yaml",
                        "json",
                        "conf",
                        "text",
                        "base64"
                      ],
                      "type": "string"
                    },
                    "nodes": {
                      "items": {
                        "properties": {
                          "address_family": {
                            "type": "string"
                          },
                          "health": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "load": {
                            "additionalProperties": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "type": "object"
                          },
                          "name": {
                            "type": "string"
                          },
                          "protocol": {
                            "type": "string"
                          },
                          "region": {
                            "type": "string"
                          },
                          "tags": {
                            "items": {
                              "type": "string"
                            },
                            "type": "array"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "protocol",
                          "region",
                          "tags"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "output": {
                      "type": "string"
                    },
                    "result": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "client",
                    "format",
                    "output",
                    "result",
                    "nodes",
                    "fallback",
                    "failed_nodes"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "My selected subscription nodes",
        "tags": [
          "distribution"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/me/subscriptions/{id}/paid-reset/preview": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {},
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "amount_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "amount_minor",
                    "currency",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Subscription not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Quote, path or version changed"
          }
        },
        "summary": "Quote paid traffic reset with rounding and minimum",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.paid_reset.preview",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/me/subscriptions/{id}/preview": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "client",
            "required": false,
            "schema": {
              "maxLength": 64,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "ver",
            "required": false,
            "schema": {
              "maxLength": 32,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "region",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "protocol",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "tag",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "ip_family",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "isp",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "exclude_keyword",
            "required": false,
            "schema": {
              "maxLength": 2048,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "maxLength": 128,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "maxLength": 128,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "client": {
                      "enum": [
                        "mihomo",
                        "sing_box@1.11",
                        "sing_box@1.12",
                        "sing_box@1.13",
                        "uri_base64",
                        "hiddify",
                        "stash",
                        "surge",
                        "quantumult_x",
                        "loon",
                        "surfboard",
                        "shadowrocket"
                      ],
                      "type": "string"
                    },
                    "failed_nodes": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "fallback": {
                      "type": "boolean"
                    },
                    "format": {
                      "enum": [
                        "yaml",
                        "json",
                        "conf",
                        "text",
                        "base64"
                      ],
                      "type": "string"
                    },
                    "nodes": {
                      "items": {
                        "properties": {
                          "address_family": {
                            "type": "string"
                          },
                          "health": {
                            "type": "string"
                          },
                          "id": {
                            "type": "string"
                          },
                          "kind": {
                            "type": "string"
                          },
                          "load": {
                            "additionalProperties": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "number"
                                },
                                {
                                  "type": "null"
                                }
                              ]
                            },
                            "type": "object"
                          },
                          "name": {
                            "type": "string"
                          },
                          "protocol": {
                            "type": "string"
                          },
                          "region": {
                            "type": "string"
                          },
                          "tags": {
                            "items": {
                              "type": "string"
                            },
                            "type": "array"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "protocol",
                          "region",
                          "tags"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "output": {
                      "type": "string"
                    },
                    "result": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "client",
                    "format",
                    "output",
                    "result",
                    "nodes",
                    "fallback",
                    "failed_nodes"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Preview my subscription using the delivery selector",
        "tags": [
          "distribution"
        ],
        "x-body": "none",
        "x-body-limit": 0
      },
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "client": {
                    "default": "mihomo",
                    "enum": [
                      "mihomo",
                      "sing_box@1.11",
                      "sing_box@1.12",
                      "sing_box@1.13",
                      "uri_base64",
                      "hiddify",
                      "stash",
                      "surge",
                      "quantumult_x",
                      "loon",
                      "surfboard",
                      "shadowrocket"
                    ],
                    "type": "string"
                  },
                  "rules": {
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "target": {
                          "maxLength": 200,
                          "minLength": 1,
                          "pattern": "^[^,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                          "type": "string"
                        },
                        "type": {
                          "enum": [
                            "domain",
                            "domain-suffix",
                            "domain-keyword",
                            "IP-CIDR",
                            "GEOIP",
                            "GEOSITE",
                            "process-name"
                          ],
                          "type": "string"
                        },
                        "value": {
                          "maxLength": 253,
                          "minLength": 1,
                          "pattern": "^[^\\s,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                          "type": "string"
                        }
                      },
                      "required": [
                        "type",
                        "value",
                        "target"
                      ],
                      "type": "object"
                    },
                    "maxItems": 200,
                    "type": "array"
                  }
                },
                "required": [
                  "rules"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "fallback": {
                      "type": "boolean"
                    },
                    "format": {
                      "type": "string"
                    },
                    "output": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "output",
                    "format",
                    "fallback"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Preview unsaved routing rules for my subscription",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.user_routing.preview",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-idempotency": "none",
        "x-rate-limit": "distribution.user_routing.user",
        "x-reauth": false
      }
    },
    "/api/v1/me/subscriptions/{id}/rotate-credential": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MySubscription"
                }
              }
            },
            "description": "The subscription"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "No such subscription"
          }
        },
        "summary": "Replace the node credential (clients must re-import the subscription)",
        "tags": [
          "subscriptions"
        ],
        "x-audit": "subscription.credential.rotate",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required"
      }
    },
    "/api/v1/me/subscriptions/{id}/rotate-link": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "rotated_at": {
                      "type": "string"
                    },
                    "token_fingerprint": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "token_fingerprint",
                    "rotated_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Replace my link token immediately",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.link.rotate",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required"
      }
    },
    "/api/v1/me/subscriptions/{id}/routing-rules": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "groups": {
                      "items": {
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "policy": {
                      "additionalProperties": false,
                      "properties": {
                        "allowed_types": {
                          "default": [
                            "domain",
                            "domain-suffix",
                            "domain-keyword",
                            "IP-CIDR",
                            "GEOIP",
                            "GEOSITE",
                            "process-name"
                          ],
                          "items": {
                            "enum": [
                              "domain",
                              "domain-suffix",
                              "domain-keyword",
                              "IP-CIDR",
                              "GEOIP",
                              "GEOSITE",
                              "process-name"
                            ],
                            "type": "string"
                          },
                          "maxItems": 7,
                          "type": "array"
                        },
                        "denied_targets": {
                          "default": [],
                          "items": {
                            "maxLength": 200,
                            "minLength": 1,
                            "pattern": "^[^,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                            "type": "string"
                          },
                          "maxItems": 200,
                          "type": "array"
                        },
                        "enabled": {
                          "default": true,
                          "type": "boolean"
                        },
                        "max_count": {
                          "default": 200,
                          "maximum": 200,
                          "minimum": 0,
                          "type": "integer"
                        },
                        "protected_domains": {
                          "default": [],
                          "items": {
                            "maxLength": 253,
                            "pattern": "^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\\.)*[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i",
                            "type": "string"
                          },
                          "maxItems": 100,
                          "type": "array"
                        }
                      },
                      "type": "object"
                    },
                    "rules": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "target": {
                            "maxLength": 200,
                            "minLength": 1,
                            "pattern": "^[^,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                            "type": "string"
                          },
                          "type": {
                            "enum": [
                              "domain",
                              "domain-suffix",
                              "domain-keyword",
                              "IP-CIDR",
                              "GEOIP",
                              "GEOSITE",
                              "process-name"
                            ],
                            "type": "string"
                          },
                          "value": {
                            "maxLength": 253,
                            "minLength": 1,
                            "pattern": "^[^\\s,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "value",
                          "target"
                        ],
                        "type": "object"
                      },
                      "maxItems": 200,
                      "type": "array"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "rules",
                    "version",
                    "groups",
                    "policy"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Read my ordered subscription routing rules",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.user_routing.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "distribution.user_routing.user",
        "x-reauth": false
      },
      "put": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "client": {
                    "default": "mihomo",
                    "enum": [
                      "mihomo",
                      "sing_box@1.11",
                      "sing_box@1.12",
                      "sing_box@1.13",
                      "uri_base64",
                      "hiddify",
                      "stash",
                      "surge",
                      "quantumult_x",
                      "loon",
                      "surfboard",
                      "shadowrocket"
                    ],
                    "type": "string"
                  },
                  "rules": {
                    "items": {
                      "additionalProperties": false,
                      "properties": {
                        "target": {
                          "maxLength": 200,
                          "minLength": 1,
                          "pattern": "^[^,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                          "type": "string"
                        },
                        "type": {
                          "enum": [
                            "domain",
                            "domain-suffix",
                            "domain-keyword",
                            "IP-CIDR",
                            "GEOIP",
                            "GEOSITE",
                            "process-name"
                          ],
                          "type": "string"
                        },
                        "value": {
                          "maxLength": 253,
                          "minLength": 1,
                          "pattern": "^[^\\s,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                          "type": "string"
                        }
                      },
                      "required": [
                        "type",
                        "value",
                        "target"
                      ],
                      "type": "object"
                    },
                    "maxItems": 200,
                    "type": "array"
                  }
                },
                "required": [
                  "rules"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "rules": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "target": {
                            "maxLength": 200,
                            "minLength": 1,
                            "pattern": "^[^,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                            "type": "string"
                          },
                          "type": {
                            "enum": [
                              "domain",
                              "domain-suffix",
                              "domain-keyword",
                              "IP-CIDR",
                              "GEOIP",
                              "GEOSITE",
                              "process-name"
                            ],
                            "type": "string"
                          },
                          "value": {
                            "maxLength": 253,
                            "minLength": 1,
                            "pattern": "^[^\\s,;#[\\]=\"'\\\\\\p{Cc}]+$/u",
                            "type": "string"
                          }
                        },
                        "required": [
                          "type",
                          "value",
                          "target"
                        ],
                        "type": "object"
                      },
                      "maxItems": 200,
                      "type": "array"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "rules",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Distribution result"
          }
        },
        "summary": "Replace my ordered routing rules with If-Match",
        "tags": [
          "distribution"
        ],
        "x-audit": "distribution.user_routing.update",
        "x-body": "json",
        "x-body-limit": 524288,
        "x-idempotency": "optional",
        "x-rate-limit": "distribution.user_routing.user",
        "x-reauth": false
      }
    },
    "/api/v1/me/subscriptions/{id}/team": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "maxLength": 100,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "member_limit": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "members": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "allocation_bytes": {
                            "pattern": "^\\d{1,19}$",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "role": {
                            "enum": [
                              "owner",
                              "manager",
                              "member"
                            ],
                            "type": "string"
                          },
                          "subscription_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "used_bytes": {
                            "pattern": "^\\d{1,19}$",
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "role",
                          "subscription_id",
                          "allocation_bytes",
                          "used_bytes"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "name": {
                      "type": "string"
                    },
                    "role": {
                      "enum": [
                        "owner",
                        "manager",
                        "member"
                      ],
                      "type": "string"
                    },
                    "team_id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "team_id",
                    "name",
                    "role",
                    "member_limit",
                    "members"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Team"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Team role does not permit this action"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Team or member not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Subscription, membership or allocation conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Enable an enterprise subscription team",
        "tags": [
          "teams"
        ],
        "x-audit": "subscription.team.manage",
        "x-body": "json",
        "x-body-limit": 4096,
        "x-idempotency": "required",
        "x-rate-limit": "subscription.teams.user",
        "x-reauth": false
      }
    },
    "/api/v1/me/subscriptions/{id}/unsubscribe": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "quote_fingerprint": {
                    "pattern": "^[a-f0-9]{64}$",
                    "type": "string"
                  },
                  "reason": {
                    "maxLength": 1000,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "reason",
                  "quote_fingerprint"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "state": {
                      "enum": [
                        "awaiting_payment",
                        "scheduled",
                        "pending",
                        "completed",
                        "failed",
                        "cancelled"
                      ],
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "state"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Subscription not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Quote, path or version changed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "If-Match required"
          }
        },
        "summary": "Refund and end a subscription, or request original-route staff approval",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.unsubscribe.execute",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-concurrency": {
          "etag": false,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/me/subscriptions/{id}/unsubscribe/preview": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {},
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "credit_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "fingerprint": {
                      "type": "string"
                    },
                    "method": {
                      "enum": [
                        "balance",
                        "original"
                      ],
                      "type": "string"
                    },
                    "quoted_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "subscription_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "subscription_id",
                    "version",
                    "currency",
                    "credit_minor",
                    "method",
                    "fingerprint",
                    "quoted_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Subscription not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Quote, path or version changed"
          }
        },
        "summary": "Quote remaining refundable subscription value",
        "tags": [
          "commerce"
        ],
        "x-audit": "commerce.unsubscribe.preview",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "none",
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/me/subscriptions/{id}/usage": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "date_from",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "date_to",
            "required": false,
            "schema": {
              "format": "date",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageDaily"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Problem details"
          }
        },
        "summary": "My subscription daily traffic",
        "tags": [
          "usage"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-reauth": false
      }
    },
    "/api/v1/me/team-invitations/accept": {
      "post": {
        "parameters": [
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "proof": {
                    "pattern": "^[0-9A-Za-z]{43}$",
                    "type": "string"
                  }
                },
                "required": [
                  "proof"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "member_limit": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "members": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "allocation_bytes": {
                            "pattern": "^\\d{1,19}$",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "role": {
                            "enum": [
                              "owner",
                              "manager",
                              "member"
                            ],
                            "type": "string"
                          },
                          "subscription_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "used_bytes": {
                            "pattern": "^\\d{1,19}$",
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "role",
                          "subscription_id",
                          "allocation_bytes",
                          "used_bytes"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "name": {
                      "type": "string"
                    },
                    "role": {
                      "enum": [
                        "owner",
                        "manager",
                        "member"
                      ],
                      "type": "string"
                    },
                    "team_id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "team_id",
                    "name",
                    "role",
                    "member_limit",
                    "members"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Joined team"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Team role does not permit this action"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Team or member not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Subscription, membership or allocation conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Accept a team invitation using a verified matching email",
        "tags": [
          "teams"
        ],
        "x-audit": "subscription.team.manage",
        "x-body": "json",
        "x-body-limit": 4096,
        "x-idempotency": "required",
        "x-rate-limit": "subscription.teams.user",
        "x-reauth": false
      }
    },
    "/api/v1/me/teams": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "name": {
                            "type": "string"
                          },
                          "role": {
                            "enum": [
                              "owner",
                              "manager",
                              "member"
                            ],
                            "type": "string"
                          },
                          "team_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "team_id",
                          "name",
                          "role"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "My teams"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Team role does not permit this action"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Team or member not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Subscription, membership or allocation conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "My team names and roles",
        "tags": [
          "teams"
        ],
        "x-audit": "subscription.team.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "subscription.teams.user",
        "x-reauth": false
      }
    },
    "/api/v1/me/teams/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "member_limit": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "members": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "allocation_bytes": {
                            "pattern": "^\\d{1,19}$",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "role": {
                            "enum": [
                              "owner",
                              "manager",
                              "member"
                            ],
                            "type": "string"
                          },
                          "subscription_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "used_bytes": {
                            "pattern": "^\\d{1,19}$",
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "role",
                          "subscription_id",
                          "allocation_bytes",
                          "used_bytes"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "name": {
                      "type": "string"
                    },
                    "role": {
                      "enum": [
                        "owner",
                        "manager",
                        "member"
                      ],
                      "type": "string"
                    },
                    "team_id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "team_id",
                    "name",
                    "role",
                    "member_limit",
                    "members"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Team"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Team role does not permit this action"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Team or member not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Subscription, membership or allocation conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Team name and role-scoped usage",
        "tags": [
          "teams"
        ],
        "x-audit": "subscription.team.read",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "subscription.teams.user",
        "x-reauth": false
      }
    },
    "/api/v1/me/teams/{id}/invitations": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "email": {
                    "format": "email",
                    "maxLength": 320,
                    "type": "string"
                  },
                  "role": {
                    "enum": [
                      "manager",
                      "member"
                    ],
                    "type": "string"
                  }
                },
                "required": [
                  "email",
                  "role"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "expires_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "invitation_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "proof": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "invitation_id",
                    "proof",
                    "expires_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Single-use invitation proof"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Team role does not permit this action"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Team or member not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Subscription, membership or allocation conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Invite a verified account to a team",
        "tags": [
          "teams"
        ],
        "x-audit": "subscription.team.manage",
        "x-body": "json",
        "x-body-limit": 4096,
        "x-capability": "me.referral.invite",
        "x-idempotency": "required",
        "x-rate-limit": "subscription.teams.user",
        "x-reauth": false
      }
    },
    "/api/v1/me/teams/{id}/members/{member_id}": {
      "delete": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "member_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "member_limit": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "members": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "allocation_bytes": {
                            "pattern": "^\\d{1,19}$",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "role": {
                            "enum": [
                              "owner",
                              "manager",
                              "member"
                            ],
                            "type": "string"
                          },
                          "subscription_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "used_bytes": {
                            "pattern": "^\\d{1,19}$",
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "role",
                          "subscription_id",
                          "allocation_bytes",
                          "used_bytes"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "name": {
                      "type": "string"
                    },
                    "role": {
                      "enum": [
                        "owner",
                        "manager",
                        "member"
                      ],
                      "type": "string"
                    },
                    "team_id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "team_id",
                    "name",
                    "role",
                    "member_limit",
                    "members"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Updated team"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Team role does not permit this action"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Team or member not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Subscription, membership or allocation conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Remove one member and revoke only their credentials",
        "tags": [
          "teams"
        ],
        "x-audit": "subscription.team.manage",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "required",
        "x-rate-limit": "subscription.teams.user",
        "x-reauth": false
      },
      "patch": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "member_id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Idempotency-Key: 16–128 visible ASCII characters",
            "in": "header",
            "name": "idempotency-key",
            "required": true,
            "schema": {
              "description": "Idempotency-Key: 16–128 visible ASCII characters",
              "pattern": "^[\\x21-\\x7e]{16,128}$",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "allocation_bytes": {
                    "pattern": "^\\d{1,19}$",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "role": {
                    "enum": [
                      "manager",
                      "member"
                    ],
                    "type": "string"
                  }
                },
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "member_limit": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    },
                    "members": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "allocation_bytes": {
                            "pattern": "^\\d{1,19}$",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "role": {
                            "enum": [
                              "owner",
                              "manager",
                              "member"
                            ],
                            "type": "string"
                          },
                          "subscription_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "used_bytes": {
                            "pattern": "^\\d{1,19}$",
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "role",
                          "subscription_id",
                          "allocation_bytes",
                          "used_bytes"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "name": {
                      "type": "string"
                    },
                    "role": {
                      "enum": [
                        "owner",
                        "manager",
                        "member"
                      ],
                      "type": "string"
                    },
                    "team_id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "team_id",
                    "name",
                    "role",
                    "member_limit",
                    "members"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Updated team"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Team role does not permit this action"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Team or member not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Subscription, membership or allocation conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid input"
          }
        },
        "summary": "Set a team member role or traffic allocation",
        "tags": [
          "teams"
        ],
        "x-audit": "subscription.team.manage",
        "x-body": "json",
        "x-body-limit": 4096,
        "x-idempotency": "required",
        "x-rate-limit": "subscription.teams.user",
        "x-reauth": false
      }
    },
    "/api/v1/me/tickets": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "enum": [
                "open",
                "awaiting_staff",
                "awaiting_user",
                "resolved",
                "closed"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "maxLength": 4096,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "default": "false",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "assignee_staff_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "available_actions": {
                            "items": {
                              "enum": [
                                "assign",
                                "reply",
                                "note",
                                "close",
                                "reopen",
                                "transition:open",
                                "transition:awaiting_staff",
                                "transition:awaiting_user",
                                "transition:resolved",
                                "transition:closed"
                              ],
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "category": {
                            "type": "string"
                          },
                          "created_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "first_responded_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "first_response_due_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "last_message_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "priority": {
                            "enum": [
                              "low",
                              "normal",
                              "high",
                              "urgent"
                            ],
                            "type": "string"
                          },
                          "related_order_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "related_subscription_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "resolution_due_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "resolved_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "staff_unread": {
                            "type": "boolean"
                          },
                          "status": {
                            "enum": [
                              "open",
                              "awaiting_staff",
                              "awaiting_user",
                              "resolved",
                              "closed"
                            ],
                            "type": "string"
                          },
                          "subject": {
                            "type": "string"
                          },
                          "ticket_no": {
                            "type": "string"
                          },
                          "user_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "user_unread": {
                            "type": "boolean"
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "id",
                          "ticket_no",
                          "user_id",
                          "subject",
                          "category",
                          "priority",
                          "status",
                          "assignee_staff_id",
                          "related_order_id",
                          "related_subscription_id",
                          "first_response_due_at",
                          "resolution_due_at",
                          "first_responded_at",
                          "resolved_at",
                          "last_message_at",
                          "user_unread",
                          "staff_unread",
                          "created_at",
                          "version",
                          "available_actions"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "total": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "summary": "List tickets",
        "tags": [
          "tickets"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-rate-limit": "support.tickets",
        "x-reauth": false
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "body_md": {
                    "maxLength": 40000,
                    "minLength": 1,
                    "type": "string"
                  },
                  "category": {
                    "maxLength": 80,
                    "minLength": 1,
                    "type": "string"
                  },
                  "file_ids": {
                    "default": [],
                    "items": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "maxItems": 10,
                    "type": "array"
                  },
                  "related_order_id": {
                    "default": null,
                    "format": "uuid",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "related_subscription_id": {
                    "default": null,
                    "format": "uuid",
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "subject": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "body_md",
                  "subject",
                  "category"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "assignee_staff_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "available_actions": {
                      "items": {
                        "enum": [
                          "assign",
                          "reply",
                          "note",
                          "close",
                          "reopen",
                          "transition:open",
                          "transition:awaiting_staff",
                          "transition:awaiting_user",
                          "transition:resolved",
                          "transition:closed"
                        ],
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "category": {
                      "type": "string"
                    },
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "first_responded_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "first_response_due_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "last_message_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "priority": {
                      "enum": [
                        "low",
                        "normal",
                        "high",
                        "urgent"
                      ],
                      "type": "string"
                    },
                    "related_order_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "related_subscription_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolution_due_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolved_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "staff_unread": {
                      "type": "boolean"
                    },
                    "status": {
                      "enum": [
                        "open",
                        "awaiting_staff",
                        "awaiting_user",
                        "resolved",
                        "closed"
                      ],
                      "type": "string"
                    },
                    "subject": {
                      "type": "string"
                    },
                    "ticket_no": {
                      "type": "string"
                    },
                    "user_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "user_unread": {
                      "type": "boolean"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "ticket_no",
                    "user_id",
                    "subject",
                    "category",
                    "priority",
                    "status",
                    "assignee_staff_id",
                    "related_order_id",
                    "related_subscription_id",
                    "first_response_due_at",
                    "resolution_due_at",
                    "first_responded_at",
                    "resolved_at",
                    "last_message_at",
                    "user_unread",
                    "staff_unread",
                    "created_at",
                    "version",
                    "available_actions"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid transition or stale version"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid ticket input"
          }
        },
        "summary": "Create a ticket",
        "tags": [
          "tickets"
        ],
        "x-audit": "support.ticket.create",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-capability": "me.ticket.create",
        "x-idempotency": "required",
        "x-rate-limit": "support.tickets",
        "x-reauth": false
      }
    },
    "/api/v1/me/tickets/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "assignee_staff_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "available_actions": {
                      "items": {
                        "enum": [
                          "assign",
                          "reply",
                          "note",
                          "close",
                          "reopen",
                          "transition:open",
                          "transition:awaiting_staff",
                          "transition:awaiting_user",
                          "transition:resolved",
                          "transition:closed"
                        ],
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "category": {
                      "type": "string"
                    },
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "first_responded_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "first_response_due_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "last_message_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "priority": {
                      "enum": [
                        "low",
                        "normal",
                        "high",
                        "urgent"
                      ],
                      "type": "string"
                    },
                    "related_order_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "related_subscription_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolution_due_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolved_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "staff_unread": {
                      "type": "boolean"
                    },
                    "status": {
                      "enum": [
                        "open",
                        "awaiting_staff",
                        "awaiting_user",
                        "resolved",
                        "closed"
                      ],
                      "type": "string"
                    },
                    "subject": {
                      "type": "string"
                    },
                    "ticket_no": {
                      "type": "string"
                    },
                    "user_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "user_unread": {
                      "type": "boolean"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "ticket_no",
                    "user_id",
                    "subject",
                    "category",
                    "priority",
                    "status",
                    "assignee_staff_id",
                    "related_order_id",
                    "related_subscription_id",
                    "first_response_due_at",
                    "resolution_due_at",
                    "first_responded_at",
                    "resolved_at",
                    "last_message_at",
                    "user_unread",
                    "staff_unread",
                    "created_at",
                    "version",
                    "available_actions"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid transition or stale version"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid ticket input"
          }
        },
        "summary": "Ticket detail",
        "tags": [
          "tickets"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-rate-limit": "support.tickets",
        "x-reauth": false
      }
    },
    "/api/v1/me/tickets/{id}/attachments/{fileId}/content": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "fileId",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/gzip": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/pdf": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/vnd.android.package-archive": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/vnd.appimage": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/vnd.debian.binary-package": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/vnd.microsoft.portable-executable": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-7z-compressed": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-apple-diskimage": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-msi": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-rpm": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/x-xar": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "application/zip": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/avif": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/gif": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/jpeg": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/png": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/svg+xml": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/webp": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "image/x-icon": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "text/csv": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "text/plain": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "video/mp4": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              },
              "video/webm": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "Private attachment"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not found"
          }
        },
        "summary": "Download a public reply attachment from your ticket",
        "tags": [
          "tickets"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-rate-limit": "support.tickets"
      }
    },
    "/api/v1/me/tickets/{id}/close": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "assignee_staff_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "available_actions": {
                      "items": {
                        "enum": [
                          "assign",
                          "reply",
                          "note",
                          "close",
                          "reopen",
                          "transition:open",
                          "transition:awaiting_staff",
                          "transition:awaiting_user",
                          "transition:resolved",
                          "transition:closed"
                        ],
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "category": {
                      "type": "string"
                    },
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "first_responded_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "first_response_due_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "last_message_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "priority": {
                      "enum": [
                        "low",
                        "normal",
                        "high",
                        "urgent"
                      ],
                      "type": "string"
                    },
                    "related_order_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "related_subscription_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolution_due_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolved_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "staff_unread": {
                      "type": "boolean"
                    },
                    "status": {
                      "enum": [
                        "open",
                        "awaiting_staff",
                        "awaiting_user",
                        "resolved",
                        "closed"
                      ],
                      "type": "string"
                    },
                    "subject": {
                      "type": "string"
                    },
                    "ticket_no": {
                      "type": "string"
                    },
                    "user_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "user_unread": {
                      "type": "boolean"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "ticket_no",
                    "user_id",
                    "subject",
                    "category",
                    "priority",
                    "status",
                    "assignee_staff_id",
                    "related_order_id",
                    "related_subscription_id",
                    "first_response_due_at",
                    "resolution_due_at",
                    "first_responded_at",
                    "resolved_at",
                    "last_message_at",
                    "user_unread",
                    "staff_unread",
                    "created_at",
                    "version",
                    "available_actions"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid transition or stale version"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid ticket input"
          }
        },
        "summary": "close a ticket",
        "tags": [
          "tickets"
        ],
        "x-audit": "support.ticket.close",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional",
        "x-rate-limit": "support.tickets",
        "x-reauth": false
      }
    },
    "/api/v1/me/tickets/{id}/messages": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "before",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "author_id": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "author_type": {
                            "enum": [
                              "user",
                              "staff",
                              "system"
                            ],
                            "type": "string"
                          },
                          "body_md": {
                            "type": "string"
                          },
                          "created_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "file_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "internal": {
                            "type": "boolean"
                          },
                          "ticket_id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "ticket_id",
                          "author_type",
                          "author_id",
                          "internal",
                          "body_md",
                          "file_ids",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not found"
          }
        },
        "summary": "Ticket messages",
        "tags": [
          "tickets"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-rate-limit": "support.tickets",
        "x-reauth": false
      },
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "body_md": {
                    "maxLength": 40000,
                    "minLength": 1,
                    "type": "string"
                  },
                  "file_ids": {
                    "default": [],
                    "items": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "maxItems": 10,
                    "type": "array"
                  }
                },
                "required": [
                  "body_md"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid transition or stale version"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid ticket input"
          }
        },
        "summary": "Reply to a ticket",
        "tags": [
          "tickets"
        ],
        "x-audit": "support.ticket.reply",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "optional",
        "x-rate-limit": "support.tickets",
        "x-reauth": false
      }
    },
    "/api/v1/me/tickets/{id}/reopen": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "assignee_staff_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "available_actions": {
                      "items": {
                        "enum": [
                          "assign",
                          "reply",
                          "note",
                          "close",
                          "reopen",
                          "transition:open",
                          "transition:awaiting_staff",
                          "transition:awaiting_user",
                          "transition:resolved",
                          "transition:closed"
                        ],
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "category": {
                      "type": "string"
                    },
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "first_responded_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "first_response_due_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "last_message_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "priority": {
                      "enum": [
                        "low",
                        "normal",
                        "high",
                        "urgent"
                      ],
                      "type": "string"
                    },
                    "related_order_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "related_subscription_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolution_due_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolved_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "staff_unread": {
                      "type": "boolean"
                    },
                    "status": {
                      "enum": [
                        "open",
                        "awaiting_staff",
                        "awaiting_user",
                        "resolved",
                        "closed"
                      ],
                      "type": "string"
                    },
                    "subject": {
                      "type": "string"
                    },
                    "ticket_no": {
                      "type": "string"
                    },
                    "user_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "user_unread": {
                      "type": "boolean"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "ticket_no",
                    "user_id",
                    "subject",
                    "category",
                    "priority",
                    "status",
                    "assignee_staff_id",
                    "related_order_id",
                    "related_subscription_id",
                    "first_response_due_at",
                    "resolution_due_at",
                    "first_responded_at",
                    "resolved_at",
                    "last_message_at",
                    "user_unread",
                    "staff_unread",
                    "created_at",
                    "version",
                    "available_actions"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid transition or stale version"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Invalid ticket input"
          }
        },
        "summary": "reopen a ticket",
        "tags": [
          "tickets"
        ],
        "x-audit": "support.ticket.reopen",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "optional",
        "x-rate-limit": "support.tickets",
        "x-reauth": false
      }
    },
    "/api/v1/me/wallet": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Wallet"
                }
              }
            },
            "description": "My wallet",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "My balances: cash, gift, pending and available commission (ETag: wallet version)",
        "tags": [
          "wallet"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        }
      }
    },
    "/api/v1/me/wallet/commission-to-cash": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "amount_minor": {
                    "pattern": "^\\d{1,18}$",
                    "type": "string"
                  }
                },
                "required": [
                  "amount_minor"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "transferred_minor": {
                      "pattern": "^\\d{1,18}$",
                      "type": "string"
                    }
                  },
                  "required": [
                    "transferred_minor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Transfer available commission to balance",
        "tags": [
          "referral"
        ],
        "x-audit": "growth.commission.transfer",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-mfa": true,
        "x-reauth": false
      }
    },
    "/api/v1/me/wallet/entries": {
      "get": {
        "parameters": [
          {
            "description": "Bucket; repeat the parameter for several values",
            "in": "query",
            "name": "bucket",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "cash",
                    "gift",
                    "commission_pending",
                    "commission"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "cash",
                      "gift",
                      "commission_pending",
                      "commission"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Bucket; repeat the parameter for several values"
            }
          },
          {
            "description": "Entry kind; repeat the parameter for several values",
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "top_up",
                    "order_apply",
                    "order_release",
                    "order_reapply",
                    "order_payment",
                    "refund",
                    "admin_adjust",
                    "gift_grant",
                    "commission_accrue",
                    "commission_release",
                    "commission_reverse",
                    "commission_to_cash",
                    "withdraw_hold",
                    "withdraw_release",
                    "commission_withdraw_hold",
                    "commission_withdraw_release",
                    "commission_withdraw_settle",
                    "correction"
                  ],
                  "type": "string"
                },
                {
                  "items": {
                    "enum": [
                      "top_up",
                      "order_apply",
                      "order_release",
                      "order_reapply",
                      "order_payment",
                      "refund",
                      "admin_adjust",
                      "gift_grant",
                      "commission_accrue",
                      "commission_release",
                      "commission_reverse",
                      "commission_to_cash",
                      "withdraw_hold",
                      "withdraw_release",
                      "commission_withdraw_hold",
                      "commission_withdraw_release",
                      "commission_withdraw_settle",
                      "correction"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                }
              ],
              "description": "Entry kind; repeat the parameter for several values"
            }
          },
          {
            "description": "Inclusive lower bound (ISO-8601)",
            "in": "query",
            "name": "created_from",
            "required": false,
            "schema": {
              "description": "Inclusive lower bound (ISO-8601)",
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Exclusive upper bound (ISO-8601)",
            "in": "query",
            "name": "created_to",
            "required": false,
            "schema": {
              "description": "Exclusive upper bound (ISO-8601)",
              "format": "date-time",
              "type": "string"
            }
          },
          {
            "description": "Default 20, at most 100",
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "description": "Default 20, at most 100",
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "description": "`next_cursor` of the previous page",
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "description": "`next_cursor` of the previous page",
              "maxLength": 512,
              "minLength": 1,
              "type": "string"
            }
          },
          {
            "description": "Return `total` (first page only)",
            "in": "query",
            "name": "include_total",
            "required": false,
            "schema": {
              "description": "Return `total` (first page only)",
              "enum": [
                "true",
                "false"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WalletEntryPage"
                }
              }
            },
            "description": "A page of my entries"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid filter or cursor"
          }
        },
        "summary": "My wallet entries, newest first (keyset pages)",
        "tags": [
          "wallet"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/me/withdrawal-policy": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "fee_bps": {
                      "type": "integer"
                    },
                    "fee_fixed_minor": {
                      "type": "string"
                    },
                    "minimum_minor": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "minimum_minor",
                    "fee_fixed_minor",
                    "fee_bps"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Withdrawal minimum and fee rules",
        "tags": [
          "withdrawals"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "growth.withdrawal.command",
        "x-reauth": false
      }
    },
    "/api/v1/me/withdrawals": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "enum": [
                "requested",
                "approved",
                "paid",
                "rejected",
                "cancelled"
              ],
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "required": false,
            "schema": {
              "maxLength": 1024,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "page_size",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "properties": {
                          "amount_minor": {
                            "type": "string"
                          },
                          "created_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "currency": {
                            "type": "string"
                          },
                          "fee_minor": {
                            "type": "string"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "method": {
                            "type": "string"
                          },
                          "paid_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "paid_reference": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "payee_masked": {
                            "type": "string"
                          },
                          "payout_minor": {
                            "type": "string"
                          },
                          "review_reason": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "reviewed_by": {
                            "format": "uuid",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "status": {
                            "enum": [
                              "requested",
                              "approved",
                              "paid",
                              "rejected",
                              "cancelled"
                            ],
                            "type": "string"
                          },
                          "updated_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "user_id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "version": {
                            "type": "integer"
                          },
                          "withdrawal_no": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "withdrawal_no",
                          "user_id",
                          "amount_minor",
                          "fee_minor",
                          "payout_minor",
                          "currency",
                          "method",
                          "payee_masked",
                          "status",
                          "review_reason",
                          "reviewed_by",
                          "paid_reference",
                          "paid_at",
                          "created_at",
                          "updated_at",
                          "version"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "next_cursor",
                    "has_more"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Withdrawal conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid withdrawal"
          }
        },
        "summary": "My withdrawals",
        "tags": [
          "withdrawals"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "growth.withdrawal.command",
        "x-reauth": false
      },
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "amount_minor": {
                    "pattern": "^[1-9]\\d{0,17}$",
                    "type": "string"
                  },
                  "currency": {
                    "pattern": "^[A-Z]{3}$",
                    "type": "string"
                  },
                  "method": {
                    "pattern": "^[a-z][a-z0-9_-]{0,63}$",
                    "type": "string"
                  },
                  "payee": {
                    "additionalProperties": false,
                    "properties": {
                      "account": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "bank": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      },
                      "name": {
                        "maxLength": 200,
                        "minLength": 1,
                        "type": "string"
                      }
                    },
                    "required": [
                      "name",
                      "account"
                    ],
                    "type": "object"
                  }
                },
                "required": [
                  "amount_minor",
                  "currency",
                  "method",
                  "payee"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "amount_minor": {
                      "type": "string"
                    },
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "fee_minor": {
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "method": {
                      "type": "string"
                    },
                    "paid_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "paid_reference": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "payee_masked": {
                      "type": "string"
                    },
                    "payout_minor": {
                      "type": "string"
                    },
                    "review_reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reviewed_by": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "enum": [
                        "requested",
                        "approved",
                        "paid",
                        "rejected",
                        "cancelled"
                      ],
                      "type": "string"
                    },
                    "updated_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "user_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    },
                    "withdrawal_no": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "withdrawal_no",
                    "user_id",
                    "amount_minor",
                    "fee_minor",
                    "payout_minor",
                    "currency",
                    "method",
                    "payee_masked",
                    "status",
                    "review_reason",
                    "reviewed_by",
                    "paid_reference",
                    "paid_at",
                    "created_at",
                    "updated_at",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Withdrawal conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid withdrawal"
          }
        },
        "summary": "Request a commission withdrawal",
        "tags": [
          "withdrawals"
        ],
        "x-audit": "growth.withdrawal.request",
        "x-body": "json",
        "x-body-limit": 8192,
        "x-capability": "me.withdrawal.create",
        "x-concurrency": {
          "etag": true
        },
        "x-idempotency": "required",
        "x-rate-limit": "growth.withdrawal.command",
        "x-reauth": false
      }
    },
    "/api/v1/me/withdrawals/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "amount_minor": {
                      "type": "string"
                    },
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "fee_minor": {
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "method": {
                      "type": "string"
                    },
                    "paid_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "paid_reference": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "payee_masked": {
                      "type": "string"
                    },
                    "payout_minor": {
                      "type": "string"
                    },
                    "review_reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reviewed_by": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "enum": [
                        "requested",
                        "approved",
                        "paid",
                        "rejected",
                        "cancelled"
                      ],
                      "type": "string"
                    },
                    "updated_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "user_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    },
                    "withdrawal_no": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "withdrawal_no",
                    "user_id",
                    "amount_minor",
                    "fee_minor",
                    "payout_minor",
                    "currency",
                    "method",
                    "payee_masked",
                    "status",
                    "review_reason",
                    "reviewed_by",
                    "paid_reference",
                    "paid_at",
                    "created_at",
                    "updated_at",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Withdrawal conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid withdrawal"
          }
        },
        "summary": "My withdrawal",
        "tags": [
          "withdrawals"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-concurrency": {
          "etag": true
        },
        "x-idempotency": "none",
        "x-rate-limit": "growth.withdrawal.command",
        "x-reauth": false
      }
    },
    "/api/v1/me/withdrawals/{id}/cancel": {
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "description": "Resource ETag; missing 428, malformed 412, stale 409.",
            "in": "header",
            "name": "If-Match",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "reason": {
                    "maxLength": 500,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "reason"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "amount_minor": {
                      "type": "string"
                    },
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "currency": {
                      "type": "string"
                    },
                    "fee_minor": {
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "method": {
                      "type": "string"
                    },
                    "paid_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "paid_reference": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "payee_masked": {
                      "type": "string"
                    },
                    "payout_minor": {
                      "type": "string"
                    },
                    "review_reason": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "reviewed_by": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "status": {
                      "enum": [
                        "requested",
                        "approved",
                        "paid",
                        "rejected",
                        "cancelled"
                      ],
                      "type": "string"
                    },
                    "updated_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "user_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    },
                    "withdrawal_no": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "withdrawal_no",
                    "user_id",
                    "amount_minor",
                    "fee_minor",
                    "payout_minor",
                    "currency",
                    "method",
                    "payee_masked",
                    "status",
                    "review_reason",
                    "reviewed_by",
                    "paid_reference",
                    "paid_at",
                    "created_at",
                    "updated_at",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result",
            "headers": {
              "ETag": {
                "description": "Current resource version for If-Match.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Not found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Withdrawal conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid withdrawal"
          }
        },
        "summary": "Cancel a requested withdrawal",
        "tags": [
          "withdrawals"
        ],
        "x-audit": "growth.withdrawal.cancel",
        "x-body": "json",
        "x-body-limit": 8192,
        "x-concurrency": {
          "etag": true,
          "ifMatch": true
        },
        "x-idempotency": "required",
        "x-rate-limit": "growth.withdrawal.command",
        "x-reauth": false
      }
    },
    "/api/v1/public/announcements": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "before",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "body_md": {
                            "type": "string"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "kind": {
                            "enum": [
                              "normal",
                              "important",
                              "maintenance"
                            ],
                            "type": "string"
                          },
                          "pinned": {
                            "type": "boolean"
                          },
                          "popup": {
                            "type": "boolean"
                          },
                          "publish_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "title": {
                            "type": "string"
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "pinned",
                          "popup",
                          "version",
                          "publish_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "summary": "Published public announcements",
        "tags": [
          "announcements"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-rate-limit": "support.content.read"
      }
    },
    "/api/v1/public/announcements/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "body_md": {
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "normal",
                        "important",
                        "maintenance"
                      ],
                      "type": "string"
                    },
                    "pinned": {
                      "type": "boolean"
                    },
                    "popup": {
                      "type": "boolean"
                    },
                    "publish_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "title": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "kind",
                    "pinned",
                    "popup",
                    "version",
                    "publish_at"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not found"
          }
        },
        "summary": "A public announcement",
        "tags": [
          "announcements"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-rate-limit": "support.content.read"
      }
    },
    "/api/v1/public/captcha/cap/challenge": {
      "post": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapChallenge"
                }
              }
            },
            "description": "Challenge"
          }
        },
        "summary": "Cap proof-of-work challenge (cap-widget `challenge`)",
        "tags": [
          "public"
        ],
        "x-body": "json",
        "x-body-limit": 1024,
        "x-idempotency": "none",
        "x-rate-limit": "auth.captcha.issue.ip"
      }
    },
    "/api/v1/public/captcha/cap/redeem": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CapRedeemRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CapPass"
                }
              }
            },
            "description": "Pass token"
          }
        },
        "summary": "Redeem Cap solutions for a one-time pass token (cap-widget `redeem`)",
        "tags": [
          "public"
        ],
        "x-body": "json",
        "x-body-limit": 16384,
        "x-idempotency": "none",
        "x-rate-limit": "auth.captcha.redeem.ip"
      }
    },
    "/api/v1/public/captcha/image": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "scene",
            "required": true,
            "schema": {
              "enum": [
                "register",
                "login_after_failures",
                "password_reset",
                "send_code",
                "checkout"
              ],
              "example": "register",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "image/svg+xml": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "description": "The captcha; answer it with the protected request (X-Captcha-Response + Captcha-Id)",
            "headers": {
              "Captcha-Id": {
                "description": "Captcha id to send back in Captcha-Id",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "summary": "Image captcha (SVG) for a scene that uses it; one-time, 5 minutes, 3 attempts",
        "tags": [
          "public"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-rate-limit": "auth.captcha.issue.ip"
      }
    },
    "/api/v1/public/catalog": {
      "get": {
        "parameters": [
          {
            "description": "Preferred locale; before Accept-Language",
            "in": "query",
            "name": "locale",
            "required": false,
            "schema": {
              "description": "Preferred locale; before Accept-Language",
              "pattern": "^[a-z]{2,3}(-[A-Z][a-z]{3})?(-([A-Z]{2}|\\d{3}))?$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCatalog"
                }
              }
            },
            "description": "The catalog, with Content-Language"
          }
        },
        "summary": "Products, plans and price options on sale (localized)",
        "tags": [
          "catalog"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/public/checkout": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "combined_payment": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "combined_payment"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Combined checkout availability",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/public/checkout-links/resolve": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "token",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\.[A-Za-z0-9_-]{43}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "embedding_origin",
            "required": true,
            "schema": {
              "format": "uri",
              "maxLength": 2048,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "coupon": {
                      "pattern": "^[A-Z0-9][A-Z0-9_-]{3,31}$",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "expires_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "key_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "origins": {
                      "items": {
                        "format": "uri",
                        "maxLength": 2048,
                        "type": "string"
                      },
                      "maxItems": 20,
                      "minItems": 1,
                      "type": "array"
                    },
                    "plan_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "price_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "return_url": {
                      "format": "uri",
                      "maxLength": 2048,
                      "type": "string"
                    },
                    "v": {
                      "enum": [
                        1
                      ],
                      "type": "number"
                    }
                  },
                  "required": [
                    "plan_id",
                    "price_id",
                    "coupon",
                    "expires_at",
                    "origins",
                    "return_url",
                    "v",
                    "id",
                    "key_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid or expired link"
          }
        },
        "summary": "Resolve a signed checkout selection",
        "tags": [
          "checkout-links"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/public/clients": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "description": {
                            "type": "string"
                          },
                          "downloads": {
                            "items": {
                              "properties": {
                                "file_id": {
                                  "format": "uuid",
                                  "type": "string"
                                },
                                "filename": {
                                  "type": "string"
                                },
                                "platform": {
                                  "type": "string"
                                },
                                "sha256": {
                                  "type": [
                                    "string",
                                    "null"
                                  ]
                                },
                                "size_bytes": {
                                  "type": "string"
                                },
                                "type": {
                                  "enum": [
                                    "external",
                                    "hosted"
                                  ],
                                  "type": "string"
                                },
                                "url": {
                                  "type": "string"
                                },
                                "version": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "type",
                                "platform",
                                "url"
                              ],
                              "type": "object"
                            },
                            "type": "array"
                          },
                          "key": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "key",
                          "downloads"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Client catalog"
          }
        },
        "summary": "Client downloads with verified installer metadata",
        "tags": [
          "clients"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-rate-limit": "distribution.clients.read"
      }
    },
    "/api/v1/public/content": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "locale",
            "required": false,
            "schema": {
              "maxLength": 35,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "footer_md": {
                      "type": "string"
                    },
                    "pages": {
                      "items": {
                        "properties": {
                          "body_md": {
                            "type": "string"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "slug",
                          "title",
                          "body_md"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "tutorial_enabled": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "tutorial_enabled",
                    "pages"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "summary": "Portal footer and tutorial switch",
        "tags": [
          "content"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-rate-limit": "support.content.read"
      }
    },
    "/api/v1/public/content/pages/{slug}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "maxLength": 80,
              "minLength": 1,
              "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "locale",
            "required": false,
            "schema": {
              "maxLength": 35,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "body_md": {
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "slug",
                    "title",
                    "body_md"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not found"
          }
        },
        "summary": "Published localized website page",
        "tags": [
          "content"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "support.content.read",
        "x-reauth": false
      }
    },
    "/api/v1/public/docs": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "category",
            "required": false,
            "schema": {
              "maxLength": 80,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "after",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "properties": {
                          "body_md": {
                            "type": "string"
                          },
                          "category": {
                            "type": "string"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "sort": {
                            "type": "integer"
                          },
                          "title": {
                            "type": "string"
                          },
                          "version": {
                            "type": "integer"
                          }
                        },
                        "required": [
                          "id",
                          "slug",
                          "category",
                          "sort",
                          "title",
                          "body_md",
                          "version"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          }
        },
        "summary": "Published knowledge base",
        "tags": [
          "docs"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-rate-limit": "support.docs"
      }
    },
    "/api/v1/public/docs/{slug}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "maxLength": 150,
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "body_md": {
                      "type": "string"
                    },
                    "category": {
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "sort": {
                      "type": "integer"
                    },
                    "title": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "slug",
                    "category",
                    "sort",
                    "title",
                    "body_md",
                    "version"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Not published"
          }
        },
        "summary": "Published knowledge base article",
        "tags": [
          "docs"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-rate-limit": "support.docs"
      }
    },
    "/api/v1/public/embed/catalog": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "token",
            "required": true,
            "schema": {
              "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\.[A-Za-z0-9_-]{43}$",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "locale",
            "required": false,
            "schema": {
              "enum": [
                "zh-CN",
                "en-US"
              ],
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicCatalog"
                }
              }
            },
            "description": "Result"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid link or embedding origin"
          }
        },
        "summary": "Origin-bound public catalogue for embeds",
        "tags": [
          "checkout-links"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "commerce.checkout",
        "x-reauth": false
      }
    },
    "/api/v1/public/install": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InstallRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InstallResponse"
                }
              }
            },
            "description": "Installed"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Install secret missing or invalid"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "platform.already_installed, platform.install_in_progress or an Idempotency-Key conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Validation failed"
          },
          "428": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Idempotency-Key missing"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Rate limited"
          }
        },
        "summary": "Run the one-time install wizard: site, first root, preset roles, default settings",
        "tags": [
          "install"
        ],
        "x-audit": "platform.install",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-rate-limit": "platform.install.ip"
      }
    },
    "/api/v1/public/install/status": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InstallStatus"
                }
              }
            },
            "description": "State"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {}
              }
            },
            "description": "Rate limited"
          }
        },
        "summary": "Installation state and what the wizard needs",
        "tags": [
          "install"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-rate-limit": "platform.install_status.ip"
      }
    },
    "/api/v1/public/invitations/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PublicInvitation"
                }
              }
            },
            "description": "Invitation"
          }
        },
        "summary": "Invitation details for the invitee (masked)",
        "tags": [
          "public"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-rate-limit": "iam.invitation.view"
      }
    },
    "/api/v1/public/maintenance": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MaintenanceState"
                }
              }
            },
            "description": "Current switch; no operational reason or operator identity"
          }
        },
        "summary": "Read the maintenance switch",
        "tags": [
          "platform"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none"
      }
    },
    "/api/v1/public/payment-channels": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "items": {
                      "items": {
                        "$ref": "#/components/schemas/CommercePublicChannel"
                      },
                      "type": "array"
                    }
                  },
                  "required": [
                    "items"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Enabled checkout channels",
        "tags": [
          "commerce"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none"
      }
    },
    "/api/v1/public/referral/{code}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "code",
            "required": true,
            "schema": {
              "maxLength": 64,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "invitee_rewards": {},
                    "promoter_name": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "valid": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "valid",
                    "promoter_name"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Result"
          }
        },
        "summary": "Referral landing information",
        "tags": [
          "referral"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/public/site": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "locale",
            "required": false,
            "schema": {
              "maxLength": 35,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteInfo"
                }
              }
            },
            "description": "Site information"
          }
        },
        "summary": "Public site information",
        "tags": [
          "site"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/api/v1/public/status": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "components": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "state": {
                            "enum": [
                              "operational",
                              "degraded",
                              "partial_outage",
                              "major_outage",
                              "maintenance"
                            ],
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "name",
                          "state"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "events": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "component_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "ends_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "kind": {
                            "enum": [
                              "incident",
                              "maintenance"
                            ],
                            "type": "string"
                          },
                          "phase": {
                            "enum": [
                              "published",
                              "active",
                              "resolved"
                            ],
                            "type": "string"
                          },
                          "published_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "resolved_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "starts_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "state": {
                            "enum": [
                              "degraded",
                              "partial_outage",
                              "major_outage",
                              "maintenance"
                            ],
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "title",
                          "state",
                          "phase",
                          "component_ids",
                          "starts_at",
                          "ends_at",
                          "published_at",
                          "resolved_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "has_more": {
                      "type": "boolean"
                    },
                    "next_cursor": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "components",
                    "events",
                    "has_more",
                    "next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "304": {
            "description": "Not modified"
          }
        },
        "tags": [
          "status"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "support.status",
        "x-reauth": false
      }
    },
    "/api/v1/public/status/incidents": {
      "get": {
        "parameters": [
          {
            "in": "query",
            "name": "before",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "has_more": {
                      "type": "boolean"
                    },
                    "items": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "component_ids": {
                            "items": {
                              "format": "uuid",
                              "type": "string"
                            },
                            "type": "array"
                          },
                          "ends_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          },
                          "kind": {
                            "enum": [
                              "incident",
                              "maintenance"
                            ],
                            "type": "string"
                          },
                          "phase": {
                            "enum": [
                              "published",
                              "active",
                              "resolved"
                            ],
                            "type": "string"
                          },
                          "published_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "resolved_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "starts_at": {
                            "format": "date-time",
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "state": {
                            "enum": [
                              "degraded",
                              "partial_outage",
                              "major_outage",
                              "maintenance"
                            ],
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "kind",
                          "title",
                          "state",
                          "phase",
                          "component_ids",
                          "starts_at",
                          "ends_at",
                          "published_at",
                          "resolved_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "next_cursor": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "items",
                    "has_more",
                    "next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "304": {
            "description": "Not modified"
          }
        },
        "tags": [
          "status"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "support.status",
        "x-reauth": false
      }
    },
    "/api/v1/public/status/incidents/{id}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "before",
            "required": false,
            "schema": {
              "format": "uuid",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 20,
              "maximum": 100,
              "minimum": 1,
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": false,
                  "properties": {
                    "component_ids": {
                      "items": {
                        "format": "uuid",
                        "type": "string"
                      },
                      "type": "array"
                    },
                    "ends_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "kind": {
                      "enum": [
                        "incident",
                        "maintenance"
                      ],
                      "type": "string"
                    },
                    "phase": {
                      "enum": [
                        "published",
                        "active",
                        "resolved"
                      ],
                      "type": "string"
                    },
                    "published_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "resolved_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "starts_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "state": {
                      "enum": [
                        "degraded",
                        "partial_outage",
                        "major_outage",
                        "maintenance"
                      ],
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "updates": {
                      "items": {
                        "additionalProperties": false,
                        "properties": {
                          "body": {
                            "type": "string"
                          },
                          "created_at": {
                            "format": "date-time",
                            "type": "string"
                          },
                          "id": {
                            "format": "uuid",
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "body",
                          "created_at"
                        ],
                        "type": "object"
                      },
                      "type": "array"
                    },
                    "updates_has_more": {
                      "type": "boolean"
                    },
                    "updates_next_cursor": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    }
                  },
                  "required": [
                    "id",
                    "kind",
                    "title",
                    "state",
                    "phase",
                    "component_ids",
                    "starts_at",
                    "ends_at",
                    "published_at",
                    "resolved_at",
                    "updates",
                    "updates_has_more",
                    "updates_next_cursor"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "304": {
            "description": "Not modified"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          }
        },
        "tags": [
          "status"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "support.status",
        "x-reauth": false
      }
    },
    "/api/v1/public/status/unsubscribe": {
      "post": {
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": false,
                "properties": {
                  "token": {
                    "maxLength": 16000,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "token"
                ],
                "type": "object"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "unsubscribed": {
                      "enum": [
                        true
                      ],
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "unsubscribed"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Success"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "number"
                    },
                    "title": {
                      "type": "string"
                    },
                    "type": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "code",
                    "request_id"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Request failed"
          }
        },
        "tags": [
          "status"
        ],
        "x-audit": "support.status.unsubscribe",
        "x-body": "json",
        "x-body-limit": 65536,
        "x-idempotency": "required",
        "x-rate-limit": "support.status",
        "x-reauth": false
      }
    },
    "/api/v1/public/unsubscribe/{token}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "token",
            "required": true,
            "schema": {
              "maxLength": 2048,
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "category": {
                      "enum": [
                        "marketing"
                      ],
                      "type": "string"
                    },
                    "channel": {
                      "enum": [
                        "email",
                        "sms",
                        "telegram",
                        "inbox"
                      ],
                      "type": "string"
                    }
                  },
                  "required": [
                    "category",
                    "channel"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Confirmation"
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid token"
          }
        },
        "summary": "Preview a signed unsubscribe action",
        "tags": [
          "notification-center"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "notify.unsubscribe",
        "x-reauth": false
      },
      "post": {
        "parameters": [
          {
            "in": "path",
            "name": "token",
            "required": true,
            "schema": {
              "maxLength": 2048,
              "minLength": 1,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "category": {
                      "enum": [
                        "marketing"
                      ],
                      "type": "string"
                    },
                    "channel": {
                      "enum": [
                        "email",
                        "sms",
                        "telegram",
                        "inbox"
                      ],
                      "type": "string"
                    },
                    "unsubscribed": {
                      "enum": [
                        true
                      ],
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "category",
                    "channel",
                    "unsubscribed"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Unsubscribed"
          },
          "400": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "description": "Invalid token"
          }
        },
        "summary": "Unsubscribe an optional notification channel",
        "tags": [
          "notification-center"
        ],
        "x-audit": "notify.unsubscribe",
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "notify.unsubscribe",
        "x-reauth": false
      }
    },
    "/healthz": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            },
            "description": "Alive"
          }
        },
        "summary": "Liveness (no database access)",
        "tags": [
          "health"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    },
    "/r/{code}": {
      "get": {
        "parameters": [
          {
            "in": "path",
            "name": "code",
            "required": true,
            "schema": {
              "maxLength": 64,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "to",
            "required": false,
            "schema": {
              "maxLength": 500,
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "ch",
            "required": false,
            "schema": {
              "pattern": "^[a-zA-Z0-9_-]{1,64}$",
              "type": "string"
            }
          }
        ],
        "responses": {
          "302": {
            "description": "Whitelisted landing page"
          }
        },
        "summary": "Record last-click attribution and redirect",
        "tags": [
          "referral"
        ],
        "x-body": "none",
        "x-body-limit": 0,
        "x-idempotency": "none",
        "x-rate-limit": "growth.referral.ip",
        "x-reauth": false
      }
    },
    "/readyz": {
      "get": {
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Readiness"
                }
              }
            },
            "description": "Ready"
          },
          "503": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Readiness"
                }
              }
            },
            "description": "Not ready"
          }
        },
        "summary": "Readiness: database, schema compatibility window, installation",
        "tags": [
          "health"
        ],
        "x-body": "none",
        "x-body-limit": 0
      }
    }
  },
  "webhooks": {},
  "x-error-codes": {
    "auth.account_banned": {
      "status": 403,
      "title": "Account banned"
    },
    "auth.account_disabled": {
      "status": 403,
      "title": "Account disabled"
    },
    "auth.code_cooldown": {
      "status": 429,
      "title": "Verification code requested too often"
    },
    "auth.code_expired": {
      "status": 422,
      "title": "Verification code expired"
    },
    "auth.code_invalid": {
      "status": 422,
      "title": "Invalid verification code"
    },
    "auth.email_domain_not_allowed": {
      "status": 422,
      "title": "Email domain not allowed"
    },
    "auth.email_not_verified": {
      "status": 403,
      "title": "Email not verified"
    },
    "auth.email_taken": {
      "status": 409,
      "title": "Email already in use"
    },
    "auth.forbidden": {
      "status": 403,
      "title": "Forbidden"
    },
    "auth.human_verification_failed": {
      "status": 422,
      "title": "Human verification failed"
    },
    "auth.human_verification_unavailable": {
      "status": 503,
      "title": "Human verification unavailable"
    },
    "auth.invalid_credentials": {
      "status": 401,
      "title": "Invalid credentials"
    },
    "auth.invite_invalid": {
      "status": 422,
      "title": "Invitation or invite code is not valid"
    },
    "auth.invite_required": {
      "status": 422,
      "title": "An invitation is required"
    },
    "auth.last_login_method": {
      "status": 409,
      "title": "The last sign-in method cannot be removed"
    },
    "auth.mfa_enrollment_required": {
      "status": 403,
      "title": "Two-factor enrollment required"
    },
    "auth.mfa_required": {
      "status": 403,
      "title": "Two-factor verification required"
    },
    "auth.reauth_required": {
      "status": 403,
      "title": "Re-authentication required"
    },
    "auth.registration_closed": {
      "status": 403,
      "title": "Registration is closed"
    },
    "auth.session_expired": {
      "status": 401,
      "title": "Session expired"
    },
    "auth.session_revoked": {
      "status": 401,
      "title": "Session revoked"
    },
    "auth.totp_invalid": {
      "status": 422,
      "title": "Invalid authenticator code"
    },
    "auth.unauthenticated": {
      "status": 401,
      "title": "Authentication required"
    },
    "catalog.not_renewable": {
      "status": 409,
      "title": "Plan cannot be renewed"
    },
    "catalog.out_of_stock": {
      "status": 409,
      "title": "Out of stock"
    },
    "catalog.per_user_limit_reached": {
      "status": 409,
      "title": "Purchase limit per user reached"
    },
    "catalog.plan_code_taken": {
      "status": 409,
      "title": "Plan code already in use"
    },
    "catalog.plan_unavailable": {
      "status": 409,
      "title": "Plan is not available"
    },
    "catalog.price_inactive": {
      "status": 409,
      "title": "Price option is not active"
    },
    "catalog.price_period_taken": {
      "status": 409,
      "title": "An active price option for this period already exists"
    },
    "catalog.price_referenced": {
      "status": 409,
      "title": "Price option is referenced; deactivate it instead"
    },
    "catalog.slug_taken": {
      "status": 409,
      "title": "Product slug already in use"
    },
    "catalog.status_transition_invalid": {
      "status": 409,
      "title": "Status change not allowed"
    },
    "catalog.stock_below_committed": {
      "status": 409,
      "title": "Stock total is below sold plus reserved units"
    },
    "commerce.amount_out_of_range": {
      "status": 422,
      "title": "Amount is outside the allowed range"
    },
    "commerce.channel_error": {
      "status": 502,
      "title": "Payment channel request failed"
    },
    "commerce.channel_unavailable": {
      "status": 409,
      "title": "Payment channel is unavailable"
    },
    "commerce.order_expired": {
      "status": 409,
      "title": "Order has expired"
    },
    "commerce.order_not_payable": {
      "status": 409,
      "title": "Order is not payable"
    },
    "commerce.payment_in_progress": {
      "status": 409,
      "title": "Payment is in progress"
    },
    "commerce.payment_state_conflict": {
      "status": 409,
      "title": "Payment state has changed"
    },
    "commerce.plan_change_busy": {
      "status": 409,
      "title": "Plan change sources are locked; retry"
    },
    "commerce.quote_stale": {
      "status": 409,
      "title": "Quote has changed"
    },
    "commerce.refund_exceeds_paid": {
      "status": 409,
      "title": "Refund exceeds paid amount"
    },
    "commerce.refund_not_allowed": {
      "status": 409,
      "title": "Refund is not allowed"
    },
    "common.bad_request": {
      "status": 400,
      "title": "Bad request"
    },
    "common.idempotency_in_progress": {
      "status": 409,
      "title": "Request with this idempotency key is in progress"
    },
    "common.idempotency_key_reused": {
      "status": 409,
      "title": "Idempotency key reused with a different request"
    },
    "common.internal_error": {
      "status": 500,
      "title": "Internal error"
    },
    "common.not_found": {
      "status": 404,
      "title": "Not found"
    },
    "common.payload_too_large": {
      "status": 413,
      "title": "Request body too large"
    },
    "common.precondition_failed": {
      "status": 412,
      "title": "Malformed If-Match"
    },
    "common.precondition_required": {
      "status": 428,
      "title": "Precondition required"
    },
    "common.rate_limited": {
      "status": 429,
      "title": "Too many requests"
    },
    "common.unsupported_media_type": {
      "status": 415,
      "title": "Unsupported request body type"
    },
    "common.validation_failed": {
      "status": 422,
      "title": "Validation failed"
    },
    "common.version_conflict": {
      "status": 409,
      "title": "Version conflict"
    },
    "distribution.link_rate_limited": {
      "status": 429,
      "title": "Link rotation is too frequent"
    },
    "distribution.template_invalid": {
      "status": 422,
      "title": "Invalid subscription template"
    },
    "distribution.template_limit_exceeded": {
      "status": 422,
      "title": "Subscription template limit exceeded"
    },
    "growth.base_level_protected": {
      "status": 409,
      "title": "The base level must stay active, threshold-free and lowest"
    },
    "growth.code_exhausted": {
      "status": 409,
      "title": "Code is used up"
    },
    "growth.code_expired": {
      "status": 409,
      "title": "Code is expired or not valid yet"
    },
    "growth.code_invalid": {
      "status": 422,
      "title": "Code is not valid"
    },
    "growth.code_not_applicable": {
      "status": 409,
      "title": "Code does not apply to this order"
    },
    "growth.code_taken": {
      "status": 409,
      "title": "Code text already in use"
    },
    "growth.code_user_limit": {
      "status": 409,
      "title": "Per-user limit of the code reached"
    },
    "growth.coupon_in_use": {
      "status": 409,
      "title": "Coupon was issued or used; disable it instead"
    },
    "growth.coupon_unavailable": {
      "status": 409,
      "title": "Coupon is not available"
    },
    "growth.invite_code_invalid": {
      "status": 422,
      "title": "Invite code is not valid"
    },
    "growth.invite_required": {
      "status": 403,
      "title": "An invitation is required"
    },
    "growth.level_in_use": {
      "status": 409,
      "title": "Level still has users"
    },
    "growth.redeem_already_exported": {
      "status": 409,
      "title": "Redeem codes were already exported"
    },
    "growth.redeem_batch_voided": {
      "status": 409,
      "title": "Redeem batch is voided"
    },
    "growth.reward_state_conflict": {
      "status": 409,
      "title": "Reward is not in a state that allows this"
    },
    "growth.self_referral": {
      "status": 422,
      "title": "Users cannot refer themselves"
    },
    "growth.withdrawal_amount_invalid": {
      "status": 422,
      "title": "Withdrawal amount is below the minimum or fee"
    },
    "growth.withdrawal_state_conflict": {
      "status": 409,
      "title": "Withdrawal does not allow this transition"
    },
    "i18n.locale_not_enabled": {
      "status": 422,
      "title": "Locale is not enabled"
    },
    "i18n.translation_provider_failed": {
      "status": 502,
      "title": "Translation provider failed"
    },
    "iam.role_grant_forbidden": {
      "status": 403,
      "title": "Role or account change exceeds your permissions"
    },
    "iam.role_protected": {
      "status": 409,
      "title": "This role is protected"
    },
    "iam.root_protected": {
      "status": 409,
      "title": "At least one active root must remain"
    },
    "iam.status_transition_invalid": {
      "status": 409,
      "title": "Account status change not allowed"
    },
    "ledger.adjustment_review_forbidden": {
      "status": 403,
      "title": "An independent reviewer is required"
    },
    "ledger.adjustment_state_invalid": {
      "status": 409,
      "title": "Adjustment request is no longer pending"
    },
    "ledger.amount_invalid": {
      "status": 422,
      "title": "Invalid amount"
    },
    "ledger.insufficient_balance": {
      "status": 409,
      "title": "Insufficient balance"
    },
    "ledger.withdrawal_blocked": {
      "status": 409,
      "title": "Withdrawals are blocked"
    },
    "network.agent_not_active": {
      "status": 409,
      "title": "The server has no active agent"
    },
    "network.inbound_in_use": {
      "status": 409,
      "title": "The inbound still has nodes"
    },
    "network.ipv6_unavailable": {
      "status": 409,
      "title": "The server has not reported a public IPv6 address"
    },
    "network.port_conflict": {
      "status": 409,
      "title": "Port already used by an inbound with an overlapping transport"
    },
    "network.protocol_params_invalid": {
      "status": 422,
      "title": "Invalid protocol parameters"
    },
    "network.server_retired": {
      "status": 409,
      "title": "The server is retired"
    },
    "network.tag_invalid": {
      "status": 422,
      "title": "Invalid tag"
    },
    "node.auth_invalid": {
      "status": 401,
      "title": "Server token invalid"
    },
    "node.batch_conflict": {
      "status": 409,
      "title": "Batch sequence reused with different content"
    },
    "node.disabled": {
      "status": 403,
      "title": "Agent disabled"
    },
    "node.enrollment_invalid": {
      "status": 401,
      "title": "Enrollment token invalid or expired"
    },
    "node.payload_invalid": {
      "status": 422,
      "title": "Invalid node payload"
    },
    "node.protocol_unsupported": {
      "status": 426,
      "title": "Node protocol version not supported"
    },
    "notify.delivery_not_retryable": {
      "status": 409,
      "title": "Delivery cannot be retried"
    },
    "notify.provider_unavailable": {
      "status": 503,
      "title": "No notification provider is configured"
    },
    "notify.telegram_unauthorized": {
      "status": 401,
      "title": "Telegram callback authentication failed"
    },
    "notify.template_invalid": {
      "status": 422,
      "title": "Notification template is invalid"
    },
    "notify.token_invalid": {
      "status": 400,
      "title": "Notification token is invalid or expired"
    },
    "ops.bulk_preview_required": {
      "status": 409,
      "title": "Preview the bulk operation after its last edit"
    },
    "ops.bulk_state_invalid": {
      "status": 409,
      "title": "Invalid bulk operation state"
    },
    "ops.bulk_templates_missing": {
      "status": 409,
      "title": "Selected channels or locales have no template"
    },
    "ops.repair_preview_expired": {
      "status": 409,
      "title": "Repair preview expired"
    },
    "ops.repair_target_changed": {
      "status": 409,
      "title": "Repair target changed since the preview"
    },
    "platform.already_installed": {
      "status": 409,
      "title": "Site is already installed"
    },
    "platform.install_forbidden": {
      "status": 403,
      "title": "Install secret missing or invalid"
    },
    "platform.install_in_progress": {
      "status": 409,
      "title": "Installation is in progress"
    },
    "platform.not_installed": {
      "status": 503,
      "title": "Site is not installed"
    },
    "platform.read_only": {
      "status": 503,
      "title": "Site is read-only"
    },
    "security.host_rejected": {
      "status": 421,
      "title": "Host not served here"
    },
    "security.origin_rejected": {
      "status": 403,
      "title": "Request origin rejected"
    },
    "subscription.auto_renew_unavailable": {
      "status": 409,
      "title": "Automatic renewal is not available"
    },
    "subscription.device_not_found": {
      "status": 404,
      "title": "Device not found"
    },
    "subscription.not_active": {
      "status": 409,
      "title": "Subscription is not active"
    },
    "subscription.not_queued": {
      "status": 409,
      "title": "Subscription is not queued"
    },
    "subscription.not_reversible": {
      "status": 409,
      "title": "Grant cannot be reversed"
    },
    "subscription.perpetual": {
      "status": 409,
      "title": "Subscription has no end"
    },
    "subscription.status_transition_invalid": {
      "status": 409,
      "title": "Status change not allowed"
    },
    "subscription.version_conflict": {
      "status": 409,
      "title": "Subscription changed; reload and retry"
    },
    "support.checksum_mismatch": {
      "status": 422,
      "title": "Checksum mismatch"
    },
    "support.doc_condition_invalid": {
      "status": 422,
      "title": "Document conditional blocks are invalid"
    },
    "support.doc_slug_conflict": {
      "status": 409,
      "title": "Document slug is already in use"
    },
    "support.file_too_large": {
      "status": 413,
      "title": "File is too large"
    },
    "support.file_type_mismatch": {
      "status": 422,
      "title": "File content does not match its type"
    },
    "support.file_type_not_allowed": {
      "status": 422,
      "title": "File type is not allowed for this purpose"
    },
    "support.storage_quota_exceeded": {
      "status": 429,
      "title": "Upload quota exceeded"
    },
    "support.storage_unavailable": {
      "status": 503,
      "title": "File storage is unavailable"
    },
    "support.ticket_attachment_limit": {
      "status": 422,
      "title": "A ticket accepts at most ten attachments"
    },
    "support.ticket_category_invalid": {
      "status": 422,
      "title": "Ticket category is not available"
    },
    "support.ticket_invalid_transition": {
      "status": 409,
      "title": "Ticket transition is not allowed"
    },
    "support.upload_expired": {
      "status": 409,
      "title": "Upload session expired"
    },
    "support.upload_incomplete": {
      "status": 409,
      "title": "Upload is incomplete"
    },
    "system.job_not_cancellable": {
      "status": 409,
      "title": "Only pending or dead jobs can be cancelled"
    },
    "system.job_not_replayable": {
      "status": 409,
      "title": "Only dead jobs can be replayed"
    },
    "usage.correction_conflict": {
      "status": 409,
      "title": "This correction already exists or has conflicting previews; use a new correction id"
    },
    "usage.correction_out_of_range": {
      "status": 409,
      "title": "The correction would put usage counters outside the allowed range"
    },
    "usage.correction_period_changed": {
      "status": 409,
      "title": "The usage period has changed; preview the correction again"
    },
    "usage.online_unavailable": {
      "status": 503,
      "title": "Online device information is temporarily unavailable"
    }
  }
}
