{
 "openapi": "3.1.0",
 "info": {
  "title": "MergeMind Platform API",
  "version": "2026-10-22",
  "description": "Reference for the core services of the MergeMind platform, generated from the running services on 22 October 2026.\n\n**Base URL** `https://api.mergemind.co`\n\n**Authentication** Send `Authorization: Bearer <access token>`. Get a token from **Identity → Authentication**. Operations marked as needing no token (sign-in, public invites, branding lookups) can be called without one. The tenant always comes from the token, so you never send a tenant header.\n\n**How real is each area?** Every capability carries an evidence label on the [platform page](https://mergemind.co/platform). This reference lists what the services expose today; it does not mean a product of ours runs it.\n\n**Scope** Core platform services only. Vertical APIs (stores, marketplace, learning, finance) are described during onboarding."
 },
 "servers": [
  {
   "url": "https://api.mergemind.co",
   "description": "Production gateway"
  }
 ],
 "tags": [
  {
   "name": "Authentication",
   "description": "User sign-up, sign-in, and MFA verification"
  },
  {
   "name": "Social Login",
   "description": "OAuth2 social login — Google and GitHub"
  },
  {
   "name": "Magic Link",
   "description": "Passwordless one-time login via email"
  },
  {
   "name": "Public Phone Verification",
   "description": "SMS OTP for invite-only signup"
  },
  {
   "name": "SSO / OIDC",
   "description": "Enterprise single sign-on via OIDC federation"
  },
  {
   "name": "SSO / SAML2",
   "description": "Enterprise single sign-on via SAML2 federation"
  },
  {
   "name": "User Management",
   "description": "User profile, status, MFA setup, tenant listing, and role management"
  },
  {
   "name": "My Profile",
   "description": "Self-service profile and MFA management for the authenticated user"
  },
  {
   "name": "Public Onboarding",
   "description": "Self-serve tenant onboarding flow"
  },
  {
   "name": "Invite Management",
   "description": "Admin invite token creation"
  },
  {
   "name": "Public Invite",
   "description": "Invite-based onboarding flow"
  },
  {
   "name": "Permission Delegation",
   "description": "Delegate a subset of permissions to another tenant member"
  },
  {
   "name": "Tenant Settings",
   "description": "Per-tenant membership settings"
  },
  {
   "name": "Login Events",
   "description": "Security audit trail of authentication attempts"
  },
  {
   "name": "GDPR",
   "description": "GDPR Right to Erasure — personal data deletion flow"
  },
  {
   "name": "Onboarding checklist"
  },
  {
   "name": "SCIM 2.0"
  },
  {
   "name": "Tenant Management",
   "description": "Tenant lifecycle, membership, and onboarding"
  },
  {
   "name": "Application Management",
   "description": "Multi-application support per tenant"
  },
  {
   "name": "Developer Portal",
   "description": "API keys, webhooks, and developer tools"
  },
  {
   "name": "Tenant Export",
   "description": "GDPR Art 20 / data-portability export endpoints"
  },
  {
   "name": "Permission Management",
   "description": "Dynamic permission CRUD and role-permission mapping"
  },
  {
   "name": "ABAC Policy Management",
   "description": "Attribute-based access control rules per tenant"
  },
  {
   "name": "Authorization",
   "description": "Centralized access control decisions"
  },
  {
   "name": "Token Management",
   "description": "Token issuance, validation, and lifecycle"
  },
  {
   "name": "Event Management",
   "description": "Query and manage platform events"
  },
  {
   "name": "Workflow Rules",
   "description": "Event→plugin binding rules"
  },
  {
   "name": "Notifications",
   "description": "Push / email / in-app notification delivery"
  },
  {
   "name": "Notification Sender Settings",
   "description": "Per-tenant sender identity and SMTP configuration"
  },
  {
   "name": "Chat",
   "description": "Real-time chat channels and messaging"
  },
  {
   "name": "Wallet",
   "description": "Digital wallet and credit management"
  },
  {
   "name": "Wallet Holds",
   "description": "Escrow holds: authorize, capture with splits, release"
  },
  {
   "name": "Queue",
   "description": "Async task queue management"
  },
  {
   "name": "Workflow templates",
   "description": "Visual workflow builder — save, load, and manage workflow graph definitions"
  },
  {
   "name": "Webhooks",
   "description": "Enterprise webhook management with delivery logs and replay"
  },
  {
   "name": "Plugin Marketplace",
   "description": "Plugin registry, tenant installation, and invocation"
  }
 ],
 "x-tagGroups": [
  {
   "name": "Identity",
   "tags": [
    "Authentication",
    "Social Login",
    "Magic Link",
    "Public Phone Verification",
    "SSO / OIDC",
    "SSO / SAML2",
    "User Management",
    "My Profile",
    "Public Onboarding",
    "Invite Management",
    "Public Invite",
    "Permission Delegation",
    "Tenant Settings",
    "Login Events",
    "GDPR",
    "Onboarding checklist",
    "SCIM 2.0"
   ]
  },
  {
   "name": "Tenants",
   "tags": [
    "Tenant Management",
    "Application Management",
    "Developer Portal",
    "Tenant Export"
   ]
  },
  {
   "name": "Authorization",
   "tags": [
    "Permission Management",
    "ABAC Policy Management",
    "Authorization"
   ]
  },
  {
   "name": "Tokens",
   "tags": [
    "Token Management"
   ]
  },
  {
   "name": "Events",
   "tags": [
    "Event Management",
    "Workflow Rules"
   ]
  },
  {
   "name": "Notifications",
   "tags": [
    "Notifications",
    "Notification Sender Settings"
   ]
  },
  {
   "name": "Chat",
   "tags": [
    "Chat"
   ]
  },
  {
   "name": "Wallet",
   "tags": [
    "Wallet",
    "Wallet Holds"
   ]
  },
  {
   "name": "Queue",
   "tags": [
    "Queue"
   ]
  },
  {
   "name": "Workflows",
   "tags": [
    "Workflow templates",
    "Webhooks",
    "Plugin Marketplace"
   ]
  }
 ],
 "paths": {
  "/scim/v2/Users/{id}": {
   "get": {
    "tags": [
     "SCIM 2.0"
    ],
    "operationId": "getUser",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/scim+json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    },
    "summary": "Get user",
    "security": [
     {
      "scimToken": []
     }
    ],
    "description": "Authenticated with a SCIM token created for the tenant, not with a user access token.",
    "x-service": "Identity"
   },
   "put": {
    "tags": [
     "SCIM 2.0"
    ],
    "operationId": "replaceUser",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/scim+json": {
       "schema": {
        "$ref": "#/components/schemas/ScimUserResource"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/scim+json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    },
    "summary": "Replace user",
    "security": [
     {
      "scimToken": []
     }
    ],
    "description": "Authenticated with a SCIM token created for the tenant, not with a user access token.",
    "x-service": "Identity"
   },
   "delete": {
    "tags": [
     "SCIM 2.0"
    ],
    "operationId": "deleteUser",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/scim+json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    },
    "summary": "Delete user",
    "security": [
     {
      "scimToken": []
     }
    ],
    "description": "Authenticated with a SCIM token created for the tenant, not with a user access token.",
    "x-service": "Identity"
   }
  },
  "/api/v1/users/{userId}": {
   "get": {
    "tags": [
     "User Management"
    ],
    "summary": "Get user",
    "description": "Retrieves the profile of a user. Self or Admin only.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "getUser_1",
    "parameters": [
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/UserResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Identity"
   },
   "put": {
    "tags": [
     "User Management"
    ],
    "summary": "Update user",
    "description": "Updates mutable attributes of an existing user. Self or Admin only.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "updateUser",
    "parameters": [
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/UpdateUserRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/StatusResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/me": {
   "get": {
    "tags": [
     "My Profile"
    ],
    "summary": "Get my profile",
    "description": "Returns the authenticated user's profile information\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "getMyProfile",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/UserProfileResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "parameters": [],
    "x-service": "Identity"
   },
   "put": {
    "tags": [
     "My Profile"
    ],
    "summary": "Update my profile",
    "description": "Updates displayName, phoneNumber, and/or profileImageUrl\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "updateMyProfile",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/UpdateProfileRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/UserProfileResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/platform/tenant-settings/self-registration": {
   "get": {
    "tags": [
     "Tenant Settings"
    ],
    "summary": "Whether this tenant accepts public sign-up",
    "operationId": "get",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/SelfRegistrationSetting"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "parameters": [],
    "x-service": "Identity"
   },
   "put": {
    "tags": [
     "Tenant Settings"
    ],
    "summary": "Open or close this tenant to public sign-up",
    "operationId": "set",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SelfRegistrationSetting"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/SelfRegistrationSetting"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/scim/v2/Users": {
   "get": {
    "tags": [
     "SCIM 2.0"
    ],
    "operationId": "listUsers",
    "parameters": [
     {
      "name": "filter",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "startIndex",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "format": "int32",
       "default": 1
      }
     },
     {
      "name": "count",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "format": "int32",
       "default": 100
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/scim+json": {
        "schema": {
         "$ref": "#/components/schemas/ScimListResponseScimUserResource"
        }
       }
      }
     }
    },
    "summary": "List users",
    "security": [
     {
      "scimToken": []
     }
    ],
    "description": "Authenticated with a SCIM token created for the tenant, not with a user access token.",
    "x-service": "Identity"
   },
   "post": {
    "tags": [
     "SCIM 2.0"
    ],
    "operationId": "createUser",
    "requestBody": {
     "content": {
      "application/scim+json": {
       "schema": {
        "$ref": "#/components/schemas/ScimUserResource"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/scim+json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    },
    "summary": "Create user",
    "security": [
     {
      "scimToken": []
     }
    ],
    "description": "Authenticated with a SCIM token created for the tenant, not with a user access token.",
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/{userId}/unlock": {
   "post": {
    "tags": [
     "User Management"
    ],
    "summary": "Unlock user",
    "description": "Unlocks a locked user account and clears login attempt counters\n\n**Roles allowed:** ADMIN",
    "operationId": "unlockUser",
    "parameters": [
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/StatusResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN"
    ],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/{userId}/tenants/{tenantId}/roles": {
   "get": {
    "tags": [
     "User Management"
    ],
    "summary": "Get user roles in tenant",
    "description": "Retrieves roles for a user within a specific tenant\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "getUserRolesInTenant",
    "parameters": [
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/UserRolesResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Identity"
   },
   "post": {
    "tags": [
     "User Management"
    ],
    "summary": "Assign role",
    "description": "Assigns a role to a user within a tenant\n\n**Roles allowed:** ADMIN",
    "operationId": "assignRole",
    "parameters": [
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AssignRoleRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/StatusResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN"
    ],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/{userId}/status": {
   "post": {
    "tags": [
     "User Management"
    ],
    "summary": "Update user status",
    "description": "Changes the lifecycle status of a user\n\n**Roles allowed:** ADMIN",
    "operationId": "updateUserStatus",
    "parameters": [
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/UpdateUserStatusRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/StatusResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN"
    ],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/{userId}/mfa/verify": {
   "post": {
    "tags": [
     "User Management"
    ],
    "summary": "Complete MFA setup",
    "description": "Completes MFA setup by verifying a TOTP code. Self only.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "completeMfa",
    "parameters": [
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/MfaSetupVerifyRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/MfaStateResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/{userId}/mfa/reset": {
   "post": {
    "tags": [
     "User Management"
    ],
    "summary": "Admin MFA reset",
    "description": "Admin-initiated MFA reset for locked-out users. Disables MFA so the user can re-enable it.\n\n**Roles allowed:** ADMIN",
    "operationId": "adminResetMfa",
    "parameters": [
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/MfaStateResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN"
    ],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/{userId}/mfa/initiate": {
   "post": {
    "tags": [
     "User Management"
    ],
    "summary": "Initiate MFA setup",
    "description": "Begins the TOTP MFA setup process. Self only — the setup secret/QR must never be visible to anyone but the account owner.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "initiateMfa",
    "parameters": [
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/MfaInitiateResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/{userId}/mfa/backup-codes": {
   "post": {
    "tags": [
     "User Management"
    ],
    "summary": "Regenerate backup codes",
    "description": "Admin-initiated backup-code regeneration for MFA recovery, e.g. when a user has lost their device. Previous codes are invalidated. Admin only.\n\n**Roles allowed:** ADMIN",
    "operationId": "regenerateBackupCodes",
    "parameters": [
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/MfaStateResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN"
    ],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/{userId}/erasure-confirm": {
   "post": {
    "tags": [
     "GDPR"
    ],
    "summary": "Confirm data erasure",
    "description": "Finalizes GDPR erasure — permanently anonymizes the user's PII. Requires the token issued during erasure request creation.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "confirmErasure",
    "parameters": [
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "token",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK"
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/me/mfa/verify-setup": {
   "post": {
    "tags": [
     "My Profile"
    ],
    "summary": "Complete MFA setup",
    "description": "Verifies TOTP code to complete enrollment; returns one-time backup codes\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "verifyMfaSetup",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/MfaSetupVerifyRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/MfaStateResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/me/mfa/initiate": {
   "post": {
    "tags": [
     "My Profile"
    ],
    "summary": "Initiate MFA setup",
    "description": "Starts the two-step MFA enrollment; returns QR code URI and setup reference\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "initiateMfa_1",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/MfaInitiateResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/me/mfa/disable": {
   "post": {
    "tags": [
     "My Profile"
    ],
    "summary": "Disable MFA",
    "description": "Disables MFA after verifying the current TOTP code\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "disableMfa",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/DisableMfaRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/MfaStateResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/me/mfa/backup-codes": {
   "post": {
    "tags": [
     "My Profile"
    ],
    "summary": "Regenerate backup codes",
    "description": "Verifies the current TOTP code, then generates a new set of backup codes; old codes are invalidated\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "regenerateBackupCodes_1",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/RegenerateBackupCodesRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "type": "string"
         }
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/me/erasure-request": {
   "post": {
    "tags": [
     "GDPR"
    ],
    "summary": "Request data erasure",
    "description": "GDPR Right to Erasure — creates a pending erasure request for the authenticated user. The returned token must be passed to the confirm endpoint to finalize.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "requestErasure",
    "parameters": [],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErasureRequestResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/me/change-password": {
   "post": {
    "tags": [
     "My Profile"
    ],
    "summary": "Change my password",
    "description": "Changes the authenticated user's password after verifying the current one\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "changePassword",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ChangePasswordRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK"
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/public/phone/send-otp": {
   "post": {
    "tags": [
     "Public Phone Verification"
    ],
    "summary": "Send an SMS OTP to a phone number",
    "operationId": "sendOtp",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SendPhoneOtpRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/SendPhoneOtpResponse"
        }
       }
      }
     }
    },
    "security": [],
    "description": "No token needed.",
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/public/onboarding/verify-email": {
   "post": {
    "tags": [
     "Public Onboarding"
    ],
    "summary": "Step 2a — Verify email via OTP code",
    "operationId": "verifyEmail",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/OnboardingVerifyEmailRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/OnboardingVerifyEmailResponse"
        }
       }
      }
     }
    },
    "security": [],
    "description": "No token needed.",
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/public/onboarding/signup": {
   "post": {
    "tags": [
     "Public Onboarding"
    ],
    "summary": "Step 1 — Sign up with email and password",
    "operationId": "signup",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/OnboardingSignupRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/OnboardingSignupResponse"
        }
       }
      }
     }
    },
    "security": [],
    "description": "No token needed.",
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/public/onboarding/select-plan": {
   "post": {
    "tags": [
     "Public Onboarding"
    ],
    "summary": "Step 4 — Select a subscription plan",
    "operationId": "selectPlan",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/OnboardingSelectPlanRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/OnboardingSelectPlanResponse"
        }
       }
      }
     }
    },
    "security": [],
    "description": "No token needed.",
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/public/onboarding/resend-otp": {
   "post": {
    "tags": [
     "Public Onboarding"
    ],
    "summary": "Step 2b — Resend OTP code",
    "operationId": "resendOtp",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/OnboardingResendOtpRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK"
     }
    },
    "security": [],
    "description": "No token needed.",
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/public/onboarding/create-tenant": {
   "post": {
    "tags": [
     "Public Onboarding"
    ],
    "summary": "Step 3 — Create tenant organization",
    "operationId": "createTenant",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/OnboardingCreateTenantRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/OnboardingCreateTenantResponse"
        }
       }
      }
     }
    },
    "security": [],
    "description": "No token needed.",
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/public/onboarding/complete": {
   "post": {
    "tags": [
     "Public Onboarding"
    ],
    "summary": "Step 5 — Complete onboarding, receive JWT tokens",
    "operationId": "complete",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/OnboardingCompleteRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/OnboardingCompleteResponse"
        }
       }
      }
     }
    },
    "security": [],
    "description": "No token needed.",
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/public/invite/accept": {
   "post": {
    "tags": [
     "Public Invite"
    ],
    "summary": "Accept invite — set password and join tenant",
    "operationId": "accept",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AcceptInviteRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/AcceptInviteResponse"
        }
       }
      }
     }
    },
    "security": [],
    "description": "No token needed.",
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/onboarding/checklist/{step}/skip": {
   "post": {
    "tags": [
     "Onboarding checklist"
    ],
    "operationId": "skip",
    "parameters": [
     {
      "name": "step",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "enum": [
        "CREATE_API_KEY",
        "SEND_FIRST_EVENT",
        "CONFIGURE_WEBHOOK",
        "INVITE_TEAM",
        "SELECT_PLAN"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/Item"
        }
       }
      }
     }
    },
    "summary": "Skip",
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Identity"
   }
  },
  "/api/v1/onboarding/checklist/{step}/complete": {
   "post": {
    "tags": [
     "Onboarding checklist"
    ],
    "operationId": "complete_1",
    "parameters": [
     {
      "name": "step",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "enum": [
        "CREATE_API_KEY",
        "SEND_FIRST_EVENT",
        "CONFIGURE_WEBHOOK",
        "INVITE_TEAM",
        "SELECT_PLAN"
       ]
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/Item"
        }
       }
      }
     }
    },
    "summary": "Complete 1",
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Identity"
   }
  },
  "/api/v1/invites": {
   "post": {
    "tags": [
     "Invite Management"
    ],
    "summary": "Create an invite token for a new user",
    "operationId": "createInvite",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CreateInviteRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/CreateInviteResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN",
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/invites/tribe": {
   "post": {
    "tags": [
     "Invite Management"
    ],
    "summary": "Create an invite for the caller's own tenant (any member)",
    "operationId": "createTribeInvite",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CreateMemberInviteRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/CreateInviteResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/token-exchange": {
   "post": {
    "tags": [
     "Authentication"
    ],
    "summary": "Exchange token",
    "description": "Exchanges a valid token for a new token scoped to a different application (SSO)\n\nNo token needed.",
    "operationId": "exchangeToken",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/TokenExchangeRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/AuthResponse"
        }
       }
      }
     }
    },
    "security": [],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/switch-tenant": {
   "post": {
    "tags": [
     "Authentication"
    ],
    "summary": "Switch tenant",
    "description": "Re-issues a token for a different tenant the authenticated user belongs to",
    "operationId": "switchTenant",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SwitchTenantRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/AuthResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/sso/validate": {
   "post": {
    "tags": [
     "Authentication"
    ],
    "summary": "Validate SSO session",
    "description": "Checks if an SSO session is still active and returns session details\n\nNo token needed.",
    "operationId": "validateSsoSession",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SsoSessionValidateRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/SsoSessionResponse"
        }
       }
      }
     }
    },
    "security": [],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/sso/logout": {
   "post": {
    "tags": [
     "Authentication"
    ],
    "summary": "SSO logout",
    "description": "Invalidates the SSO session, preventing further token exchanges across applications\n\nNo token needed.",
    "operationId": "ssoLogout",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SsoLogoutRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK"
     }
    },
    "security": [],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/social/callback/{provider}": {
   "post": {
    "tags": [
     "Social Login"
    ],
    "summary": "Handle OAuth2 callback",
    "description": "Exchanges the OAuth2 authorization code for a platform JWT. The user is found by email or created if new. The user must be a member of the specified tenant.\n\nNo token needed.",
    "operationId": "callback",
    "parameters": [
     {
      "name": "provider",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CallbackRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/TokenIssueResponse"
        }
       }
      }
     }
    },
    "security": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/signup": {
   "post": {
    "tags": [
     "Authentication"
    ],
    "summary": "Sign up",
    "description": "Creates a new user account and initiates authenticated session\n\nNo token needed.",
    "operationId": "signUp",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SignUpRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/AuthResponse"
        }
       }
      }
     }
    },
    "security": [],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/saml/{tenantSlug}/acs": {
   "post": {
    "tags": [
     "SSO / SAML2"
    ],
    "summary": "SAML Assertion Consumer Service",
    "description": "Receives the SAML2 POST-binding response from the IdP, validates the assertion, and returns a platform JWT on success.\n\nNo token needed.",
    "operationId": "assertionConsumerService",
    "parameters": [
     {
      "name": "tenantSlug",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "SAMLResponse",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/TokenIssueResponse"
        }
       }
      }
     }
    },
    "security": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/saml/config": {
   "post": {
    "tags": [
     "SSO / SAML2"
    ],
    "summary": "Create or update SAML SSO configuration (admin)",
    "description": "Creates or replaces the SAML2 IdP configuration for the requesting tenant.\n\n**Roles allowed:** ADMIN, TENANT_ADMIN",
    "operationId": "upsertConfig",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SsoConfigRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/SsoConfig"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/refresh": {
   "post": {
    "tags": [
     "Authentication"
    ],
    "summary": "Refresh token",
    "description": "Issues new access + refresh tokens using an opaque refresh token (one-time-use rotation)\n\nNo token needed.",
    "operationId": "refresh",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/TokenRefreshRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/AuthResponse"
        }
       }
      }
     }
    },
    "security": [],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/password-reset/request": {
   "post": {
    "tags": [
     "Authentication"
    ],
    "summary": "Request password reset",
    "description": "Generates a password reset token for the given email. Always returns success to prevent email enumeration.\n\nNo token needed.",
    "operationId": "requestPasswordReset",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PasswordResetRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/StatusResponse"
        }
       }
      }
     }
    },
    "security": [],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/password-reset/confirm": {
   "post": {
    "tags": [
     "Authentication"
    ],
    "summary": "Confirm password reset",
    "description": "Validates the reset token and changes the password. All active sessions and tokens are revoked.\n\nNo token needed.",
    "operationId": "confirmPasswordReset",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PasswordResetConfirmRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/StatusResponse"
        }
       }
      }
     }
    },
    "security": [],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/oidc/{tenantSlug}/callback": {
   "post": {
    "tags": [
     "SSO / OIDC"
    ],
    "summary": "Exchange authorization code for a platform JWT",
    "description": "Validates state, exchanges code for tokens at the IdP, fetches userinfo, provisions the user (find-or-create), and returns a platform JWT.\n\nNo token needed.",
    "operationId": "callback_1",
    "parameters": [
     {
      "name": "tenantSlug",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/OidcCallbackRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/TokenIssueResponse"
        }
       }
      }
     }
    },
    "security": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/oidc/config": {
   "get": {
    "tags": [
     "SSO / OIDC"
    ],
    "summary": "Read current OIDC config for the tenant",
    "operationId": "readConfig",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/SsoConfig"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "parameters": [],
    "x-service": "Identity"
   },
   "post": {
    "tags": [
     "SSO / OIDC"
    ],
    "summary": "Create or update OIDC SSO configuration (admin)",
    "description": "Stores per-tenant OIDC client credentials and (optionally) explicit endpoints. When endpoints are omitted, the server resolves them from the issuer's OIDC discovery document at {issuer}/.well-known/openid-configuration.\n\n**Roles allowed:** ADMIN, TENANT_ADMIN",
    "operationId": "upsertConfig_1",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/OidcConfigRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/SsoConfig"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/mfa/verify": {
   "post": {
    "tags": [
     "Authentication"
    ],
    "summary": "Verify MFA",
    "description": "Completes authentication by verifying a TOTP code\n\nNo token needed.",
    "operationId": "verifyMfa_1",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/MfaVerifyRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/AuthResponse"
        }
       }
      }
     }
    },
    "security": [],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/magic-link/request": {
   "post": {
    "tags": [
     "Magic Link"
    ],
    "summary": "Request magic link",
    "description": "Sends a one-time login link to the email. Always returns 200 to prevent enumeration.\n\nNo token needed.",
    "operationId": "requestMagicLink",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/MagicLinkRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK"
     }
    },
    "security": [],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/login": {
   "post": {
    "tags": [
     "Authentication"
    ],
    "summary": "Sign in",
    "description": "Authenticates user credentials; may require MFA verification\n\nNo token needed.",
    "operationId": "signIn",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SignInRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/AuthResponse"
        }
       }
      }
     }
    },
    "security": [],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/delegations": {
   "post": {
    "tags": [
     "Permission Delegation"
    ],
    "summary": "Create delegation",
    "description": "Grants a subset of the caller's permissions to another tenant member for a fixed time window. Only permissions the grantor currently holds may be delegated.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "create_2",
    "parameters": [],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CreateDelegationRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/DelegationResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/delegations/{id}/token": {
   "post": {
    "tags": [
     "Permission Delegation"
    ],
    "summary": "Issue delegation token",
    "description": "Issues a short-lived JWT carrying only the delegated permissions. Must be called by the grantee. Token TTL is 60 minutes.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "issueToken",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/TokenIssueResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/cookie-refresh": {
   "post": {
    "tags": [
     "Authentication"
    ],
    "summary": "Cookie-based token refresh",
    "description": "Refreshes tokens using the refresh_token cookie\n\nNo token needed.",
    "operationId": "cookieRefresh",
    "parameters": [
     {
      "name": "refresh_token",
      "in": "cookie",
      "required": false,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/AuthResponse"
        }
       }
      }
     }
    },
    "security": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/cookie-mfa-verify": {
   "post": {
    "tags": [
     "Authentication"
    ],
    "summary": "Cookie-based MFA verify",
    "description": "Verifies MFA code and sets httpOnly cookies for tokens\n\nNo token needed.",
    "operationId": "cookieMfaVerify",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/MfaVerifyRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/AuthResponse"
        }
       }
      }
     }
    },
    "security": [],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/cookie-logout": {
   "post": {
    "tags": [
     "Authentication"
    ],
    "summary": "Cookie-based logout",
    "description": "Clears httpOnly auth cookies\n\nNo token needed.",
    "operationId": "cookieLogout",
    "responses": {
     "200": {
      "description": "OK"
     }
    },
    "security": [],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/cookie-login": {
   "post": {
    "tags": [
     "Authentication"
    ],
    "summary": "Cookie-based sign in",
    "description": "Authenticates user credentials and sets httpOnly cookies for tokens\n\nNo token needed.",
    "operationId": "cookieLogin",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SignInRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/AuthResponse"
        }
       }
      }
     }
    },
    "security": [],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/scim/v2/ServiceProviderConfig": {
   "get": {
    "tags": [
     "SCIM 2.0"
    ],
    "operationId": "serviceProviderConfig",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/scim+json": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    },
    "summary": "Service provider config",
    "security": [
     {
      "scimToken": []
     }
    ],
    "description": "Authenticated with a SCIM token created for the tenant, not with a user access token.",
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/{userId}/tenants": {
   "get": {
    "tags": [
     "User Management"
    ],
    "summary": "Get user tenants",
    "description": "Lists all tenants the user belongs to. Self or Admin only.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "getUserTenants",
    "parameters": [
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/UserTenantResponse"
         }
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/{userId}/roles": {
   "get": {
    "tags": [
     "User Management"
    ],
    "summary": "Get user roles",
    "description": "Retrieves all roles assigned to a user across all tenants. Self or Admin only.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "getUserRoles",
    "parameters": [
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/UserRolesResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/{userId}/mfa/status": {
   "get": {
    "tags": [
     "User Management"
    ],
    "summary": "Get MFA status",
    "description": "Retrieves the current MFA state for a user. Self or Admin only.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "getMfaStatus",
    "parameters": [
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/MfaStateResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/{userId}/mfa/backup-codes/count": {
   "get": {
    "tags": [
     "User Management"
    ],
    "summary": "Get remaining backup code count",
    "description": "Returns the number of remaining backup codes (useful for low-code warnings). Self or Admin only.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "getBackupCodeCount",
    "parameters": [
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "object",
         "additionalProperties": {
          "type": "integer",
          "format": "int32"
         }
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/me/tenants": {
   "get": {
    "tags": [
     "My Profile"
    ],
    "summary": "List my tenants",
    "description": "Returns the tenants the authenticated user is a member of, with role and default flag\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "getMyTenants",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/UserTenantResponse"
         }
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/users/me/mfa/status": {
   "get": {
    "tags": [
     "My Profile"
    ],
    "summary": "Get MFA status",
    "description": "Returns the current MFA enrollment state for the authenticated user\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "getMfaStatus_1",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/MfaStateResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/public/onboarding/state/{sessionId}": {
   "get": {
    "tags": [
     "Public Onboarding"
    ],
    "summary": "Get backend-enforced onboarding state for a session",
    "operationId": "getOnboardingState",
    "parameters": [
     {
      "name": "sessionId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/OnboardingStateResponse"
        }
       }
      }
     }
    },
    "security": [],
    "description": "No token needed.",
    "x-service": "Identity"
   }
  },
  "/api/v1/public/onboarding/check-slug": {
   "get": {
    "tags": [
     "Public Onboarding"
    ],
    "summary": "Check if a tenant slug is available",
    "operationId": "checkSlug",
    "parameters": [
     {
      "name": "slug",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/SlugCheckResponse"
        }
       }
      }
     }
    },
    "security": [],
    "description": "No token needed.",
    "x-service": "Identity"
   }
  },
  "/api/v1/public/invite/{token}": {
   "get": {
    "tags": [
     "Public Invite"
    ],
    "summary": "Get invite details by token",
    "operationId": "getDetail",
    "parameters": [
     {
      "name": "token",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/InviteDetailResponse"
        }
       }
      }
     }
    },
    "security": [],
    "description": "No token needed.",
    "x-service": "Identity"
   }
  },
  "/api/v1/onboarding/checklist": {
   "get": {
    "tags": [
     "Onboarding checklist"
    ],
    "operationId": "get_1",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/OnboardingChecklistResponse"
        }
       }
      }
     }
    },
    "summary": "Get 1",
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "parameters": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/social/authorize/{provider}": {
   "get": {
    "tags": [
     "Social Login"
    ],
    "summary": "Get authorization URL",
    "description": "Returns the OAuth2 provider authorization URL. The frontend should redirect the user's browser to this URL. Supported providers: google, github, microsoft, apple. The state parameter is a CSRF token generated and verified by the frontend.\n\nNo token needed.",
    "operationId": "authorize",
    "parameters": [
     {
      "name": "provider",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "redirectUri",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "state",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "default": ""
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "object",
         "additionalProperties": {
          "type": "string"
         }
        }
       }
      }
     }
    },
    "security": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/saml/{tenantSlug}/metadata": {
   "get": {
    "tags": [
     "SSO / SAML2"
    ],
    "summary": "SP SAML metadata",
    "description": "Returns the Service Provider SAML metadata XML for the given tenant. Register this at your IdP.\n\nNo token needed.",
    "operationId": "metadata",
    "parameters": [
     {
      "name": "tenantSlug",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "application/xml": {
        "schema": {
         "type": "string"
        }
       }
      }
     }
    },
    "security": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/saml/{tenantSlug}/initiate": {
   "get": {
    "tags": [
     "SSO / SAML2"
    ],
    "summary": "Initiate SAML SSO",
    "description": "Returns the IdP SSO URL for the given tenant. The frontend should redirect the user to this URL.\n\nNo token needed.",
    "operationId": "initiate",
    "parameters": [
     {
      "name": "tenantSlug",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/InitiateResponse"
        }
       }
      }
     }
    },
    "security": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/oidc/{tenantSlug}/initiate": {
   "get": {
    "tags": [
     "SSO / OIDC"
    ],
    "summary": "Return the IdP authorization URL for this tenant",
    "description": "Generates a single-use state, registers it, and returns the URL the browser should be redirected to. The browser hits the IdP, signs in, then bounces back to /callback.\n\nNo token needed.",
    "operationId": "initiate_1",
    "parameters": [
     {
      "name": "tenantSlug",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "object",
         "additionalProperties": {
          "type": "string"
         }
        }
       }
      }
     }
    },
    "security": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/magic-link/verify": {
   "get": {
    "tags": [
     "Magic Link"
    ],
    "summary": "Verify magic link token",
    "description": "Validates token and issues a JWT pair.\n\nNo token needed.",
    "operationId": "verifyMagicLink",
    "parameters": [
     {
      "name": "token",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/TokenIssueResponse"
        }
       }
      }
     }
    },
    "security": [],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/login-events/user/{userId}": {
   "get": {
    "tags": [
     "Login Events"
    ],
    "summary": "Login events by user",
    "description": "Returns recent login events for a specific user. Most recent first.\n\n**Roles allowed:** ADMIN, TENANT_ADMIN",
    "operationId": "byUser",
    "parameters": [
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "format": "int32",
       "default": 50
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/LoginEvent"
         }
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/login-events/tenant/{tenantId}": {
   "get": {
    "tags": [
     "Login Events"
    ],
    "summary": "Login events by tenant",
    "description": "Returns recent login events for a tenant (admin/SA only). Most recent first.\n\n**Roles allowed:** ADMIN, TENANT_ADMIN",
    "operationId": "byTenant",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "limit",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "format": "int32",
       "default": 100
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/LoginEvent"
         }
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/delegations/received": {
   "get": {
    "tags": [
     "Permission Delegation"
    ],
    "summary": "List delegations received by me",
    "operationId": "listReceived",
    "parameters": [],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/DelegationResponse"
         }
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/delegations/granted": {
   "get": {
    "tags": [
     "Permission Delegation"
    ],
    "summary": "List delegations granted by me",
    "operationId": "listGranted",
    "parameters": [],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/DelegationResponse"
         }
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Identity"
   }
  },
  "/api/v1/auth/delegations/{id}": {
   "delete": {
    "tags": [
     "Permission Delegation"
    ],
    "summary": "Revoke delegation",
    "description": "Revokes an active delegation. Only the original grantor may revoke.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "revoke_2",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/DelegationResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Identity"
   }
  },
  "/api/v1/tenants/{tenantId}": {
   "get": {
    "tags": [
     "Tenant Management"
    ],
    "summary": "Get tenant",
    "operationId": "getTenant",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/TenantResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Tenants"
   },
   "put": {
    "tags": [
     "Tenant Management"
    ],
    "summary": "Update tenant",
    "operationId": "updateTenant",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CreateTenantRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/TenantResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "x-service": "Tenants"
   },
   "delete": {
    "tags": [
     "Tenant Management"
    ],
    "operationId": "deleteTenant",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/StatusResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "summary": "Delete tenant",
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "x-service": "Tenants"
   }
  },
  "/api/v1/tenants/{tenantId}/users/{userId}": {
   "put": {
    "tags": [
     "Tenant Management"
    ],
    "operationId": "updateMembership",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/UpdateMembershipRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/MembershipResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "summary": "Update membership",
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "x-service": "Tenants"
   },
   "delete": {
    "tags": [
     "Tenant Management"
    ],
    "operationId": "removeMembership",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/StatusResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "summary": "Remove membership",
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "x-service": "Tenants"
   }
  },
  "/api/v1/tenants/{tenantId}/policy": {
   "get": {
    "tags": [
     "Tenant Management"
    ],
    "operationId": "getTenantPolicy",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/TenantPolicyResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "summary": "Get tenant policy",
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Tenants"
   },
   "put": {
    "tags": [
     "Tenant Management"
    ],
    "operationId": "updateTenantPolicy",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/UpdateTenantPolicyRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/TenantPolicyResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "summary": "Update tenant policy",
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "x-service": "Tenants"
   }
  },
  "/api/v1/tenants/{tenantId}/branding": {
   "get": {
    "tags": [
     "Tenant Management"
    ],
    "summary": "Get tenant branding",
    "operationId": "getBranding",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/BrandingResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "description": "",
    "x-service": "Tenants"
   },
   "put": {
    "tags": [
     "Tenant Management"
    ],
    "summary": "Update tenant branding (TENANT_ADMIN+)",
    "operationId": "updateBranding",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/BrandingRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/BrandingResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "x-service": "Tenants"
   }
  },
  "/api/v1/tenants/{tenantId}/applications/{applicationId}/permissions": {
   "put": {
    "tags": [
     "Application Management"
    ],
    "summary": "Update application permissions",
    "operationId": "updateApplicationPermissions",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "applicationId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "array",
        "items": {
         "type": "string"
        },
        "uniqueItems": true
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ApplicationResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN",
    "x-service": "Tenants"
   }
  },
  "/api/v1/developer/webhooks/{webhookId}": {
   "put": {
    "tags": [
     "Developer Portal"
    ],
    "summary": "Update a webhook endpoint",
    "operationId": "updateWebhook",
    "parameters": [
     {
      "name": "webhookId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/UpdateWebhookRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/WebhookResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "x-service": "Tenants"
   },
   "delete": {
    "tags": [
     "Developer Portal"
    ],
    "summary": "Delete a webhook endpoint",
    "operationId": "deleteWebhook",
    "parameters": [
     {
      "name": "webhookId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK"
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "x-service": "Tenants"
   }
  },
  "/api/v1/tenants": {
   "post": {
    "tags": [
     "Tenant Management"
    ],
    "summary": "Create tenant",
    "operationId": "createTenant_tenant",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CreateTenantRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/TenantResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "parameters": [],
    "x-service": "Tenants"
   }
  },
  "/api/v1/tenants/{tenantId}/users": {
   "get": {
    "tags": [
     "Tenant Management"
    ],
    "operationId": "getTenantMembers",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/MembershipResponse"
         }
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "summary": "Get tenant members",
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Tenants"
   },
   "post": {
    "tags": [
     "Tenant Management"
    ],
    "operationId": "addUserToTenant",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/AddUserToTenantRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/MembershipResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "summary": "Add user to tenant",
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "x-service": "Tenants"
   }
  },
  "/api/v1/tenants/{tenantId}/users/{userId}/activate": {
   "post": {
    "tags": [
     "Tenant Management"
    ],
    "operationId": "activateMembership",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/StatusResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "summary": "Activate membership",
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "x-service": "Tenants"
   }
  },
  "/api/v1/tenants/{tenantId}/suspend": {
   "post": {
    "tags": [
     "Tenant Management"
    ],
    "operationId": "suspendTenant",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/StatusResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "summary": "Suspend tenant",
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "x-service": "Tenants"
   }
  },
  "/api/v1/tenants/{tenantId}/invite": {
   "post": {
    "tags": [
     "Tenant Management"
    ],
    "operationId": "inviteUser",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/InviteUserRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/MembershipResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "summary": "Invite user",
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "x-service": "Tenants"
   }
  },
  "/api/v1/tenants/{tenantId}/branding/validate-cname": {
   "post": {
    "tags": [
     "Tenant Management"
    ],
    "summary": "Validate the tenant's custom domain (CNAME/A record DNS check)",
    "operationId": "validateCustomDomain",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ValidationResult"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "x-service": "Tenants"
   }
  },
  "/api/v1/tenants/{tenantId}/applications": {
   "get": {
    "tags": [
     "Application Management"
    ],
    "summary": "List applications",
    "operationId": "getApplications",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/ApplicationResponse"
         }
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN",
    "x-service": "Tenants"
   },
   "post": {
    "tags": [
     "Application Management"
    ],
    "summary": "Create application",
    "operationId": "createApplication",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CreateApplicationRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ApplicationCreatedResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN",
    "x-service": "Tenants"
   }
  },
  "/api/v1/tenants/sub-tenants": {
   "get": {
    "tags": [
     "Tenant Management"
    ],
    "summary": "List the calling reseller tenant's sub-tenants",
    "operationId": "listSubTenants",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/TenantResponse"
         }
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN",
     "ADMIN"
    ],
    "description": "**Roles allowed:** TENANT_ADMIN, ADMIN",
    "parameters": [],
    "x-service": "Tenants"
   },
   "post": {
    "tags": [
     "Tenant Management"
    ],
    "summary": "Onboard a sub-tenant under the calling reseller tenant",
    "operationId": "createSubTenant",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CreateTenantWithAdminRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/TenantResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN",
     "ADMIN"
    ],
    "description": "**Roles allowed:** TENANT_ADMIN, ADMIN",
    "parameters": [],
    "x-service": "Tenants"
   }
  },
  "/api/v1/tenants/sub-tenants/{subTenantId}/suspend": {
   "post": {
    "tags": [
     "Tenant Management"
    ],
    "summary": "Suspend one of the calling reseller's sub-tenants",
    "operationId": "suspendSubTenant",
    "parameters": [
     {
      "name": "subTenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/StatusResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN",
     "ADMIN"
    ],
    "description": "**Roles allowed:** TENANT_ADMIN, ADMIN",
    "x-service": "Tenants"
   }
  },
  "/api/v1/tenants/sub-tenants/{subTenantId}/reinstate": {
   "post": {
    "tags": [
     "Tenant Management"
    ],
    "summary": "Reinstate one of the calling reseller's sub-tenants",
    "operationId": "reinstateSubTenant",
    "parameters": [
     {
      "name": "subTenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/StatusResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN",
     "ADMIN"
    ],
    "description": "**Roles allowed:** TENANT_ADMIN, ADMIN",
    "x-service": "Tenants"
   }
  },
  "/api/v1/tenants/onboard": {
   "post": {
    "tags": [
     "Tenant Management"
    ],
    "summary": "Onboard tenant with admin",
    "operationId": "createTenantWithAdmin",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CreateTenantWithAdminRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/TenantResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "parameters": [],
    "x-service": "Tenants"
   }
  },
  "/api/v1/developer/webhooks": {
   "get": {
    "tags": [
     "Developer Portal"
    ],
    "summary": "List webhooks for the current tenant",
    "operationId": "listWebhooks",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/WebhookResponse"
         }
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "parameters": [],
    "x-service": "Tenants"
   },
   "post": {
    "tags": [
     "Developer Portal"
    ],
    "summary": "Create a webhook endpoint",
    "operationId": "createWebhook",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CreateWebhookRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/WebhookResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "parameters": [],
    "x-service": "Tenants"
   }
  },
  "/api/v1/developer/api-keys": {
   "get": {
    "tags": [
     "Developer Portal"
    ],
    "summary": "List API keys for the current tenant",
    "operationId": "listApiKeys",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/ApiKeyResponse"
         }
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "parameters": [],
    "x-service": "Tenants"
   },
   "post": {
    "tags": [
     "Developer Portal"
    ],
    "summary": "Create a new API key",
    "operationId": "createApiKey",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CreateApiKeyRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/CreateApiKeyResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "parameters": [],
    "x-service": "Tenants"
   }
  },
  "/api/v1/developer/api-keys/{keyId}/revoke": {
   "post": {
    "tags": [
     "Developer Portal"
    ],
    "summary": "Revoke an API key",
    "operationId": "revokeApiKey",
    "parameters": [
     {
      "name": "keyId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK"
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "x-service": "Tenants"
   }
  },
  "/api/v1/tenants/{tenantId}/export": {
   "get": {
    "tags": [
     "Tenant Export"
    ],
    "summary": "Export tenant data as a downloadable file (JSON; CSV coming in a later iteration)",
    "operationId": "exportTenant",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "format",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "default": "json"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "object"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN, TENANT_ADMIN",
    "x-service": "Tenants"
   }
  },
  "/api/v1/tenants/{tenantId}/applications/{applicationId}": {
   "get": {
    "tags": [
     "Application Management"
    ],
    "summary": "Get application",
    "operationId": "getApplication",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "applicationId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ApplicationResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN",
    "x-service": "Tenants"
   },
   "delete": {
    "tags": [
     "Application Management"
    ],
    "summary": "Delete application",
    "operationId": "deleteApplication",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "applicationId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/StatusResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN",
    "x-service": "Tenants"
   }
  },
  "/api/v1/tenants/by-slug/{slug}/branding": {
   "get": {
    "tags": [
     "Tenant Management"
    ],
    "summary": "Get tenant branding by slug (public — used by Login page for tenant sub-domain)",
    "operationId": "getBrandingBySlug",
    "parameters": [
     {
      "name": "slug",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/BrandingResponse"
        }
       }
      }
     }
    },
    "security": [],
    "description": "No token needed.",
    "x-service": "Tenants"
   }
  },
  "/api/v1/tenants/by-domain/{domain}/branding": {
   "get": {
    "tags": [
     "Tenant Management"
    ],
    "summary": "Get tenant branding by custom domain (public — used by Host header resolution)",
    "operationId": "getBrandingByDomain",
    "parameters": [
     {
      "name": "domain",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/BrandingResponse"
        }
       }
      }
     }
    },
    "security": [],
    "description": "No token needed.",
    "x-service": "Tenants"
   }
  },
  "/api/v1/permissions/roles/{role}": {
   "get": {
    "tags": [
     "Permission Management"
    ],
    "summary": "Get role permissions",
    "operationId": "getRolePermissions",
    "parameters": [
     {
      "name": "role",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "object",
         "additionalProperties": {
          "type": "object"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN",
    "x-service": "Authorization"
   },
   "put": {
    "tags": [
     "Permission Management"
    ],
    "summary": "Set role permissions",
    "operationId": "setRolePermissions",
    "parameters": [
     {
      "name": "role",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "array",
        "items": {
         "type": "string",
         "format": "uuid"
        }
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "object",
         "additionalProperties": {
          "type": "string"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN",
    "x-service": "Authorization"
   }
  },
  "/api/v1/authorization/tenants/{tenantId}/policies/{ruleId}": {
   "put": {
    "tags": [
     "ABAC Policy Management"
    ],
    "summary": "Update policy rule",
    "operationId": "updatePolicy",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "ruleId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PolicyRule"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/PolicyRule"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN",
    "x-service": "Authorization"
   },
   "delete": {
    "tags": [
     "ABAC Policy Management"
    ],
    "summary": "Delete policy rule",
    "operationId": "deletePolicy",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "ruleId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "object",
         "additionalProperties": {
          "type": "string"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN",
    "x-service": "Authorization"
   }
  },
  "/api/v1/permissions": {
   "get": {
    "tags": [
     "Permission Management"
    ],
    "summary": "List all permissions",
    "operationId": "getAllPermissions",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/PermissionEntity"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN",
    "parameters": [],
    "x-service": "Authorization"
   },
   "post": {
    "tags": [
     "Permission Management"
    ],
    "summary": "Create permission",
    "operationId": "createPermission",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": {
         "type": "string"
        }
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/PermissionEntity"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN\n\n*The fields of the request body are not described in this reference yet; they are shared during onboarding.*",
    "parameters": [],
    "x-service": "Authorization"
   }
  },
  "/api/v1/authorization/tenants/{tenantId}/policies": {
   "get": {
    "tags": [
     "ABAC Policy Management"
    ],
    "summary": "List policy rules",
    "operationId": "listPolicies",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/PolicyRule"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN",
    "x-service": "Authorization"
   },
   "post": {
    "tags": [
     "ABAC Policy Management"
    ],
    "summary": "Create policy rule",
    "operationId": "createPolicy",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PolicyRule"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/PolicyRule"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN",
    "x-service": "Authorization"
   }
  },
  "/api/v1/authorization/tenants/{tenantId}/policies/evaluate": {
   "post": {
    "tags": [
     "ABAC Policy Management"
    ],
    "summary": "Evaluate policy (test)",
    "operationId": "evaluatePolicy",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/PolicyEvaluationRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/PolicyDecision"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN",
    "x-service": "Authorization"
   }
  },
  "/api/v1/authorization/check": {
   "post": {
    "tags": [
     "Authorization"
    ],
    "summary": "Check access",
    "description": "Evaluates whether a user has access",
    "operationId": "checkAccess",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CheckAccessRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/AccessDecision"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "parameters": [],
    "x-service": "Authorization"
   }
  },
  "/api/v1/permissions/{permissionId}": {
   "delete": {
    "tags": [
     "Permission Management"
    ],
    "summary": "Delete permission",
    "operationId": "deletePermission",
    "parameters": [
     {
      "name": "permissionId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK"
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "ADMIN"
    ],
    "description": "**Roles allowed:** ADMIN",
    "x-service": "Authorization"
   }
  },
  "/api/v1/tokens/validate": {
   "post": {
    "tags": [
     "Token Management"
    ],
    "summary": "Validate token",
    "description": "Validates token signature, expiry, and revocation status, returns identity claims\n\nNo token needed.",
    "operationId": "validateToken",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "string"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/TokenValidationResponse"
        }
       }
      }
     }
    },
    "security": [],
    "parameters": [],
    "x-service": "Tokens"
   }
  },
  "/api/v1/tokens/revoke": {
   "post": {
    "tags": [
     "Token Management"
    ],
    "summary": "Revoke token",
    "description": "Blacklists a token so it can no longer be used",
    "operationId": "revokeToken",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "string"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "object",
         "additionalProperties": {
          "type": "string"
         }
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "parameters": [],
    "x-service": "Tokens"
   }
  },
  "/api/v1/tokens/introspect": {
   "post": {
    "tags": [
     "Token Management"
    ],
    "summary": "Introspect token (RFC 7662)",
    "description": "Returns detailed token validity and claims. Checks signature, expiry, and all revocation levels.",
    "operationId": "introspectToken",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "string"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/TokenIntrospectionResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "parameters": [],
    "x-service": "Tokens"
   }
  },
  "/api/v1/events/workflow-rules/{id}": {
   "get": {
    "tags": [
     "Workflow Rules"
    ],
    "summary": "Fetch a single rule by id",
    "operationId": "get_event",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/WorkflowRule"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** TENANT_ADMIN",
    "x-service": "Events"
   },
   "put": {
    "tags": [
     "Workflow Rules"
    ],
    "summary": "Update a workflow rule",
    "operationId": "update",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/WorkflowRule"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/WorkflowRule"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** TENANT_ADMIN",
    "x-service": "Events"
   },
   "delete": {
    "tags": [
     "Workflow Rules"
    ],
    "summary": "Delete a workflow rule",
    "operationId": "delete",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK"
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** TENANT_ADMIN",
    "x-service": "Events"
   }
  },
  "/api/v1/events/workflow-rules": {
   "post": {
    "tags": [
     "Workflow Rules"
    ],
    "summary": "Create a new workflow rule",
    "operationId": "create",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/WorkflowRule"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/WorkflowRule"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** TENANT_ADMIN",
    "parameters": [],
    "x-service": "Events"
   }
  },
  "/api/v1/events": {
   "get": {
    "tags": [
     "Event Management"
    ],
    "summary": "List all events",
    "description": "Returns paginated list of all events\n\n**Roles allowed:** PLATFORM_SUPPORT",
    "operationId": "getAllEvents",
    "parameters": [
     {
      "name": "pageable",
      "in": "query",
      "required": true,
      "schema": {
       "$ref": "#/components/schemas/Pageable"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/PageEventResponse"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "PLATFORM_SUPPORT"
    ],
    "x-service": "Events"
   }
  },
  "/api/v1/events/workflow-rules/tenant/{tenantId}": {
   "get": {
    "tags": [
     "Workflow Rules"
    ],
    "summary": "List rules bound to a specific tenant",
    "operationId": "listForTenant",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/WorkflowRule"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** TENANT_ADMIN",
    "x-service": "Events"
   }
  },
  "/api/v1/events/user/{userId}": {
   "get": {
    "tags": [
     "Event Management"
    ],
    "summary": "Get events by user",
    "description": "Filter events by user ID for audit trail\n\n**Roles allowed:** PLATFORM_SUPPORT",
    "operationId": "getByUserId",
    "parameters": [
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "pageable",
      "in": "query",
      "required": true,
      "schema": {
       "$ref": "#/components/schemas/Pageable"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/PageEventResponse"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "PLATFORM_SUPPORT"
    ],
    "x-service": "Events"
   }
  },
  "/api/v1/events/type/{eventType}": {
   "get": {
    "tags": [
     "Event Management"
    ],
    "summary": "Get events by type",
    "description": "Filter events by type (e.g. USER_REGISTERED)\n\n**Roles allowed:** PLATFORM_SUPPORT",
    "operationId": "getByType",
    "parameters": [
     {
      "name": "eventType",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "pageable",
      "in": "query",
      "required": true,
      "schema": {
       "$ref": "#/components/schemas/Pageable"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/PageEventResponse"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "PLATFORM_SUPPORT"
    ],
    "x-service": "Events"
   }
  },
  "/api/v1/events/tenant/{tenantId}": {
   "get": {
    "tags": [
     "Event Management"
    ],
    "summary": "Get events by tenant",
    "description": "Filter events by tenant ID for audit trail\n\n**Roles allowed:** PLATFORM_SUPPORT",
    "operationId": "getByTenantId_1",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "pageable",
      "in": "query",
      "required": true,
      "schema": {
       "$ref": "#/components/schemas/Pageable"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/PageEventResponse"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "PLATFORM_SUPPORT"
    ],
    "x-service": "Events"
   }
  },
  "/api/v1/events/source/{source}": {
   "get": {
    "tags": [
     "Event Management"
    ],
    "summary": "Get events by source",
    "description": "Filter events by source service\n\n**Roles allowed:** PLATFORM_SUPPORT",
    "operationId": "getBySource",
    "parameters": [
     {
      "name": "source",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "pageable",
      "in": "query",
      "required": true,
      "schema": {
       "$ref": "#/components/schemas/Pageable"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/PageEventResponse"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "PLATFORM_SUPPORT"
    ],
    "x-service": "Events"
   }
  },
  "/api/v1/events/search": {
   "get": {
    "tags": [
     "Event Management"
    ],
    "summary": "Search events",
    "description": "Search events with optional filters: eventType, userId, tenantId, time range\n\n**Roles allowed:** PLATFORM_SUPPORT",
    "operationId": "searchEvents",
    "parameters": [
     {
      "name": "userId",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "tenantId",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "eventType",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "from",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "format": "date-time"
      }
     },
     {
      "name": "to",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "format": "date-time"
      }
     },
     {
      "name": "pageable",
      "in": "query",
      "required": true,
      "schema": {
       "$ref": "#/components/schemas/Pageable"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/PageEventResponse"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "PLATFORM_SUPPORT"
    ],
    "x-service": "Events"
   }
  },
  "/api/v1/events/aggregate/{aggregateId}": {
   "get": {
    "tags": [
     "Event Management"
    ],
    "summary": "Get events by aggregate",
    "description": "Filter events by aggregate ID (e.g. userId)\n\n**Roles allowed:** PLATFORM_SUPPORT",
    "operationId": "getByAggregateId",
    "parameters": [
     {
      "name": "aggregateId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "pageable",
      "in": "query",
      "required": true,
      "schema": {
       "$ref": "#/components/schemas/Pageable"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/PageEventResponse"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "PLATFORM_SUPPORT"
    ],
    "x-service": "Events"
   }
  },
  "/api/v1/notifications/sender/{tenantId}": {
   "get": {
    "tags": [
     "Notification Sender Settings"
    ],
    "summary": "Get sender config for tenant",
    "operationId": "get_notification",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/NotificationSenderConfig"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** TENANT_ADMIN",
    "x-service": "Notifications"
   },
   "put": {
    "tags": [
     "Notification Sender Settings"
    ],
    "summary": "Save or update sender config for tenant",
    "operationId": "upsert",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/NotificationSenderConfig"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/NotificationSenderConfig"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** TENANT_ADMIN",
    "x-service": "Notifications"
   },
   "delete": {
    "tags": [
     "Notification Sender Settings"
    ],
    "summary": "Disable sender config for tenant (reverts to platform default)",
    "operationId": "disable",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK"
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** TENANT_ADMIN",
    "x-service": "Notifications"
   }
  },
  "/api/v1/notifications/preferences/{tenantId}/{userId}": {
   "get": {
    "tags": [
     "Notifications"
    ],
    "summary": "Get notification preferences for a user",
    "description": "Path tenantId must match the caller's JWT-derived tenant — mismatches return 404.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "getPreferences",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/NotificationPreference"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Notifications"
   },
   "put": {
    "tags": [
     "Notifications"
    ],
    "summary": "Set a notification preference (opt in or out of a channel/eventType)",
    "description": "Path tenantId must match the caller's JWT-derived tenant — mismatches return 404.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN\n\n*The fields of the request body are not described in this reference yet; they are shared during onboarding.*",
    "operationId": "setPreference",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": {
         "type": "object"
        }
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/NotificationPreference"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Notifications"
   }
  },
  "/api/v1/notifications/preferences/me": {
   "get": {
    "tags": [
     "Notifications"
    ],
    "summary": "Get the calling user's notification preferences",
    "description": "Derives tenant + user from the gateway-injected context — no path IDs needed. Convenience for mobile/web clients that hold a session but not their tenant UUID.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "getMyPreferences",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/NotificationPreference"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "parameters": [],
    "x-service": "Notifications"
   },
   "put": {
    "tags": [
     "Notifications"
    ],
    "summary": "Set one of the calling user's notification preferences (opt in/out of a channel/eventType)",
    "description": "Derives tenant + user from the gateway-injected context — no path IDs needed.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN\n\n*The fields of the request body are not described in this reference yet; they are shared during onboarding.*",
    "operationId": "setMyPreference",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": {
         "type": "object"
        }
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/NotificationPreference"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "parameters": [],
    "x-service": "Notifications"
   }
  },
  "/api/v1/notifications": {
   "get": {
    "tags": [
     "Notifications"
    ],
    "summary": "Get notifications for the current user",
    "operationId": "getMine",
    "parameters": [
     {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "pageable",
      "in": "query",
      "required": true,
      "schema": {
       "$ref": "#/components/schemas/Pageable"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/NotificationPageResponse"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Notifications"
   },
   "post": {
    "tags": [
     "Notifications"
    ],
    "summary": "Send a notification (supports scheduledAt and batchKey)",
    "description": "tenantId in the body is ignored — the caller's JWT-derived tenant is authoritative. userId is required.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN\n\n*The fields of the request body are not described in this reference yet; they are shared during onboarding.*",
    "operationId": "send",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": {
         "type": "object"
        }
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/Notification"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "parameters": [],
    "x-service": "Notifications"
   }
  },
  "/api/v1/notifications/{notificationId}/read": {
   "post": {
    "tags": [
     "Notifications"
    ],
    "summary": "Mark one current-user notification as read",
    "operationId": "markMineRead",
    "parameters": [
     {
      "name": "notificationId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/Notification"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Notifications"
   }
  },
  "/api/v1/notifications/{notificationId}/archive": {
   "post": {
    "tags": [
     "Notifications"
    ],
    "summary": "Archive one current-user notification",
    "operationId": "archiveMine",
    "parameters": [
     {
      "name": "notificationId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/Notification"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Notifications"
   }
  },
  "/api/v1/notifications/user/{userId}/mark-read": {
   "post": {
    "tags": [
     "Notifications"
    ],
    "summary": "Mark all notifications as read",
    "operationId": "markAllRead",
    "parameters": [
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "object",
         "additionalProperties": {
          "type": "integer",
          "format": "int32"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Notifications"
   }
  },
  "/api/v1/notifications/read-all": {
   "post": {
    "tags": [
     "Notifications"
    ],
    "summary": "Mark all current-user notifications as read",
    "operationId": "markMyFeedRead",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "object",
         "additionalProperties": {
          "type": "integer",
          "format": "int32"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "parameters": [],
    "x-service": "Notifications"
   }
  },
  "/api/v1/notifications/device-tokens": {
   "get": {
    "tags": [
     "Notifications"
    ],
    "summary": "List device tokens for the current user",
    "operationId": "listDeviceTokens",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/DeviceToken"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "parameters": [],
    "x-service": "Notifications"
   },
   "post": {
    "tags": [
     "Notifications"
    ],
    "summary": "Register a device token for push notifications",
    "operationId": "registerDeviceToken",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": {
         "type": "string"
        }
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/DeviceToken"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN\n\n*The fields of the request body are not described in this reference yet; they are shared during onboarding.*",
    "parameters": [],
    "x-service": "Notifications"
   }
  },
  "/api/v1/notifications/{notificationId}": {
   "get": {
    "tags": [
     "Notifications"
    ],
    "summary": "Get one notification for the current user",
    "operationId": "getMineById",
    "parameters": [
     {
      "name": "notificationId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/Notification"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Notifications"
   }
  },
  "/api/v1/notifications/user/{userId}": {
   "get": {
    "tags": [
     "Notifications"
    ],
    "summary": "Get notifications for user",
    "operationId": "getForUser",
    "parameters": [
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "pageable",
      "in": "query",
      "required": true,
      "schema": {
       "$ref": "#/components/schemas/Pageable"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/PageNotification"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Notifications"
   }
  },
  "/api/v1/notifications/user/{userId}/unread-count": {
   "get": {
    "tags": [
     "Notifications"
    ],
    "summary": "Count unread notifications",
    "operationId": "countUnread",
    "parameters": [
     {
      "name": "userId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "object",
         "additionalProperties": {
          "type": "integer",
          "format": "int64"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Notifications"
   }
  },
  "/api/v1/notifications/device-tokens/{id}": {
   "delete": {
    "tags": [
     "Notifications"
    ],
    "summary": "Unregister a device token by id",
    "operationId": "unregisterDeviceToken",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK"
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Notifications"
   }
  },
  "/api/v1/notifications/device-tokens/user": {
   "delete": {
    "tags": [
     "Notifications"
    ],
    "summary": "Remove all device tokens for the current user (account deletion)",
    "operationId": "deleteDeviceTokensForUser",
    "responses": {
     "200": {
      "description": "OK"
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "parameters": [],
    "x-service": "Notifications"
   }
  },
  "/api/v1/notifications/device-tokens/token/{token}": {
   "delete": {
    "tags": [
     "Notifications"
    ],
    "summary": "Unregister a device token by FCM token value (Android client convenience)",
    "operationId": "unregisterDeviceTokenByValue",
    "parameters": [
     {
      "name": "token",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK"
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Notifications"
   }
  },
  "/api/v1/chat/messages/{messageId}/read": {
   "post": {
    "tags": [
     "Chat"
    ],
    "summary": "Mark message as read (caller must be a participant)",
    "description": "Idempotent — re-marking the same message for the same user has no effect. Always recorded for the caller; a userId naming anyone else is refused with 403.\n\n**Permission required:** CHAT_WRITE",
    "operationId": "markRead",
    "parameters": [
     {
      "name": "messageId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "userId",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/MessageReadReceipt"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "CHAT_WRITE"
    ],
    "x-service": "Chat"
   }
  },
  "/api/v1/chat/messages/{messageId}/reactions": {
   "get": {
    "tags": [
     "Chat"
    ],
    "summary": "List reactions on a message (participants and staff)",
    "operationId": "getReactions",
    "parameters": [
     {
      "name": "messageId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/MessageReaction"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "CHAT_READ"
    ],
    "description": "**Permission required:** CHAT_READ",
    "x-service": "Chat"
   },
   "post": {
    "tags": [
     "Chat"
    ],
    "summary": "Add reaction (caller must be a participant)",
    "description": "Idempotent — adding the same emoji twice returns the existing reaction. Always recorded for the caller; a userId naming anyone else is refused with 403.\n\n**Permission required:** CHAT_WRITE\n\n*The fields of the request body are not described in this reference yet; they are shared during onboarding.*",
    "operationId": "addReaction",
    "parameters": [
     {
      "name": "messageId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": {
         "type": "string"
        }
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/MessageReaction"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "CHAT_WRITE"
    ],
    "x-service": "Chat"
   },
   "delete": {
    "tags": [
     "Chat"
    ],
    "summary": "Remove reaction (moderation; caller must own message's tenant)",
    "operationId": "removeReaction",
    "parameters": [
     {
      "name": "messageId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "userId",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "emoji",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK"
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "CHAT_ADMIN"
    ],
    "description": "**Permission required:** CHAT_ADMIN",
    "x-service": "Chat"
   }
  },
  "/api/v1/chat/channels": {
   "post": {
    "tags": [
     "Chat"
    ],
    "summary": "Create channel",
    "description": "tenantId in the body is ignored: the tenant always comes from the caller’s access token. The channel is open to every member of the tenant.\n\n**Permission required:** CHAT_WRITE\n\n*The fields of the request body are not described in this reference yet; they are shared during onboarding.*",
    "operationId": "createChannel_1",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": {
         "type": "string"
        }
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ChatChannel"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "CHAT_WRITE"
    ],
    "parameters": [],
    "x-service": "Chat"
   }
  },
  "/api/v1/chat/channels/{channelId}/read": {
   "post": {
    "tags": [
     "Chat"
    ],
    "summary": "Mark all messages in a channel as read for the current user (caller must be a participant)",
    "operationId": "markChannelRead",
    "parameters": [
     {
      "name": "channelId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK"
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "CHAT_WRITE"
    ],
    "description": "**Permission required:** CHAT_WRITE",
    "x-service": "Chat"
   }
  },
  "/api/v1/chat/channels/{channelId}/messages": {
   "get": {
    "tags": [
     "Chat"
    ],
    "summary": "Get messages in channel (participants and staff)",
    "operationId": "getMessages",
    "parameters": [
     {
      "name": "channelId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "pageable",
      "in": "query",
      "required": true,
      "schema": {
       "$ref": "#/components/schemas/Pageable"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/PageChatMessage"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "CHAT_READ"
    ],
    "description": "**Permission required:** CHAT_READ",
    "x-service": "Chat"
   },
   "post": {
    "tags": [
     "Chat"
    ],
    "summary": "Send message (caller must be a participant of the channel)",
    "description": "Always sent as the authenticated caller. A senderId in the body is ignored, and a SYSTEM messageType is stored as TEXT.\n\n**Permission required:** CHAT_WRITE\n\n*The fields of the request body are not described in this reference yet; they are shared during onboarding.*",
    "operationId": "sendMessage",
    "parameters": [
     {
      "name": "channelId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": {
         "type": "string"
        }
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ChatMessage"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "CHAT_WRITE"
    ],
    "x-service": "Chat"
   }
  },
  "/api/v1/chat/unread": {
   "get": {
    "tags": [
     "Chat"
    ],
    "summary": "Get per-channel unread message counts for the current user",
    "description": "Covers the channels the caller is shown as a participant: open channels and the private ones they are on.\n\n**Permission required:** CHAT_READ",
    "operationId": "getUnreadCounts",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/UnreadCountDto"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "CHAT_READ"
    ],
    "parameters": [],
    "x-service": "Chat"
   }
  },
  "/api/v1/chat/messages/{parentMessageId}/thread": {
   "get": {
    "tags": [
     "Chat"
    ],
    "summary": "List thread replies (participants and staff)",
    "description": "Returns all non-deleted replies to the given parent message, oldest-first.\n\n**Permission required:** CHAT_READ",
    "operationId": "getThread",
    "parameters": [
     {
      "name": "parentMessageId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/ChatMessage"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "CHAT_READ"
    ],
    "x-service": "Chat"
   }
  },
  "/api/v1/chat/messages/{messageId}/read-receipts": {
   "get": {
    "tags": [
     "Chat"
    ],
    "summary": "List users who have read a message (participants and staff)",
    "operationId": "getReadReceipts",
    "parameters": [
     {
      "name": "messageId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/MessageReadReceipt"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "CHAT_READ"
    ],
    "description": "**Permission required:** CHAT_READ",
    "x-service": "Chat"
   }
  },
  "/api/v1/chat/channels/{channelId}/messages/search": {
   "get": {
    "tags": [
     "Chat"
    ],
    "summary": "Search messages (participants and staff)",
    "description": "Full-text search over non-deleted messages using PostgreSQL tsvector\n\n**Permission required:** CHAT_READ",
    "operationId": "searchMessages",
    "parameters": [
     {
      "name": "channelId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "q",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/ChatMessage"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "CHAT_READ"
    ],
    "x-service": "Chat"
   }
  },
  "/api/v1/chat/channels/{channelId}/members": {
   "get": {
    "tags": [
     "Chat"
    ],
    "summary": "List members of a channel (participants and staff)",
    "description": "The recorded participants of a private channel; for an open channel, its distinct message senders.\n\n**Permission required:** CHAT_READ",
    "operationId": "getChannelMembers",
    "parameters": [
     {
      "name": "channelId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/ChatRoomMemberDto"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "CHAT_READ"
    ],
    "x-service": "Chat"
   }
  },
  "/api/v1/chat/channels/tenant/{tenantId}": {
   "get": {
    "tags": [
     "Chat"
    ],
    "summary": "List the channels the caller can see in their tenant",
    "description": "Path tenantId must match the caller's JWT-derived tenant; mismatches return 404. Open channels plus the private channels the caller is on; staff (CHAT_ADMIN) see every channel.\n\n**Permission required:** CHAT_READ",
    "operationId": "getChannels",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/ChatChannel"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "CHAT_READ"
    ],
    "x-service": "Chat"
   }
  },
  "/api/v1/chat/messages/{messageId}": {
   "delete": {
    "tags": [
     "Chat"
    ],
    "summary": "Soft-delete message (caller must own its tenant)",
    "operationId": "deleteMessage",
    "parameters": [
     {
      "name": "messageId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK"
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "CHAT_ADMIN"
    ],
    "description": "**Permission required:** CHAT_ADMIN",
    "x-service": "Chat"
   }
  },
  "/api/v1/chat/channels/{channelId}": {
   "delete": {
    "tags": [
     "Chat"
    ],
    "summary": "Archive channel (caller must own its tenant)",
    "operationId": "archiveChannel",
    "parameters": [
     {
      "name": "channelId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ChatChannel"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "CHAT_ADMIN"
    ],
    "description": "**Permission required:** CHAT_ADMIN",
    "x-service": "Chat"
   }
  },
  "/api/v1/wallets": {
   "post": {
    "tags": [
     "Wallet"
    ],
    "summary": "Get or create wallet",
    "description": "Body tenantId / userId are IGNORED — the caller's JWT-derived tenant and user are always used. Body need only carry the optional currency.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN\n\n*The fields of the request body are not described in this reference yet; they are shared during onboarding.*",
    "operationId": "getOrCreate",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": {
         "type": "string"
        }
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/Wallet"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "parameters": [],
    "x-service": "Wallet"
   }
  },
  "/api/v1/wallets/{walletId}/unfreeze": {
   "post": {
    "tags": [
     "Wallet"
    ],
    "summary": "Unfreeze wallet (only the wallet owner)",
    "operationId": "unfreeze",
    "parameters": [
     {
      "name": "walletId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/Wallet"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Wallet"
   }
  },
  "/api/v1/wallets/{walletId}/holds": {
   "get": {
    "tags": [
     "Wallet Holds"
    ],
    "summary": "List holds on a wallet (the wallet's owner, or tenant staff)",
    "operationId": "list",
    "parameters": [
     {
      "name": "walletId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/WalletHold"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Wallet"
   },
   "post": {
    "tags": [
     "Wallet Holds"
    ],
    "summary": "Authorize an escrow hold (only the wallet owner)",
    "description": "Earmarks funds without moving them: the wallet's available balance drops by the hold amount while the stored balance is unchanged. Idempotent via Idempotency-Key header.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN\n\n*The fields of the request body are not described in this reference yet; they are shared during onboarding.*",
    "operationId": "authorize_wallet",
    "parameters": [
     {
      "name": "walletId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "Idempotency-Key",
      "in": "header",
      "description": "Client-supplied idempotency key",
      "required": false,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": {
         "type": "object"
        }
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/WalletHold"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Wallet"
   }
  },
  "/api/v1/wallets/{walletId}/freeze": {
   "post": {
    "tags": [
     "Wallet"
    ],
    "summary": "Freeze wallet (only the wallet owner)",
    "operationId": "freeze",
    "parameters": [
     {
      "name": "walletId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/Wallet"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Wallet"
   }
  },
  "/api/v1/wallets/{walletId}/debit": {
   "post": {
    "tags": [
     "Wallet"
    ],
    "summary": "Debit wallet (idempotent via Idempotency-Key header)",
    "description": "Only the wallet owner may debit.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN\n\n*The fields of the request body are not described in this reference yet; they are shared during onboarding.*",
    "operationId": "debit",
    "parameters": [
     {
      "name": "walletId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "Idempotency-Key",
      "in": "header",
      "description": "Client-supplied idempotency key",
      "required": false,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": {
         "type": "object"
        }
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/WalletTransaction"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Wallet"
   }
  },
  "/api/v1/wallets/transfer": {
   "post": {
    "tags": [
     "Wallet"
    ],
    "summary": "Transfer between wallets (caller must own source)",
    "description": "Atomically debits the source wallet and credits the destination. Idempotent via Idempotency-Key header.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN\n\n*The fields of the request body are not described in this reference yet; they are shared during onboarding.*",
    "operationId": "transfer",
    "parameters": [
     {
      "name": "Idempotency-Key",
      "in": "header",
      "required": false,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": {
         "type": "object"
        }
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "object",
         "additionalProperties": {
          "type": "object"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Wallet"
   }
  },
  "/api/v1/wallets/holds/{holdId}/release": {
   "post": {
    "tags": [
     "Wallet Holds"
    ],
    "summary": "Release a hold, fully or partially (tenant member)",
    "description": "Returns held funds to the available balance. Omit amount for a full release (terminal); a partial amount keeps the hold AUTHORIZED with a smaller outstanding. Idempotent via Idempotency-Key header.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN\n\n*The fields of the request body are not described in this reference yet; they are shared during onboarding.*",
    "operationId": "release",
    "parameters": [
     {
      "name": "holdId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "Idempotency-Key",
      "in": "header",
      "description": "Client-supplied idempotency key",
      "required": false,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": {
         "type": "object"
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/WalletHold"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Wallet"
   }
  },
  "/api/v1/wallets/holds/{holdId}/capture": {
   "post": {
    "tags": [
     "Wallet Holds"
    ],
    "summary": "Capture a hold with splits (tenant member)",
    "description": "Atomically debits the held wallet and credits each split destination. Split amounts must sum exactly to the capture amount; any un-captured remainder of the hold is auto-released. One-shot — replays via Idempotency-Key return the original outcome.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN\n\n*The fields of the request body are not described in this reference yet; they are shared during onboarding.*",
    "operationId": "capture",
    "parameters": [
     {
      "name": "holdId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "Idempotency-Key",
      "in": "header",
      "description": "Client-supplied idempotency key (required)",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": {
         "type": "object"
        }
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "object",
         "additionalProperties": {
          "type": "object"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Wallet"
   }
  },
  "/api/v1/wallets/{walletId}/limits": {
   "patch": {
    "tags": [
     "Wallet"
    ],
    "summary": "Set spending limits (only the wallet owner)",
    "description": "Sets per-transaction, daily (24h rolling), and monthly (30d rolling) debit limits. Pass null to remove a limit.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN\n\n*The fields of the request body are not described in this reference yet; they are shared during onboarding.*",
    "operationId": "setLimits",
    "parameters": [
     {
      "name": "walletId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": {
         "type": "object"
        }
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/Wallet"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Wallet"
   }
  },
  "/api/v1/wallets/{walletId}": {
   "get": {
    "tags": [
     "Wallet"
    ],
    "summary": "Get wallet by ID (caller must own its tenant)",
    "operationId": "get_wallet",
    "parameters": [
     {
      "name": "walletId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/Wallet"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Wallet"
   }
  },
  "/api/v1/wallets/{walletId}/velocity": {
   "get": {
    "tags": [
     "Wallet"
    ],
    "summary": "Get velocity report (caller must own its tenant)",
    "description": "Returns configured limits and rolling spend totals for the last 24h and 30 days.\n\n**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "operationId": "getVelocity",
    "parameters": [
     {
      "name": "walletId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "object",
         "additionalProperties": {
          "type": "object"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "x-service": "Wallet"
   }
  },
  "/api/v1/wallets/{walletId}/transactions": {
   "get": {
    "tags": [
     "Wallet"
    ],
    "summary": "List wallet transactions (caller must own its tenant)",
    "operationId": "getTransactions",
    "parameters": [
     {
      "name": "walletId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "pageable",
      "in": "query",
      "required": true,
      "schema": {
       "$ref": "#/components/schemas/Pageable"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/PageWalletTransaction"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Wallet"
   }
  },
  "/api/v1/wallets/{walletId}/balance": {
   "get": {
    "tags": [
     "Wallet"
    ],
    "summary": "Get wallet balance incl. held/available split (caller must own its tenant)",
    "operationId": "balance",
    "parameters": [
     {
      "name": "walletId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "object",
         "additionalProperties": {
          "type": "object"
         }
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Wallet"
   }
  },
  "/api/v1/wallets/holds/{holdId}": {
   "get": {
    "tags": [
     "Wallet Holds"
    ],
    "summary": "Get a hold by id (the wallet's owner, or tenant staff)",
    "operationId": "get_1_wallet",
    "parameters": [
     {
      "name": "holdId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/WalletHold"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Wallet"
   }
  },
  "/api/v1/queue/{taskId}/fail": {
   "post": {
    "tags": [
     "Queue"
    ],
    "summary": "Mark task failed (caller must own its tenant)",
    "operationId": "fail",
    "parameters": [
     {
      "name": "taskId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": {
         "type": "string"
        }
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/QueueTask"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "QUEUE_ADMIN"
    ],
    "description": "**Permission required:** QUEUE_ADMIN\n\n*The fields of the request body are not described in this reference yet; they are shared during onboarding.*",
    "x-service": "Queue"
   }
  },
  "/api/v1/queue/{taskId}/complete": {
   "post": {
    "tags": [
     "Queue"
    ],
    "summary": "Mark task completed (caller must own its tenant)",
    "operationId": "complete_queue",
    "parameters": [
     {
      "name": "taskId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/QueueTask"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "QUEUE_WRITE"
    ],
    "description": "**Permission required:** QUEUE_WRITE",
    "x-service": "Queue"
   }
  },
  "/api/v1/queue/{taskId}/cancel": {
   "post": {
    "tags": [
     "Queue"
    ],
    "summary": "Cancel task (caller must own its tenant)",
    "operationId": "cancel",
    "parameters": [
     {
      "name": "taskId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/QueueTask"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "QUEUE_ADMIN"
    ],
    "description": "**Permission required:** QUEUE_ADMIN",
    "x-service": "Queue"
   }
  },
  "/api/v1/queue/enqueue": {
   "post": {
    "tags": [
     "Queue"
    ],
    "summary": "Enqueue task",
    "description": "tenantId in the body is ignored — the caller's JWT-derived tenant is authoritative.\n\n**Permission required:** QUEUE_WRITE\n\n*The fields of the request body are not described in this reference yet; they are shared during onboarding.*",
    "operationId": "enqueue",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": {
         "type": "object"
        }
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/QueueTask"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "QUEUE_WRITE"
    ],
    "parameters": [],
    "x-service": "Queue"
   }
  },
  "/api/v1/queue/dead-letter/{taskId}/retry": {
   "post": {
    "tags": [
     "Queue"
    ],
    "summary": "Re-queue dead-letter task (caller must own its tenant)",
    "description": "Resets a DEAD_LETTER task to PENDING with a fresh retry budget.\n\n**Permission required:** QUEUE_ADMIN",
    "operationId": "retryDeadLetter",
    "parameters": [
     {
      "name": "taskId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/QueueTask"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "QUEUE_ADMIN"
    ],
    "x-service": "Queue"
   }
  },
  "/api/v1/queue/tenant/{tenantId}": {
   "get": {
    "tags": [
     "Queue"
    ],
    "summary": "List tasks for the caller's tenant",
    "description": "Path tenantId must match the caller's JWT-derived tenant; mismatches return 404. Default status filter is PENDING — pass ?status=COMPLETED/FAILED/CANCELLED/DEAD_LETTER for other states.\n\n**Permission required:** QUEUE_ADMIN",
    "operationId": "list_queue",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "status",
      "in": "query",
      "required": false,
      "schema": {
       "type": "string",
       "default": "PENDING"
      }
     },
     {
      "name": "pageable",
      "in": "query",
      "required": true,
      "schema": {
       "$ref": "#/components/schemas/Pageable"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/PageQueueTask"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "QUEUE_ADMIN"
    ],
    "x-service": "Queue"
   }
  },
  "/api/v1/queue/tenant/{tenantId}/dlq": {
   "get": {
    "tags": [
     "Queue"
    ],
    "summary": "List dead-letter tasks for the caller's tenant",
    "description": "Returns all tasks that exhausted their retry budget. Path tenantId must match caller.\n\n**Permission required:** QUEUE_ADMIN",
    "operationId": "listDeadLetter",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "pageable",
      "in": "query",
      "required": true,
      "schema": {
       "$ref": "#/components/schemas/Pageable"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/PageQueueTask"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "403": {
      "description": "Forbidden",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "404": {
      "description": "Not Found",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "409": {
      "description": "Conflict",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     },
     "500": {
      "description": "Internal Server Error",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/ErrorResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-permissions": [
     "QUEUE_ADMIN"
    ],
    "x-service": "Queue"
   }
  },
  "/api/v2/platform/workflow-templates/{id}": {
   "get": {
    "tags": [
     "Workflow templates"
    ],
    "summary": "Get workflow template",
    "operationId": "get_orchestrator",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/TemplateResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN",
     "ADMIN"
    ],
    "description": "**Roles allowed:** TENANT_ADMIN, ADMIN",
    "x-service": "Workflows"
   },
   "put": {
    "tags": [
     "Workflow templates"
    ],
    "summary": "Update workflow template",
    "description": "Replaces the template definition. Increments version. Only DRAFT templates may be edited; PUBLISHED templates must be archived first.\n\n**Roles allowed:** TENANT_ADMIN, ADMIN",
    "operationId": "update_orchestrator",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/UpdateTemplateRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/TemplateResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN",
     "ADMIN"
    ],
    "x-service": "Workflows"
   },
   "delete": {
    "tags": [
     "Workflow templates"
    ],
    "summary": "Delete template",
    "description": "Deletes a DRAFT template. Published or archived templates cannot be deleted.\n\n**Roles allowed:** TENANT_ADMIN, ADMIN",
    "operationId": "delete_orchestrator",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK"
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN",
     "ADMIN"
    ],
    "x-service": "Workflows"
   }
  },
  "/api/v2/platform/workflow-templates": {
   "get": {
    "tags": [
     "Workflow templates"
    ],
    "summary": "List workflow templates",
    "description": "Lists all templates for the tenant, newest first.\n\n**Roles allowed:** TENANT_ADMIN, ADMIN",
    "operationId": "list_orchestrator",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/TemplateResponse"
         }
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN",
     "ADMIN"
    ],
    "parameters": [],
    "x-service": "Workflows"
   },
   "post": {
    "tags": [
     "Workflow templates"
    ],
    "summary": "Create workflow template",
    "description": "Persists a visual workflow graph definition (React Flow JSON) as a new template.\n\n**Roles allowed:** TENANT_ADMIN, ADMIN",
    "operationId": "create_orchestrator",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/CreateTemplateRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/TemplateResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN",
     "ADMIN"
    ],
    "parameters": [],
    "x-service": "Workflows"
   }
  },
  "/api/v2/platform/workflow-templates/{id}/publish": {
   "post": {
    "tags": [
     "Workflow templates"
    ],
    "summary": "Publish template",
    "description": "Marks a DRAFT template as PUBLISHED, enabling execution.\n\n**Roles allowed:** TENANT_ADMIN, ADMIN",
    "operationId": "publish",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/TemplateResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN",
     "ADMIN"
    ],
    "x-service": "Workflows"
   }
  },
  "/api/v2/platform/workflow-templates/{id}/archive": {
   "post": {
    "tags": [
     "Workflow templates"
    ],
    "summary": "Archive template",
    "description": "Marks a template as ARCHIVED — no longer editable or executable.\n\n**Roles allowed:** TENANT_ADMIN, ADMIN",
    "operationId": "archive",
    "parameters": [
     {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/TemplateResponse"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN",
     "ADMIN"
    ],
    "x-service": "Workflows"
   }
  },
  "/api/v2/platform/webhooks": {
   "get": {
    "tags": [
     "Webhooks"
    ],
    "summary": "List webhooks",
    "description": "List all webhook registrations for the current tenant.\n\n**Roles allowed:** TENANT_ADMIN, ADMIN",
    "operationId": "list_1",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/WebhookRegistration"
         }
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN",
     "ADMIN"
    ],
    "parameters": [],
    "x-service": "Workflows"
   },
   "post": {
    "tags": [
     "Webhooks"
    ],
    "summary": "Register webhook",
    "description": "Register a URL to receive platform events. Returns the webhook secret for signature verification.\n\n**Roles allowed:** TENANT_ADMIN, ADMIN",
    "operationId": "register",
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/WebhookRequest"
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/WebhookRegistration"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN",
     "ADMIN"
    ],
    "parameters": [],
    "x-service": "Workflows"
   }
  },
  "/api/v2/platform/webhooks/replay": {
   "post": {
    "tags": [
     "Webhooks"
    ],
    "summary": "Replay dead-letter events",
    "description": "Replay all failed webhook deliveries from the dead-letter queue.\n\n**Roles allowed:** TENANT_ADMIN, ADMIN",
    "operationId": "replayDeadLetters",
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "object",
         "additionalProperties": {
          "type": "object"
         }
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN",
     "ADMIN"
    ],
    "parameters": [],
    "x-service": "Workflows"
   }
  },
  "/api/v1/plugins": {
   "get": {
    "tags": [
     "Plugin Marketplace"
    ],
    "summary": "List marketplace plugins",
    "operationId": "listMarketplace",
    "parameters": [
     {
      "name": "pageable",
      "in": "query",
      "required": true,
      "schema": {
       "$ref": "#/components/schemas/Pageable"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/PagePlugin"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Workflows"
   }
  },
  "/api/v1/plugins/{pluginId}/invoke": {
   "post": {
    "tags": [
     "Plugin Marketplace"
    ],
    "summary": "Manually invoke a plugin with a payload",
    "operationId": "invoke",
    "parameters": [
     {
      "name": "pluginId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "tenantId",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "additionalProperties": {
         "type": "object"
        }
       }
      }
     },
     "required": true
    },
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "object",
         "additionalProperties": {
          "type": "object"
         }
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** TENANT_ADMIN\n\n*The fields of the request body are not described in this reference yet; they are shared during onboarding.*",
    "x-service": "Workflows"
   }
  },
  "/api/v1/plugins/{pluginId}/install": {
   "post": {
    "tags": [
     "Plugin Marketplace"
    ],
    "summary": "Install plugin for a tenant",
    "operationId": "install",
    "parameters": [
     {
      "name": "pluginId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     },
     {
      "name": "tenantId",
      "in": "query",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/Plugin"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** TENANT_ADMIN",
    "x-service": "Workflows"
   }
  },
  "/api/v2/platform/webhooks/{registrationId}/deliveries": {
   "get": {
    "tags": [
     "Webhooks"
    ],
    "summary": "Get delivery logs",
    "description": "Get paginated delivery logs for a webhook registration.\n\n**Roles allowed:** TENANT_ADMIN, ADMIN",
    "operationId": "getDeliveryLogs",
    "parameters": [
     {
      "name": "registrationId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     },
     {
      "name": "page",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "format": "int32",
       "default": 0
      }
     },
     {
      "name": "size",
      "in": "query",
      "required": false,
      "schema": {
       "type": "integer",
       "format": "int32",
       "default": 20
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "$ref": "#/components/schemas/PagedResponseWebhookDeliveryLogEntity"
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN",
     "ADMIN"
    ],
    "x-service": "Workflows"
   }
  },
  "/api/v1/plugins/tenant/{tenantId}": {
   "get": {
    "tags": [
     "Plugin Marketplace"
    ],
    "summary": "List installed plugins for a tenant",
    "operationId": "listForTenant_orchestrator",
    "parameters": [
     {
      "name": "tenantId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "content": {
       "*/*": {
        "schema": {
         "type": "array",
         "items": {
          "$ref": "#/components/schemas/Plugin"
         }
        }
       }
      }
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "USER",
     "ADMIN",
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** USER, ADMIN, TENANT_ADMIN",
    "x-service": "Workflows"
   }
  },
  "/api/v2/platform/webhooks/{registrationId}": {
   "delete": {
    "tags": [
     "Webhooks"
    ],
    "summary": "Delete webhook",
    "description": "Remove a webhook registration.\n\n**Roles allowed:** TENANT_ADMIN, ADMIN",
    "operationId": "delete_1",
    "parameters": [
     {
      "name": "registrationId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK"
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN",
     "ADMIN"
    ],
    "x-service": "Workflows"
   }
  },
  "/api/v1/plugins/{installedPluginId}/uninstall": {
   "delete": {
    "tags": [
     "Plugin Marketplace"
    ],
    "summary": "Uninstall plugin for a tenant",
    "operationId": "uninstall",
    "parameters": [
     {
      "name": "installedPluginId",
      "in": "path",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uuid"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK"
     }
    },
    "security": [
     {
      "bearerAuth": []
     }
    ],
    "x-required-roles": [
     "TENANT_ADMIN"
    ],
    "description": "**Roles allowed:** TENANT_ADMIN",
    "x-service": "Workflows"
   }
  }
 },
 "components": {
  "securitySchemes": {
   "bearerAuth": {
    "type": "http",
    "scheme": "bearer",
    "bearerFormat": "JWT",
    "description": "An access token from the Identity → Authentication operations. The tenant is taken from the token."
   },
   "scimToken": {
    "type": "http",
    "scheme": "bearer",
    "description": "A SCIM token created for the tenant. It is not a user access token."
   }
  },
  "schemas": {
   "ScimUserResource": {
    "type": "object",
    "properties": {
     "schemas": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "id": {
      "type": "string"
     },
     "externalId": {
      "type": "string"
     },
     "userName": {
      "type": "string"
     },
     "name": {
      "$ref": "#/components/schemas/Name"
     },
     "emails": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Email"
      }
     },
     "active": {
      "type": "boolean"
     },
     "meta": {
      "$ref": "#/components/schemas/Meta"
     }
    }
   },
   "Name": {
    "type": "object",
    "properties": {
     "givenName": {
      "type": "string"
     },
     "familyName": {
      "type": "string"
     },
     "formatted": {
      "type": "string"
     }
    }
   },
   "Email": {
    "type": "object",
    "properties": {
     "value": {
      "type": "string"
     },
     "type": {
      "type": "string"
     },
     "primary": {
      "type": "boolean"
     }
    }
   },
   "Meta": {
    "type": "object",
    "properties": {
     "resourceType": {
      "type": "string"
     },
     "created": {
      "type": "string"
     },
     "lastModified": {
      "type": "string"
     },
     "location": {
      "type": "string"
     },
     "version": {
      "type": "string"
     }
    }
   },
   "UserResponse": {
    "type": "object",
    "properties": {
     "userId": {
      "type": "string",
      "format": "uuid"
     },
     "email": {
      "type": "string"
     },
     "displayName": {
      "type": "string"
     },
     "status": {
      "type": "string",
      "enum": [
       "ACTIVE",
       "DISABLED",
       "LOCKED",
       "DELETED",
       "FORCE_SETUP",
       "PENDING_SETUP"
      ]
     },
     "tenantIds": {
      "type": "array",
      "items": {
       "type": "string",
       "format": "uuid"
      }
     },
     "mfaState": {
      "type": "string",
      "enum": [
       "DISABLED",
       "PENDING_SETUP",
       "ENABLED"
      ]
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "UpdateUserRequest": {
    "type": "object",
    "properties": {
     "email": {
      "type": "string"
     }
    }
   },
   "StatusResponse": {
    "type": "object",
    "properties": {
     "status": {
      "type": "string"
     }
    }
   },
   "UserProfileResponse": {
    "type": "object",
    "properties": {
     "userId": {
      "type": "string",
      "format": "uuid"
     },
     "email": {
      "type": "string"
     },
     "displayName": {
      "type": "string"
     },
     "phoneNumber": {
      "type": "string"
     },
     "profileImageUrl": {
      "type": "string"
     },
     "timeZone": {
      "type": "string"
     },
     "mfaState": {
      "type": "string",
      "enum": [
       "DISABLED",
       "PENDING_SETUP",
       "ENABLED"
      ]
     },
     "mfaEnabled": {
      "type": "boolean"
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "UpdateProfileRequest": {
    "type": "object",
    "properties": {
     "displayName": {
      "type": "string",
      "maxLength": 255,
      "minLength": 0
     },
     "phoneNumber": {
      "type": "string",
      "maxLength": 50,
      "minLength": 0
     },
     "profileImageUrl": {
      "type": "string",
      "maxLength": 500,
      "minLength": 0
     },
     "timeZone": {
      "type": "string",
      "maxLength": 64,
      "minLength": 0
     }
    }
   },
   "SelfRegistrationSetting": {
    "type": "object",
    "properties": {
     "enabled": {
      "type": "boolean"
     }
    }
   },
   "ScimListResponseScimUserResource": {
    "type": "object",
    "properties": {
     "schemas": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "totalResults": {
      "type": "integer",
      "format": "int32"
     },
     "startIndex": {
      "type": "integer",
      "format": "int32"
     },
     "itemsPerPage": {
      "type": "integer",
      "format": "int32"
     },
     "Resources": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/ScimUserResource"
      }
     }
    }
   },
   "UserRolesResponse": {
    "type": "object",
    "properties": {
     "roles": {
      "type": "array",
      "items": {
       "type": "string"
      }
     }
    }
   },
   "AssignRoleRequest": {
    "type": "object",
    "properties": {
     "role": {
      "type": "string",
      "minLength": 1
     },
     "expiresAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "UpdateUserStatusRequest": {
    "type": "object",
    "properties": {
     "status": {
      "type": "string",
      "enum": [
       "ACTIVE",
       "DISABLED",
       "LOCKED",
       "DELETED",
       "FORCE_SETUP",
       "PENDING_SETUP"
      ]
     }
    },
    "required": [
     "status"
    ]
   },
   "MfaSetupVerifyRequest": {
    "type": "object",
    "properties": {
     "setupReference": {
      "type": "string",
      "minLength": 1
     },
     "verificationCode": {
      "type": "string",
      "minLength": 1
     }
    }
   },
   "MfaStateResponse": {
    "type": "object",
    "properties": {
     "mfaState": {
      "type": "string",
      "enum": [
       "DISABLED",
       "PENDING_SETUP",
       "ENABLED"
      ]
     },
     "backupCodes": {
      "type": "array",
      "items": {
       "type": "string"
      }
     }
    }
   },
   "MfaInitiateResponse": {
    "type": "object",
    "properties": {
     "mfaState": {
      "type": "string",
      "enum": [
       "DISABLED",
       "PENDING_SETUP",
       "ENABLED"
      ]
     },
     "setupReference": {
      "type": "string"
     },
     "qrUri": {
      "type": "string"
     }
    }
   },
   "DisableMfaRequest": {
    "type": "object",
    "properties": {
     "verificationCode": {
      "type": "string",
      "minLength": 1
     }
    }
   },
   "RegenerateBackupCodesRequest": {
    "type": "object",
    "properties": {
     "verificationCode": {
      "type": "string",
      "minLength": 1
     }
    }
   },
   "ErasureRequestResponse": {
    "type": "object",
    "properties": {
     "requestId": {
      "type": "string",
      "format": "uuid"
     },
     "token": {
      "type": "string"
     },
     "status": {
      "type": "string"
     },
     "requestedAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "ChangePasswordRequest": {
    "type": "object",
    "properties": {
     "currentPassword": {
      "type": "string",
      "minLength": 1
     },
     "newPassword": {
      "type": "string",
      "minLength": 12
     }
    }
   },
   "SendPhoneOtpRequest": {
    "type": "object",
    "properties": {
     "phone": {
      "type": "string",
      "minLength": 1,
      "pattern": "\\+?[0-9 .\\-()]{7,20}"
     }
    }
   },
   "SendPhoneOtpResponse": {
    "type": "object",
    "properties": {
     "sent": {
      "type": "boolean"
     }
    }
   },
   "OnboardingVerifyEmailRequest": {
    "type": "object",
    "properties": {
     "onboardingSessionId": {
      "type": "string",
      "minLength": 1
     },
     "otp": {
      "type": "string",
      "maxLength": 6,
      "minLength": 6
     }
    }
   },
   "OnboardingVerifyEmailResponse": {
    "type": "object",
    "properties": {
     "verified": {
      "type": "boolean"
     }
    }
   },
   "OnboardingSignupRequest": {
    "type": "object",
    "properties": {
     "email": {
      "type": "string",
      "minLength": 1
     },
     "password": {
      "type": "string",
      "minLength": 12
     }
    }
   },
   "OnboardingSignupResponse": {
    "type": "object",
    "properties": {
     "userId": {
      "type": "string",
      "format": "uuid"
     },
     "onboardingSessionId": {
      "type": "string"
     }
    }
   },
   "OnboardingSelectPlanRequest": {
    "type": "object",
    "properties": {
     "onboardingSessionId": {
      "type": "string"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "planId": {
      "type": "string",
      "format": "uuid"
     }
    },
    "required": [
     "onboardingSessionId",
     "planId",
     "tenantId"
    ]
   },
   "OnboardingSelectPlanResponse": {
    "type": "object",
    "properties": {
     "subscriptionId": {
      "type": "string",
      "format": "uuid"
     }
    }
   },
   "OnboardingResendOtpRequest": {
    "type": "object",
    "properties": {
     "onboardingSessionId": {
      "type": "string",
      "minLength": 1
     }
    }
   },
   "OnboardingCreateTenantRequest": {
    "type": "object",
    "properties": {
     "onboardingSessionId": {
      "type": "string",
      "minLength": 1
     },
     "orgName": {
      "type": "string",
      "minLength": 1
     },
     "slug": {
      "type": "string",
      "maxLength": 48,
      "minLength": 3
     },
     "region": {
      "type": "string"
     }
    }
   },
   "OnboardingCreateTenantResponse": {
    "type": "object",
    "properties": {
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "slug": {
      "type": "string"
     }
    }
   },
   "OnboardingCompleteRequest": {
    "type": "object",
    "properties": {
     "onboardingSessionId": {
      "type": "string"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     }
    },
    "required": [
     "onboardingSessionId",
     "tenantId"
    ]
   },
   "OnboardingCompleteResponse": {
    "type": "object",
    "properties": {
     "userId": {
      "type": "string",
      "format": "uuid"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "accessToken": {
      "type": "string"
     },
     "refreshToken": {
      "type": "string"
     }
    }
   },
   "AcceptInviteRequest": {
    "type": "object",
    "properties": {
     "inviteToken": {
      "type": "string",
      "minLength": 1
     },
     "password": {
      "type": "string",
      "minLength": 12
     },
     "email": {
      "type": "string"
     },
     "phone": {
      "type": "string"
     },
     "phoneOtp": {
      "type": "string"
     }
    }
   },
   "AcceptInviteResponse": {
    "type": "object",
    "properties": {
     "userId": {
      "type": "string",
      "format": "uuid"
     },
     "accessToken": {
      "type": "string"
     },
     "refreshToken": {
      "type": "string"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "mfaRequired": {
      "type": "boolean"
     },
     "transactionId": {
      "type": "string"
     },
     "metadata": {
      "type": "object",
      "additionalProperties": {
       "type": "string"
      }
     }
    }
   },
   "Item": {
    "type": "object",
    "properties": {
     "step": {
      "type": "string",
      "enum": [
       "CREATE_API_KEY",
       "SEND_FIRST_EVENT",
       "CONFIGURE_WEBHOOK",
       "INVITE_TEAM",
       "SELECT_PLAN"
      ]
     },
     "status": {
      "type": "string",
      "enum": [
       "PENDING",
       "COMPLETED",
       "SKIPPED"
      ]
     },
     "completedAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "CreateInviteRequest": {
    "type": "object",
    "properties": {
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "tenantName": {
      "type": "string",
      "minLength": 1
     },
     "email": {
      "type": "string"
     },
     "role": {
      "type": "string",
      "minLength": 1
     },
     "metadata": {
      "type": "object",
      "additionalProperties": {
       "type": "string"
      }
     }
    },
    "required": [
     "tenantId"
    ]
   },
   "CreateInviteResponse": {
    "type": "object",
    "properties": {
     "inviteToken": {
      "type": "string"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "email": {
      "type": "string"
     },
     "role": {
      "type": "string"
     },
     "expiresAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "CreateMemberInviteRequest": {
    "type": "object",
    "properties": {
     "metadata": {
      "type": "object",
      "additionalProperties": {
       "type": "string"
      }
     }
    }
   },
   "TokenExchangeRequest": {
    "type": "object",
    "properties": {
     "accessToken": {
      "type": "string",
      "minLength": 1
     },
     "targetClientId": {
      "type": "string",
      "minLength": 1
     }
    }
   },
   "AuthResponse": {
    "type": "object",
    "properties": {
     "userId": {
      "type": "string",
      "format": "uuid"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "authenticationStatus": {
      "type": "string",
      "enum": [
       "AUTHENTICATED",
       "MFA_REQUIRED",
       "REJECTED",
       "TENANT_SELECTION_REQUIRED",
       "FORCE_SETUP_REQUIRED",
       "PENDING_SETUP"
      ]
     },
     "accessToken": {
      "type": "string"
     },
     "refreshToken": {
      "type": "string"
     },
     "transactionId": {
      "type": "string"
     },
     "ssoSessionId": {
      "type": "string"
     },
     "tenants": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/UserTenantResponse"
      }
     }
    }
   },
   "UserTenantResponse": {
    "type": "object",
    "properties": {
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "tenantName": {
      "type": "string"
     },
     "tenantStatus": {
      "type": "string",
      "enum": [
       "PENDING_APPROVAL",
       "ACTIVE",
       "SUSPENDED",
       "TERMINATED",
       "DELETED"
      ]
     },
     "role": {
      "type": "string"
     },
     "defaultTenant": {
      "type": "boolean"
     }
    }
   },
   "SwitchTenantRequest": {
    "type": "object",
    "properties": {
     "tenantId": {
      "type": "string",
      "format": "uuid"
     }
    },
    "required": [
     "tenantId"
    ]
   },
   "SsoSessionValidateRequest": {
    "type": "object",
    "properties": {
     "ssoSessionId": {
      "type": "string",
      "minLength": 1
     }
    }
   },
   "SsoSessionResponse": {
    "type": "object",
    "properties": {
     "ssoSessionId": {
      "type": "string"
     },
     "userId": {
      "type": "string"
     },
     "tenantId": {
      "type": "string"
     },
     "email": {
      "type": "string"
     },
     "roles": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "createdAt": {
      "type": "string"
     },
     "lastAccessedAt": {
      "type": "string"
     },
     "expiresAt": {
      "type": "string"
     },
     "valid": {
      "type": "boolean"
     }
    }
   },
   "SsoLogoutRequest": {
    "type": "object",
    "properties": {
     "ssoSessionId": {
      "type": "string",
      "minLength": 1
     }
    }
   },
   "CallbackRequest": {
    "type": "object",
    "properties": {
     "code": {
      "type": "string"
     },
     "redirectUri": {
      "type": "string"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     }
    }
   },
   "TokenIssueResponse": {
    "type": "object",
    "properties": {
     "accessToken": {
      "type": "string"
     },
     "refreshToken": {
      "type": "string"
     },
     "tokenType": {
      "type": "string"
     },
     "expiresIn": {
      "type": "integer",
      "format": "int64"
     }
    }
   },
   "SignUpRequest": {
    "type": "object",
    "properties": {
     "email": {
      "type": "string",
      "minLength": 1
     },
     "password": {
      "type": "string",
      "minLength": 12
     },
     "tenantName": {
      "type": "string"
     },
     "clientId": {
      "type": "string"
     }
    }
   },
   "SsoConfigRequest": {
    "type": "object",
    "properties": {
     "tenantSlug": {
      "type": "string",
      "maxLength": 128,
      "minLength": 0
     },
     "idpEntityId": {
      "type": "string",
      "maxLength": 512,
      "minLength": 0
     },
     "idpSsoUrl": {
      "type": "string",
      "maxLength": 512,
      "minLength": 0
     },
     "idpCertificate": {
      "type": "string",
      "minLength": 1
     },
     "spEntityId": {
      "type": "string",
      "maxLength": 512,
      "minLength": 0
     },
     "emailAttribute": {
      "type": "string"
     }
    }
   },
   "SsoConfig": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "tenantSlug": {
      "type": "string"
     },
     "protocol": {
      "type": "string"
     },
     "idpEntityId": {
      "type": "string"
     },
     "idpSsoUrl": {
      "type": "string"
     },
     "idpCertificate": {
      "type": "string"
     },
     "spEntityId": {
      "type": "string"
     },
     "oidcIssuer": {
      "type": "string"
     },
     "oidcClientId": {
      "type": "string"
     },
     "oidcJwksUri": {
      "type": "string"
     },
     "oidcTokenEndpoint": {
      "type": "string"
     },
     "oidcAuthEndpoint": {
      "type": "string"
     },
     "oidcUserinfoEndpoint": {
      "type": "string"
     },
     "oidcScopes": {
      "type": "string"
     },
     "status": {
      "type": "string"
     },
     "emailAttribute": {
      "type": "string"
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     },
     "updatedAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "TokenRefreshRequest": {
    "type": "object",
    "properties": {
     "refreshToken": {
      "type": "string",
      "minLength": 1
     }
    }
   },
   "PasswordResetRequest": {
    "type": "object",
    "properties": {
     "email": {
      "type": "string",
      "minLength": 1
     }
    }
   },
   "PasswordResetConfirmRequest": {
    "type": "object",
    "properties": {
     "token": {
      "type": "string",
      "minLength": 1
     },
     "newPassword": {
      "type": "string",
      "minLength": 12
     }
    }
   },
   "OidcCallbackRequest": {
    "type": "object",
    "properties": {
     "code": {
      "type": "string",
      "minLength": 1
     },
     "state": {
      "type": "string",
      "minLength": 1
     }
    }
   },
   "OidcConfigRequest": {
    "type": "object",
    "properties": {
     "tenantSlug": {
      "type": "string",
      "maxLength": 128,
      "minLength": 0
     },
     "issuer": {
      "type": "string",
      "maxLength": 512,
      "minLength": 0
     },
     "clientId": {
      "type": "string",
      "maxLength": 256,
      "minLength": 0
     },
     "clientSecret": {
      "type": "string",
      "maxLength": 512,
      "minLength": 0
     },
     "jwksUri": {
      "type": "string",
      "maxLength": 512,
      "minLength": 0
     },
     "authEndpoint": {
      "type": "string",
      "maxLength": 512,
      "minLength": 0
     },
     "tokenEndpoint": {
      "type": "string",
      "maxLength": 512,
      "minLength": 0
     },
     "userinfoEndpoint": {
      "type": "string",
      "maxLength": 512,
      "minLength": 0
     },
     "scopes": {
      "type": "string",
      "maxLength": 256,
      "minLength": 0
     }
    }
   },
   "MfaVerifyRequest": {
    "type": "object",
    "properties": {
     "transactionId": {
      "type": "string",
      "minLength": 1
     },
     "verificationCode": {
      "type": "string",
      "minLength": 1
     }
    }
   },
   "MagicLinkRequest": {
    "type": "object",
    "properties": {
     "email": {
      "type": "string",
      "minLength": 1
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     }
    },
    "required": [
     "tenantId"
    ]
   },
   "SignInRequest": {
    "type": "object",
    "properties": {
     "email": {
      "type": "string",
      "minLength": 1
     },
     "password": {
      "type": "string",
      "minLength": 1
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "clientId": {
      "type": "string"
     }
    }
   },
   "CreateDelegationRequest": {
    "type": "object",
    "properties": {
     "granteeUserId": {
      "type": "string",
      "format": "uuid"
     },
     "permissions": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "expiresAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "DelegationResponse": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "grantorUserId": {
      "type": "string",
      "format": "uuid"
     },
     "granteeUserId": {
      "type": "string",
      "format": "uuid"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "permissions": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "expiresAt": {
      "type": "string",
      "format": "date-time"
     },
     "status": {
      "type": "string"
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     },
     "revokedAt": {
      "type": "string",
      "format": "date-time"
     },
     "active": {
      "type": "boolean"
     }
    }
   },
   "OnboardingStateResponse": {
    "type": "object",
    "properties": {
     "status": {
      "type": "string",
      "enum": [
       "SIGNUP",
       "VERIFIED",
       "TENANT_CREATED",
       "PLAN_SELECTED",
       "ACTIVE"
      ]
     },
     "allowedNextSteps": {
      "type": "array",
      "items": {
       "type": "string",
       "enum": [
        "SIGNUP",
        "VERIFIED",
        "TENANT_CREATED",
        "PLAN_SELECTED",
        "ACTIVE"
       ]
      }
     },
     "userId": {
      "type": "string",
      "format": "uuid"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "subscriptionId": {
      "type": "string",
      "format": "uuid"
     }
    }
   },
   "SlugCheckResponse": {
    "type": "object",
    "properties": {
     "slug": {
      "type": "string"
     },
     "available": {
      "type": "boolean"
     }
    }
   },
   "InviteDetailResponse": {
    "type": "object",
    "properties": {
     "inviteToken": {
      "type": "string"
     },
     "email": {
      "type": "string"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "tenantName": {
      "type": "string"
     },
     "role": {
      "type": "string"
     },
     "status": {
      "type": "string"
     },
     "expiresAt": {
      "type": "string",
      "format": "date-time"
     },
     "metadata": {
      "type": "object",
      "additionalProperties": {
       "type": "string"
      }
     }
    }
   },
   "OnboardingChecklistResponse": {
    "type": "object",
    "properties": {
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "totalSteps": {
      "type": "integer",
      "format": "int32"
     },
     "completedSteps": {
      "type": "integer",
      "format": "int32"
     },
     "allCompleted": {
      "type": "boolean"
     },
     "items": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Item"
      }
     }
    }
   },
   "InitiateResponse": {
    "type": "object",
    "properties": {
     "idpSsoUrl": {
      "type": "string"
     }
    }
   },
   "LoginEvent": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "userId": {
      "type": "string",
      "format": "uuid"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "email": {
      "type": "string"
     },
     "ipAddress": {
      "type": "string"
     },
     "userAgent": {
      "type": "string"
     },
     "outcome": {
      "type": "string"
     },
     "riskScore": {
      "type": "integer",
      "format": "int32"
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "TenantResponse": {
    "type": "object",
    "properties": {
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "name": {
      "type": "string"
     },
     "description": {
      "type": "string"
     },
     "status": {
      "type": "string",
      "enum": [
       "PENDING_APPROVAL",
       "ACTIVE",
       "SUSPENDED",
       "TERMINATED",
       "DELETED"
      ]
     },
     "mfaRequired": {
      "type": "boolean"
     },
     "parentTenantId": {
      "type": "string",
      "format": "uuid"
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     },
     "updatedAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "CreateTenantRequest": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string",
      "minLength": 1
     },
     "description": {
      "type": "string"
     }
    }
   },
   "UpdateMembershipRequest": {
    "type": "object",
    "properties": {
     "role": {
      "type": "string"
     },
     "status": {
      "type": "string"
     }
    }
   },
   "MembershipResponse": {
    "type": "object",
    "properties": {
     "membershipId": {
      "type": "string",
      "format": "uuid"
     },
     "userId": {
      "type": "string",
      "format": "uuid"
     },
     "email": {
      "type": "string"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "role": {
      "type": "string"
     },
     "status": {
      "type": "string",
      "enum": [
       "INVITED",
       "ACTIVE",
       "SUSPENDED"
      ]
     },
     "defaultTenant": {
      "type": "boolean"
     }
    }
   },
   "TenantPolicyResponse": {
    "type": "object",
    "properties": {
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "passwordMinLength": {
      "type": "integer",
      "format": "int32"
     },
     "passwordRequireUppercase": {
      "type": "boolean"
     },
     "passwordRequireDigit": {
      "type": "boolean"
     },
     "passwordRequireSpecialChar": {
      "type": "boolean"
     },
     "maxLoginAttempts": {
      "type": "integer",
      "format": "int32"
     },
     "lockoutDurationMinutes": {
      "type": "integer",
      "format": "int32"
     },
     "sessionTimeoutMinutes": {
      "type": "integer",
      "format": "int32"
     },
     "allowedAuthMethods": {
      "type": "string"
     },
     "mfaRequired": {
      "type": "boolean"
     }
    }
   },
   "UpdateTenantPolicyRequest": {
    "type": "object",
    "properties": {
     "passwordMinLength": {
      "type": "integer",
      "format": "int32",
      "maximum": 128,
      "minimum": 6
     },
     "passwordRequireUppercase": {
      "type": "boolean"
     },
     "passwordRequireDigit": {
      "type": "boolean"
     },
     "passwordRequireSpecialChar": {
      "type": "boolean"
     },
     "maxLoginAttempts": {
      "type": "integer",
      "format": "int32",
      "maximum": 100,
      "minimum": 0
     },
     "lockoutDurationMinutes": {
      "type": "integer",
      "format": "int32",
      "maximum": 1440,
      "minimum": 1
     },
     "sessionTimeoutMinutes": {
      "type": "integer",
      "format": "int32",
      "maximum": 10080,
      "minimum": 5
     },
     "allowedAuthMethods": {
      "type": "string"
     },
     "mfaRequired": {
      "type": "boolean"
     }
    }
   },
   "BrandingResponse": {
    "type": "object",
    "properties": {
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "tenantName": {
      "type": "string"
     },
     "slug": {
      "type": "string"
     },
     "logoUrl": {
      "type": "string"
     },
     "faviconUrl": {
      "type": "string"
     },
     "primaryColor": {
      "type": "string"
     },
     "secondaryColor": {
      "type": "string"
     },
     "accentColor": {
      "type": "string"
     },
     "brandName": {
      "type": "string"
     },
     "supportEmail": {
      "type": "string"
     },
     "customDomain": {
      "type": "string"
     }
    }
   },
   "BrandingRequest": {
    "type": "object",
    "properties": {
     "logoUrl": {
      "type": "string",
      "maxLength": 500,
      "minLength": 0
     },
     "faviconUrl": {
      "type": "string",
      "maxLength": 500,
      "minLength": 0
     },
     "primaryColor": {
      "type": "string",
      "maxLength": 9,
      "minLength": 0,
      "pattern": "^#[0-9a-fA-F]{3,8}$"
     },
     "secondaryColor": {
      "type": "string",
      "maxLength": 9,
      "minLength": 0,
      "pattern": "^#[0-9a-fA-F]{3,8}$"
     },
     "accentColor": {
      "type": "string",
      "maxLength": 9,
      "minLength": 0,
      "pattern": "^#[0-9a-fA-F]{3,8}$"
     },
     "brandName": {
      "type": "string",
      "maxLength": 120,
      "minLength": 0
     },
     "supportEmail": {
      "type": "string",
      "maxLength": 255,
      "minLength": 0
     },
     "customDomain": {
      "type": "string",
      "maxLength": 255,
      "minLength": 0
     }
    }
   },
   "ApplicationResponse": {
    "type": "object",
    "properties": {
     "applicationId": {
      "type": "string",
      "format": "uuid"
     },
     "name": {
      "type": "string"
     },
     "clientId": {
      "type": "string"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "active": {
      "type": "boolean"
     },
     "allowedPermissions": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "uniqueItems": true
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "UpdateWebhookRequest": {
    "type": "object",
    "properties": {
     "status": {
      "type": "string"
     }
    }
   },
   "WebhookResponse": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "url": {
      "type": "string"
     },
     "events": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "status": {
      "type": "string"
     },
     "createdAt": {
      "type": "string"
     }
    }
   },
   "AddUserToTenantRequest": {
    "type": "object",
    "properties": {
     "userId": {
      "type": "string",
      "format": "uuid"
     },
     "role": {
      "type": "string",
      "minLength": 1,
      "pattern": "USER|ADMIN|SUPER_ADMIN|PLATFORM_ADMIN|OPERATOR|TENANT_ADMIN|PLATFORM_SUPPORT"
     }
    },
    "required": [
     "userId"
    ]
   },
   "InviteUserRequest": {
    "type": "object",
    "properties": {
     "email": {
      "type": "string",
      "minLength": 1
     },
     "role": {
      "type": "string",
      "minLength": 1
     }
    }
   },
   "ValidationResult": {
    "type": "object",
    "properties": {
     "domain": {
      "type": "string"
     },
     "status": {
      "type": "string",
      "enum": [
       "VALID",
       "INVALID",
       "ERROR"
      ]
     },
     "detail": {
      "type": "string"
     },
     "resolvedValue": {
      "type": "string"
     },
     "checkedAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "CreateApplicationRequest": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string",
      "minLength": 1
     },
     "allowedPermissions": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "uniqueItems": true
     }
    }
   },
   "ApplicationCreatedResponse": {
    "type": "object",
    "properties": {
     "applicationId": {
      "type": "string",
      "format": "uuid"
     },
     "name": {
      "type": "string"
     },
     "clientId": {
      "type": "string"
     },
     "clientSecret": {
      "type": "string"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "active": {
      "type": "boolean"
     },
     "allowedPermissions": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "uniqueItems": true
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "CreateTenantWithAdminRequest": {
    "type": "object",
    "properties": {
     "tenantName": {
      "type": "string",
      "minLength": 1
     },
     "description": {
      "type": "string"
     },
     "adminUserId": {
      "type": "string",
      "format": "uuid"
     }
    }
   },
   "CreateWebhookRequest": {
    "type": "object",
    "properties": {
     "url": {
      "type": "string",
      "minLength": 1
     },
     "events": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "minItems": 1
     }
    }
   },
   "ApiKeyResponse": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "prefix": {
      "type": "string"
     },
     "status": {
      "type": "string"
     },
     "scopes": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "createdAt": {
      "type": "string"
     },
     "expiresAt": {
      "type": "string"
     },
     "lastUsedAt": {
      "type": "string"
     }
    }
   },
   "CreateApiKeyRequest": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string",
      "minLength": 1
     },
     "expiresAt": {
      "type": "string",
      "format": "date-time"
     },
     "scopes": {
      "type": "array",
      "items": {
       "type": "string"
      }
     }
    }
   },
   "CreateApiKeyResponse": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "name": {
      "type": "string"
     },
     "key": {
      "type": "string"
     },
     "prefix": {
      "type": "string"
     },
     "status": {
      "type": "string"
     },
     "scopes": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "createdAt": {
      "type": "string"
     },
     "expiresAt": {
      "type": "string"
     }
    }
   },
   "ErrorResponse": {
    "type": "object",
    "properties": {
     "error": {
      "type": "string"
     },
     "message": {
      "type": "string"
     },
     "timestamp": {
      "type": "string",
      "format": "date-time"
     },
     "path": {
      "type": "string"
     }
    }
   },
   "PolicyRule": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "resource": {
      "type": "string"
     },
     "action": {
      "type": "string"
     },
     "effect": {
      "type": "string",
      "enum": [
       "ALLOW",
       "DENY"
      ]
     },
     "conditions": {
      "type": "string"
     },
     "priority": {
      "type": "integer",
      "format": "int32"
     },
     "description": {
      "type": "string"
     },
     "enabled": {
      "type": "boolean"
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "PermissionEntity": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "name": {
      "type": "string"
     },
     "description": {
      "type": "string"
     },
     "domain": {
      "type": "string"
     }
    }
   },
   "PolicyEvaluationRequest": {
    "type": "object",
    "properties": {
     "resource": {
      "type": "string"
     },
     "action": {
      "type": "string"
     },
     "context": {
      "type": "object",
      "additionalProperties": {
       "type": "object"
      }
     }
    }
   },
   "PolicyDecision": {
    "type": "object",
    "properties": {
     "allowed": {
      "type": "boolean"
     },
     "reason": {
      "type": "string"
     }
    }
   },
   "CheckAccessRequest": {
    "type": "object",
    "properties": {
     "userId": {
      "type": "string",
      "format": "uuid"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "permission": {
      "type": "string"
     },
     "resourceType": {
      "type": "string"
     },
     "resourceId": {
      "type": "string",
      "format": "uuid"
     }
    }
   },
   "AccessDecision": {
    "type": "object",
    "properties": {
     "allowed": {
      "type": "boolean"
     },
     "reason": {
      "type": "string"
     }
    }
   },
   "TokenValidationResponse": {
    "type": "object",
    "properties": {
     "valid": {
      "type": "boolean"
     },
     "userId": {
      "type": "string",
      "format": "uuid"
     },
     "email": {
      "type": "string"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "roles": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "clientId": {
      "type": "string"
     },
     "expiresAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "TokenIntrospectionResponse": {
    "type": "object",
    "properties": {
     "active": {
      "type": "boolean"
     },
     "sub": {
      "type": "string"
     },
     "client_id": {
      "type": "string"
     },
     "scope": {
      "type": "string"
     },
     "iss": {
      "type": "string"
     },
     "exp": {
      "type": "integer",
      "format": "int64"
     },
     "iat": {
      "type": "integer",
      "format": "int64"
     },
     "jti": {
      "type": "string"
     },
     "token_type": {
      "type": "string"
     },
     "tenant_id": {
      "type": "string"
     },
     "email": {
      "type": "string"
     },
     "roles": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "user_status": {
      "type": "string"
     },
     "membership_status": {
      "type": "string"
     },
     "tenant_status": {
      "type": "string"
     }
    }
   },
   "WorkflowRule": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "eventType": {
      "type": "string"
     },
     "tenantId": {
      "type": "string"
     },
     "pluginId": {
      "type": "string",
      "format": "uuid"
     },
     "description": {
      "type": "string"
     },
     "payloadTemplate": {
      "type": "string"
     },
     "enabled": {
      "type": "boolean"
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     },
     "updatedAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "Pageable": {
    "type": "object",
    "properties": {
     "page": {
      "type": "integer",
      "format": "int32",
      "minimum": 0
     },
     "size": {
      "type": "integer",
      "format": "int32",
      "minimum": 1
     },
     "sort": {
      "type": "array",
      "items": {
       "type": "string"
      }
     }
    }
   },
   "PageEventResponse": {
    "type": "object",
    "properties": {
     "totalElements": {
      "type": "integer",
      "format": "int64"
     },
     "totalPages": {
      "type": "integer",
      "format": "int32"
     },
     "size": {
      "type": "integer",
      "format": "int32"
     },
     "content": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/EventResponse"
      }
     },
     "number": {
      "type": "integer",
      "format": "int32"
     },
     "pageable": {
      "$ref": "#/components/schemas/PageableObject"
     },
     "sort": {
      "$ref": "#/components/schemas/SortObject"
     },
     "numberOfElements": {
      "type": "integer",
      "format": "int32"
     },
     "first": {
      "type": "boolean"
     },
     "last": {
      "type": "boolean"
     },
     "empty": {
      "type": "boolean"
     }
    }
   },
   "EventResponse": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "eventType": {
      "type": "string"
     },
     "source": {
      "type": "string"
     },
     "payload": {
      "type": "string"
     },
     "aggregateId": {
      "type": "string"
     },
     "userId": {
      "type": "string"
     },
     "tenantId": {
      "type": "string"
     },
     "eventTimestamp": {
      "type": "string",
      "format": "date-time"
     },
     "receivedAt": {
      "type": "string",
      "format": "date-time"
     },
     "delivered": {
      "type": "boolean"
     }
    }
   },
   "PageableObject": {
    "type": "object",
    "properties": {
     "offset": {
      "type": "integer",
      "format": "int64"
     },
     "unpaged": {
      "type": "boolean"
     },
     "paged": {
      "type": "boolean"
     },
     "pageNumber": {
      "type": "integer",
      "format": "int32"
     },
     "pageSize": {
      "type": "integer",
      "format": "int32"
     },
     "sort": {
      "$ref": "#/components/schemas/SortObject"
     }
    }
   },
   "SortObject": {
    "type": "object",
    "properties": {
     "empty": {
      "type": "boolean"
     },
     "unsorted": {
      "type": "boolean"
     },
     "sorted": {
      "type": "boolean"
     }
    }
   },
   "NotificationSenderConfig": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "senderName": {
      "type": "string"
     },
     "senderEmail": {
      "type": "string"
     },
     "replyToEmail": {
      "type": "string"
     },
     "smtpHost": {
      "type": "string"
     },
     "smtpPort": {
      "type": "integer",
      "format": "int32"
     },
     "smtpUsername": {
      "type": "string"
     },
     "smtpPassword": {
      "type": "string"
     },
     "smtpTlsEnabled": {
      "type": "boolean"
     },
     "webhookUrl": {
      "type": "string"
     },
     "webhookSecret": {
      "type": "string"
     },
     "fcmServerKey": {
      "type": "string"
     },
     "enabled": {
      "type": "boolean"
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     },
     "updatedAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "NotificationPreference": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "userId": {
      "type": "string",
      "format": "uuid"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "channel": {
      "type": "string"
     },
     "eventType": {
      "type": "string"
     },
     "optedOut": {
      "type": "boolean"
     },
     "updatedAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "NotificationPageResponse": {
    "type": "object",
    "properties": {
     "content": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Notification"
      }
     },
     "number": {
      "type": "integer",
      "format": "int32"
     },
     "size": {
      "type": "integer",
      "format": "int32"
     },
     "totalElements": {
      "type": "integer",
      "format": "int64"
     },
     "totalPages": {
      "type": "integer",
      "format": "int32"
     }
    }
   },
   "Notification": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "userId": {
      "type": "string",
      "format": "uuid"
     },
     "channel": {
      "type": "string"
     },
     "title": {
      "type": "string"
     },
     "body": {
      "type": "string"
     },
     "status": {
      "type": "string"
     },
     "metadata": {
      "type": "string"
     },
     "recipient": {
      "type": "string"
     },
     "scheduledAt": {
      "type": "string",
      "format": "date-time"
     },
     "batchKey": {
      "type": "string"
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     },
     "sentAt": {
      "type": "string",
      "format": "date-time"
     },
     "deliveredAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "DeviceToken": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "userId": {
      "type": "string",
      "format": "uuid"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "token": {
      "type": "string"
     },
     "platform": {
      "type": "string"
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "PageNotification": {
    "type": "object",
    "properties": {
     "totalElements": {
      "type": "integer",
      "format": "int64"
     },
     "totalPages": {
      "type": "integer",
      "format": "int32"
     },
     "size": {
      "type": "integer",
      "format": "int32"
     },
     "content": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Notification"
      }
     },
     "number": {
      "type": "integer",
      "format": "int32"
     },
     "pageable": {
      "$ref": "#/components/schemas/PageableObject"
     },
     "sort": {
      "$ref": "#/components/schemas/SortObject"
     },
     "numberOfElements": {
      "type": "integer",
      "format": "int32"
     },
     "first": {
      "type": "boolean"
     },
     "last": {
      "type": "boolean"
     },
     "empty": {
      "type": "boolean"
     }
    }
   },
   "MessageReadReceipt": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "messageId": {
      "type": "string",
      "format": "uuid"
     },
     "userId": {
      "type": "string",
      "format": "uuid"
     },
     "readAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "MessageReaction": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "messageId": {
      "type": "string",
      "format": "uuid"
     },
     "userId": {
      "type": "string",
      "format": "uuid"
     },
     "emoji": {
      "type": "string"
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "ChatChannel": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "name": {
      "type": "string"
     },
     "type": {
      "type": "string"
     },
     "description": {
      "type": "string"
     },
     "archived": {
      "type": "boolean"
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "PageChatMessage": {
    "type": "object",
    "properties": {
     "totalPages": {
      "type": "integer",
      "format": "int32"
     },
     "totalElements": {
      "type": "integer",
      "format": "int64"
     },
     "size": {
      "type": "integer",
      "format": "int32"
     },
     "content": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/ChatMessage"
      }
     },
     "number": {
      "type": "integer",
      "format": "int32"
     },
     "pageable": {
      "$ref": "#/components/schemas/PageableObject"
     },
     "sort": {
      "$ref": "#/components/schemas/SortObject"
     },
     "numberOfElements": {
      "type": "integer",
      "format": "int32"
     },
     "first": {
      "type": "boolean"
     },
     "last": {
      "type": "boolean"
     },
     "empty": {
      "type": "boolean"
     }
    }
   },
   "ChatMessage": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "channel": {
      "$ref": "#/components/schemas/ChatChannel"
     },
     "senderId": {
      "type": "string",
      "format": "uuid"
     },
     "content": {
      "type": "string"
     },
     "messageType": {
      "type": "string"
     },
     "replyToId": {
      "type": "string",
      "format": "uuid"
     },
     "deleted": {
      "type": "boolean"
     },
     "sentAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "UnreadCountDto": {
    "type": "object",
    "properties": {
     "roomId": {
      "type": "string",
      "format": "uuid"
     },
     "count": {
      "type": "integer",
      "format": "int64"
     }
    }
   },
   "ChatRoomMemberDto": {
    "type": "object",
    "properties": {
     "userId": {
      "type": "string",
      "format": "uuid"
     },
     "displayName": {
      "type": "string"
     },
     "online": {
      "type": "boolean"
     }
    }
   },
   "Wallet": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "userId": {
      "type": "string",
      "format": "uuid"
     },
     "currency": {
      "type": "string"
     },
     "balance": {
      "type": "number"
     },
     "status": {
      "type": "string"
     },
     "perTransactionLimit": {
      "type": "number"
     },
     "dailyLimit": {
      "type": "number"
     },
     "monthlyLimit": {
      "type": "number"
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     },
     "updatedAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "WalletHold": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "walletId": {
      "type": "string",
      "format": "uuid"
     },
     "amount": {
      "type": "number"
     },
     "currency": {
      "type": "string"
     },
     "status": {
      "type": "string"
     },
     "referenceType": {
      "type": "string"
     },
     "referenceId": {
      "type": "string"
     },
     "clientTransactionId": {
      "type": "string"
     },
     "captureClientTransactionId": {
      "type": "string"
     },
     "capturedAmount": {
      "type": "number"
     },
     "releasedAmount": {
      "type": "number"
     },
     "expiresAt": {
      "type": "string",
      "format": "date-time"
     },
     "description": {
      "type": "string"
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     },
     "updatedAt": {
      "type": "string",
      "format": "date-time"
     },
     "outstandingAmount": {
      "type": "number"
     }
    }
   },
   "WalletTransaction": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "type": {
      "type": "string"
     },
     "amount": {
      "type": "number"
     },
     "balanceAfter": {
      "type": "number"
     },
     "description": {
      "type": "string"
     },
     "referenceId": {
      "type": "string"
     },
     "clientTransactionId": {
      "type": "string"
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "PageWalletTransaction": {
    "type": "object",
    "properties": {
     "totalPages": {
      "type": "integer",
      "format": "int32"
     },
     "totalElements": {
      "type": "integer",
      "format": "int64"
     },
     "size": {
      "type": "integer",
      "format": "int32"
     },
     "content": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/WalletTransaction"
      }
     },
     "number": {
      "type": "integer",
      "format": "int32"
     },
     "sort": {
      "$ref": "#/components/schemas/SortObject"
     },
     "pageable": {
      "$ref": "#/components/schemas/PageableObject"
     },
     "numberOfElements": {
      "type": "integer",
      "format": "int32"
     },
     "first": {
      "type": "boolean"
     },
     "last": {
      "type": "boolean"
     },
     "empty": {
      "type": "boolean"
     }
    }
   },
   "QueueTask": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "queueName": {
      "type": "string"
     },
     "taskType": {
      "type": "string"
     },
     "payload": {
      "type": "string"
     },
     "status": {
      "type": "string"
     },
     "priority": {
      "type": "integer",
      "format": "int32"
     },
     "attempts": {
      "type": "integer",
      "format": "int32"
     },
     "maxAttempts": {
      "type": "integer",
      "format": "int32"
     },
     "scheduledAt": {
      "type": "string",
      "format": "date-time"
     },
     "startedAt": {
      "type": "string",
      "format": "date-time"
     },
     "completedAt": {
      "type": "string",
      "format": "date-time"
     },
     "errorMessage": {
      "type": "string"
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "PageQueueTask": {
    "type": "object",
    "properties": {
     "totalPages": {
      "type": "integer",
      "format": "int32"
     },
     "totalElements": {
      "type": "integer",
      "format": "int64"
     },
     "size": {
      "type": "integer",
      "format": "int32"
     },
     "content": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/QueueTask"
      }
     },
     "number": {
      "type": "integer",
      "format": "int32"
     },
     "pageable": {
      "$ref": "#/components/schemas/PageableObject"
     },
     "sort": {
      "$ref": "#/components/schemas/SortObject"
     },
     "numberOfElements": {
      "type": "integer",
      "format": "int32"
     },
     "first": {
      "type": "boolean"
     },
     "last": {
      "type": "boolean"
     },
     "empty": {
      "type": "boolean"
     }
    }
   },
   "TemplateResponse": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "tenantId": {
      "type": "string",
      "format": "uuid"
     },
     "name": {
      "type": "string"
     },
     "description": {
      "type": "string"
     },
     "definitionJson": {
      "type": "string"
     },
     "version": {
      "type": "integer",
      "format": "int32"
     },
     "status": {
      "type": "string"
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     },
     "updatedAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "UpdateTemplateRequest": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string"
     },
     "description": {
      "type": "string"
     },
     "definitionJson": {
      "type": "string"
     }
    }
   },
   "CreateTemplateRequest": {
    "type": "object",
    "properties": {
     "name": {
      "type": "string",
      "minLength": 1
     },
     "description": {
      "type": "string"
     },
     "definitionJson": {
      "type": "string",
      "minLength": 1
     }
    }
   },
   "WebhookRegistration": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "tenantId": {
      "type": "string"
     },
     "url": {
      "type": "string"
     },
     "events": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "secret": {
      "type": "string"
     },
     "active": {
      "type": "boolean"
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "WebhookRequest": {
    "type": "object",
    "properties": {
     "url": {
      "type": "string",
      "minLength": 1
     },
     "events": {
      "type": "array",
      "items": {
       "type": "string"
      },
      "minItems": 1
     },
     "filterExpression": {
      "type": "string"
     },
     "retryPolicy": {
      "$ref": "#/components/schemas/WebhookRetryPolicy"
     }
    }
   },
   "WebhookRetryPolicy": {
    "type": "object",
    "properties": {
     "maxAttempts": {
      "type": "integer",
      "format": "int32"
     },
     "initialDelayMs": {
      "type": "integer",
      "format": "int64"
     },
     "backoffMultiplier": {
      "type": "number",
      "format": "double"
     }
    }
   },
   "PagePlugin": {
    "type": "object",
    "properties": {
     "totalPages": {
      "type": "integer",
      "format": "int32"
     },
     "totalElements": {
      "type": "integer",
      "format": "int64"
     },
     "size": {
      "type": "integer",
      "format": "int32"
     },
     "content": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Plugin"
      }
     },
     "number": {
      "type": "integer",
      "format": "int32"
     },
     "pageable": {
      "$ref": "#/components/schemas/PageableObject"
     },
     "sort": {
      "$ref": "#/components/schemas/SortObject"
     },
     "numberOfElements": {
      "type": "integer",
      "format": "int32"
     },
     "first": {
      "type": "boolean"
     },
     "last": {
      "type": "boolean"
     },
     "empty": {
      "type": "boolean"
     }
    }
   },
   "Plugin": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "name": {
      "type": "string"
     },
     "version": {
      "type": "string"
     },
     "manifestUrl": {
      "type": "string"
     },
     "webhookUrl": {
      "type": "string"
     },
     "requiredScopes": {
      "type": "string"
     },
     "installedByTenantId": {
      "type": "string",
      "format": "uuid"
     },
     "signingSecret": {
      "type": "string"
     },
     "status": {
      "type": "string"
     },
     "enabled": {
      "type": "boolean"
     },
     "description": {
      "type": "string"
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     },
     "updatedAt": {
      "type": "string",
      "format": "date-time"
     }
    }
   },
   "PagedResponseWebhookDeliveryLogEntity": {
    "type": "object",
    "properties": {
     "content": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/WebhookDeliveryLogEntity"
      }
     },
     "page": {
      "type": "integer",
      "format": "int32"
     },
     "size": {
      "type": "integer",
      "format": "int32"
     },
     "totalElements": {
      "type": "integer",
      "format": "int64"
     },
     "totalPages": {
      "type": "integer",
      "format": "int32"
     },
     "hasNext": {
      "type": "boolean"
     },
     "hasPrevious": {
      "type": "boolean"
     }
    }
   },
   "WebhookDeliveryLogEntity": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "format": "uuid"
     },
     "createdAt": {
      "type": "string",
      "format": "date-time"
     },
     "updatedAt": {
      "type": "string",
      "format": "date-time"
     },
     "deliveryId": {
      "type": "string"
     },
     "registrationId": {
      "type": "string",
      "format": "uuid"
     },
     "tenantId": {
      "type": "string"
     },
     "eventType": {
      "type": "string"
     },
     "status": {
      "type": "string"
     },
     "attempts": {
      "type": "integer",
      "format": "int32"
     },
     "requestPayload": {
      "type": "string"
     },
     "responseStatus": {
      "type": "integer",
      "format": "int32"
     },
     "responseBody": {
      "type": "string"
     },
     "lastAttemptAt": {
      "type": "string",
      "format": "date-time"
     },
     "nextRetryAt": {
      "type": "string",
      "format": "date-time"
     },
     "lastError": {
      "type": "string"
     },
     "sequenceNumber": {
      "type": "integer",
      "format": "int64"
     }
    }
   }
  }
 }
}
